<TypeLibraryName>.\..\..\lib\icuuc.tlb</TypeLibraryName>\r
</Midl>\r
<ClCompile>\r
- <PreprocessorDefinitions>WIN32;NDEBUG;_CRT_SECURE_NO_DEPRECATE;U_COMMON_IMPLEMENTATION;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r
+ <PreprocessorDefinitions>U_ATTRIBUTE_DEPRECATED=;WIN32;NDEBUG;_CRT_SECURE_NO_DEPRECATE;U_COMMON_IMPLEMENTATION;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r
<StringPooling>true</StringPooling>\r
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>\r
<FunctionLevelLinking>true</FunctionLevelLinking>\r
</Midl>\r
<ClCompile>\r
<Optimization>Disabled</Optimization>\r
- <PreprocessorDefinitions>WIN32;_DEBUG;_CRT_SECURE_NO_DEPRECATE;U_COMMON_IMPLEMENTATION;RBBI_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r
+ <PreprocessorDefinitions>U_ATTRIBUTE_DEPRECATED=;WIN32;_DEBUG;_CRT_SECURE_NO_DEPRECATE;U_COMMON_IMPLEMENTATION;RBBI_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>\r
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>\r
<BufferSecurityCheck>true</BufferSecurityCheck>\r
<TypeLibraryName>.\..\..\lib64\icuuc.tlb</TypeLibraryName>\r
</Midl>\r
<ClCompile>\r
- <PreprocessorDefinitions>WIN64;WIN32;NDEBUG;_CRT_SECURE_NO_DEPRECATE;U_COMMON_IMPLEMENTATION;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r
+ <PreprocessorDefinitions>U_ATTRIBUTE_DEPRECATED=;WIN64;WIN32;NDEBUG;_CRT_SECURE_NO_DEPRECATE;U_COMMON_IMPLEMENTATION;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r
<StringPooling>true</StringPooling>\r
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>\r
<FunctionLevelLinking>true</FunctionLevelLinking>\r
</Midl>\r
<ClCompile>\r
<Optimization>Disabled</Optimization>\r
- <PreprocessorDefinitions>WIN64;WIN32;_DEBUG;_CRT_SECURE_NO_DEPRECATE;U_COMMON_IMPLEMENTATION;RBBI_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r
+ <PreprocessorDefinitions>U_ATTRIBUTE_DEPRECATED=;WIN64;WIN32;_DEBUG;_CRT_SECURE_NO_DEPRECATE;U_COMMON_IMPLEMENTATION;RBBI_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>\r
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>\r
<BufferSecurityCheck>true</BufferSecurityCheck>\r
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">copy "%(FullPath)" unicode\%(FileName).h\r
copy "%(FullPath)" ..\..\include\unicode\%(FileName).h</Command>\r
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">unicode\%(Filename).h;..\..\include\unicode\%(Filename).h;%(Outputs)</Outputs>\r
- <Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">copy "%(FullPath)" unicode\%(FileName).h\r
+ <Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">copy "%(FullPath)" unicode\%(FileName).h\r
copy "%(FullPath)" ..\..\include\unicode\%(FileName).h</Command>\r
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">unicode\%(Filename).h;..\..\include\unicode\%(Filename).h;%(Outputs)</Outputs>\r
<Command Condition="'$(Configuration)|$(Platform)'=='Release|x64'">copy "%(FullPath)" unicode\%(FileName).h\r
}
}
}
+ fclose(f);
} else {
#if UPLUG_TRACE
DBG((stderr, "Can't open plugin file %s\n", plugin_file));
int32_t langPos=0; /* position in output of language substitution */
int32_t restLen=0; /* length of 'everything else' substitution */
int32_t restPos=0; /* position in output of 'everything else' substitution */
- UEnumeration* kenum; /* keyword enumeration */
+ UEnumeration* kenum = NULL; /* keyword enumeration */
/* prefix of pattern, extremely likely to be empty */
if(sub0Pos) {
ret = GetLocaleInfoA(hostid, LOCALE_SNAME, (LPSTR)gPosixFromLCID, sizeof(gPosixFromLCID));
if (ret > 1) {
- FIX_LOCALE_ID_TAG_SEPARATOR(gPosixFromLCID, ret, localeIndex)
+ FIX_LOCALE_ID_TAG_SEPARATOR(gPosixFromLCID, (uint32_t)ret, localeIndex)
FIX_LANGUAGE_ID_TAG(gPosixFromLCID, ret)
return gPosixFromLCID;
ext = uprv_malloc(sizeof(ExtensionListEntry));
if (ext == NULL) {
*status = U_MEMORY_ALLOCATION_ERROR;
+ goto cleanup;
}
ext->key = POSIX_KEY;
ext->value = POSIX_VALUE;
}
} while (attr != NULL || ext != NULL);
}
+cleanup:
/* clean up */
ext = firstExt;
while (ext != NULL) {
/* create a ULanguageTag */
t = (ULanguageTag*)uprv_malloc(sizeof(ULanguageTag));
- _initializeULanguageTag(t);
- t->buf = tagBuf;
if (t == NULL) {
uprv_free(tagBuf);
*status = U_MEMORY_ALLOCATION_ERROR;
return NULL;
}
+ _initializeULanguageTag(t);
+ t->buf = tagBuf;
if (tagLen < MINLEN) {
/* the input tag is too short - return empty ULanguageTag */
# define U_CDECL_END
#endif
+#ifndef U_ATTRIBUTE_DEPRECATED
/**
* \def U_ATTRIBUTE_DEPRECATED
* This is used for GCC specific attributes
#else
# define U_ATTRIBUTE_DEPRECATED
#endif
+#endif
+
/** This is used to declare a function as a public ICU C API @stable ICU 2.0*/
#define U_CAPI U_CFUNC U_EXPORT
/** This is used to declare a function as a stable public ICU C API*/
UnicodeSet *set=new UnicodeSet(pattern, errorCode);
if(set==NULL) {
errorCode=U_MEMORY_ALLOCATION_ERROR;
+ return NULL;
}
set->freeze();
ucln_common_registerCleanup(UCLN_COMMON_USET, uset_cleanup);
NULL, // don't need remove()
NULL // don't need removeRange()
};
- incl->ensureCapacity(DEFAULT_INCLUSION_CAPACITY, status);
if (incl != NULL) {
+ incl->ensureCapacity(DEFAULT_INCLUSION_CAPACITY, status);
switch(src) {
case UPROPS_SRC_CHAR:
uchar_addPropertyStarts(&sa, &status);
/*
******************************************************************************
-* Copyright (c) 1996-2010, International Business Machines
+* Copyright (c) 1996-2011, International Business Machines
* Corporation and others. All Rights Reserved.
******************************************************************************
* File unorm.cpp
} else {
uni32=NULL; // unused
}
+
+ if(U_FAILURE(*pErrorCode)) {
+ return 0;
+ }
+
FilteredNormalizer2 fn2(*n2, *uni32);
if(options&UNORM_UNICODE_3_2) {
n2=&fn2;
}
- if(U_FAILURE(*pErrorCode)) {
- return 0;
- }
+
if( destCapacity<0 || (dest==NULL && destCapacity>0) ||
src==NULL
) {
} else {
uni32=NULL; // unused
}
+
+ if(U_FAILURE(*pErrorCode)) {
+ return 0;
+ }
+
FilteredNormalizer2 fn2(*n2, *uni32);
if(options&UNORM_UNICODE_3_2) {
n2=&fn2;
}
- if(U_FAILURE(*pErrorCode)) {
- return 0;
- }
+
if( destCapacity<0 || (dest==NULL && destCapacity>0) ||
left==NULL || leftLength<-1 ||
right==NULL || rightLength<-1
/*
*******************************************************************************
*
-* Copyright (C) 2001-2010, International Business Machines
+* Copyright (C) 2001-2011, International Business Machines
* Corporation and others. All Rights Reserved.
*
*******************************************************************************
} else {
uni32=NULL; // unused
}
+ if(U_FAILURE(*pErrorCode)) {
+ return 0;
+ }
FilteredNormalizer2 fn2(*n2, *uni32);
if(normOptions&UNORM_UNICODE_3_2) {
n2=&fn2;
return NULL;
}
UVector *dest = new UVector(status);
- dest->setDeleter(uprv_deleteUObject);
if (dest == NULL && U_SUCCESS(status)) {
status = U_MEMORY_ALLOCATION_ERROR;
+ return NULL;
}
+ dest->setDeleter(uprv_deleteUObject);
const UChar *src = HACK_FIRST_CHARS_IN_SCRIPTS;
const UChar *limit = src + sizeof(HACK_FIRST_CHARS_IN_SCRIPTS) / sizeof(HACK_FIRST_CHARS_IN_SCRIPTS[0]);
do {
</Midl>\r
<ClCompile>\r
<AdditionalIncludeDirectories>..\..\include;..\common;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>\r
- <PreprocessorDefinitions>WIN32;NDEBUG;_CRT_SECURE_NO_DEPRECATE;U_I18N_IMPLEMENTATION;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r
+ <PreprocessorDefinitions>U_ATTRIBUTE_DEPRECATED=;WIN32;NDEBUG;_CRT_SECURE_NO_DEPRECATE;U_I18N_IMPLEMENTATION;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r
<StringPooling>true</StringPooling>\r
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>\r
<FunctionLevelLinking>true</FunctionLevelLinking>\r
<ClCompile>\r
<Optimization>Disabled</Optimization>\r
<AdditionalIncludeDirectories>..\..\include;..\common;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>\r
- <PreprocessorDefinitions>WIN32;_DEBUG;_CRT_SECURE_NO_DEPRECATE;U_I18N_IMPLEMENTATION;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r
+ <PreprocessorDefinitions>U_ATTRIBUTE_DEPRECATED=;WIN32;_DEBUG;_CRT_SECURE_NO_DEPRECATE;U_I18N_IMPLEMENTATION;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>\r
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>\r
<BufferSecurityCheck>true</BufferSecurityCheck>\r
</Midl>\r
<ClCompile>\r
<AdditionalIncludeDirectories>..\..\include;..\common;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>\r
- <PreprocessorDefinitions>WIN64;WIN32;NDEBUG;_CRT_SECURE_NO_DEPRECATE;U_I18N_IMPLEMENTATION;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r
+ <PreprocessorDefinitions>U_ATTRIBUTE_DEPRECATED=;WIN64;WIN32;NDEBUG;_CRT_SECURE_NO_DEPRECATE;U_I18N_IMPLEMENTATION;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r
<StringPooling>true</StringPooling>\r
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>\r
<FunctionLevelLinking>true</FunctionLevelLinking>\r
<ClCompile>\r
<Optimization>Disabled</Optimization>\r
<AdditionalIncludeDirectories>..\..\include;..\common;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>\r
- <PreprocessorDefinitions>WIN64;WIN32;_DEBUG;_CRT_SECURE_NO_DEPRECATE;U_I18N_IMPLEMENTATION;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r
+ <PreprocessorDefinitions>U_ATTRIBUTE_DEPRECATED=;WIN64;WIN32;_DEBUG;_CRT_SECURE_NO_DEPRECATE;U_I18N_IMPLEMENTATION;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>\r
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>\r
<BufferSecurityCheck>true</BufferSecurityCheck>\r
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />\r
<ImportGroup Label="ExtensionTargets">\r
</ImportGroup>\r
-</Project>\r
+</Project>
\ No newline at end of file
}
-bool MessageFormat::argNameMatches(int32_t partIndex, const UnicodeString& argName, int32_t argNumber) {
+UBool MessageFormat::argNameMatches(int32_t partIndex, const UnicodeString& argName, int32_t argNumber) {
const MessagePattern::Part& part = msgPattern.getPart(partIndex);
return part.getType() == UMSGPAT_PART_TYPE_ARG_NAME ?
msgPattern.partSubstringMatches(part, argName) :
double
PluralRules::getUniqueKeywordValue(const UnicodeString& keyword) {
- double val;
+ double val = 0.0;
UErrorCode status = U_ZERO_ERROR;
int32_t count = getSamplesInternal(keyword, &val, 1, FALSE, status);
return count == 1 ? val : UPLRULES_NO_UNIQUE_VALUE;
int32_t nextTopLevelArgStart(int32_t partIndex) const;
- bool argNameMatches(int32_t partIndex, const UnicodeString& argName, int32_t argNumber);
+ UBool argNameMatches(int32_t partIndex, const UnicodeString& argName, int32_t argNumber);
void cacheExplicitFormats(UErrorCode& status);
/**
* @internal
*/
- class PluralSelector : public UMemory {
+ class U_I18N_API PluralSelector : public UMemory {
public:
/**
* Given a number, returns the appropriate PluralFormat keyword.
UOBJECT_DEFINE_RTTI_IMPLEMENTATION(SpoofImpl)
SpoofImpl::SpoofImpl(SpoofData *data, UErrorCode &status) :
- fMagic(0), fSpoofData(NULL), fAllowedCharsSet(NULL) , fAllowedLocales(NULL) {
+ fMagic(0), fSpoofData(NULL), fAllowedCharsSet(NULL) , fAllowedLocales(uprv_strdup("")) {
if (U_FAILURE(status)) {
return;
}
fSpoofData = data;
fChecks = USPOOF_ALL_CHECKS;
UnicodeSet *allowedCharsSet = new UnicodeSet(0, 0x10ffff);
- if (allowedCharsSet == NULL) {
+ if (allowedCharsSet == NULL || fAllowedLocales == NULL) {
status = U_MEMORY_ALLOCATION_ERROR;
+ return;
}
allowedCharsSet->freeze();
fAllowedCharsSet = allowedCharsSet;
- fAllowedLocales = uprv_strdup("");
}
#
# Yves Arrouye.
#
-# Copyright (C) 2000-2010, International Business Machines Corporation and others.
+# Copyright (C) 2000-2011, International Business Machines Corporation and others.
# All Rights Reserved.
#
# DEFS is for common macro definitions.
# configure prevents user defined DEFS, and configure's DEFS is not needed
# So we ignore the DEFS that comes from configure
-DEFS =
+# U_ATTRIBUTE_DEPRECATED is defined to hide warnings about deprecated API warnings.
+DEFS = -DU_ATTRIBUTE_DEPRECATED=
# CFLAGS is for C only flags
CFLAGS = @CFLAGS@
# CXXFLAGS is for C++ only flags
/**************************************************************************
*
-* Copyright (C) 2000-2010, International Business Machines
+* Copyright (C) 2000-2011, International Business Machines
* Corporation and others. All Rights Reserved.
*
***************************************************************************
char inBuf[BUFFERSIZE];
const char *source;
const char *sourceLimit;
- UChar *uBuf;
int32_t uBufSize = 0;
UConverter *conv;
UErrorCode status = U_ZERO_ERROR;
uBufSize = (BUFFERSIZE/ucnv_getMinCharSize(conv));
printf("input bytes %d / min chars %d = %d UChars\n",
BUFFERSIZE, ucnv_getMinCharSize(conv), uBufSize);
- uBuf = (UChar*)malloc(uBufSize * sizeof(UChar));
- assert(uBuf!=NULL);
// grab another buffer's worth
while((!feof(f)) &&
if(p>charCount)
{
fprintf(stderr, "U+%06X: oh.., we only handle BMP characters so far.. redesign!\n", p);
+ free(info);
+ fclose(f);
+ ucnv_close(conv);
return U_UNSUPPORTED_ERROR;
}
info[p].frequency++;
bocu1ICULength=ucnv_fromUChars(bocu1, bocu1ICU, DEFAULT_BUFFER_SIZE, text, length, &errorCode);
if(U_FAILURE(errorCode)) {
log_err("ucnv_fromUChars(BOCU-1, text(%d)[%d]) failed: %s\n", number, length, u_errorName(errorCode));
- return;
+ goto cleanup;
}
if(bocu1RefLength!=bocu1ICULength || 0!=uprv_memcmp(bocu1Ref, bocu1ICU, bocu1RefLength)) {
log_err("Unicode(%d)[%d] -> BOCU-1: reference[%d]!=ICU[%d]\n", number, length, bocu1RefLength, bocu1ICULength);
- return;
+ goto cleanup;
}
/* BOCU-1 -> Unicode */
roundtripRefLength=readString((uint8_t *)bocu1Ref, bocu1RefLength, roundtripRef);
if(roundtripRefLength<0) {
- free(roundtripICU);
- return; /* readString() found an error and reported it */
+ goto cleanup; /* readString() found an error and reported it */
}
roundtripICULength=ucnv_toUChars(bocu1, roundtripICU, DEFAULT_BUFFER_SIZE, bocu1ICU, bocu1ICULength, &errorCode);
if(U_FAILURE(errorCode)) {
log_err("ucnv_toUChars(BOCU-1, text(%d)[%d]) failed: %s\n", number, length, u_errorName(errorCode));
- return;
+ goto cleanup;
}
if(length!=roundtripRefLength || 0!=u_memcmp(text, roundtripRef, length)) {
log_err("BOCU-1 -> Unicode: original(%d)[%d]!=reference[%d]\n", number, length, roundtripRefLength);
- return;
+ goto cleanup;
}
if(roundtripRefLength!=roundtripICULength || 0!=u_memcmp(roundtripRef, roundtripICU, roundtripRefLength)) {
log_err("BOCU-1 -> Unicode: reference(%d)[%d]!=ICU[%d]\n", number, roundtripRefLength, roundtripICULength);
- return;
+ goto cleanup;
}
+cleanup:
free(roundtripRef);
free(roundtripICU);
free(bocu1Ref);
/*Test ucal_openTimeZones, ucal_openCountryTimeZones and ucal_openTimeZoneIDEnumeration */
for (j=0; j<6; ++j) {
- const char *api;
+ const char *api = "?";
const int32_t offsetMinus5 = -5*60*60*1000;
switch (j) {
case 0:
if (!myConverter || U_FAILURE(err))
{
log_data_err("Error creating the ibm-949 converter - %s \n", u_errorName(err));
-
- return;
+ fclose(ucs_file_name);
+ break;
}
/*testing for ucnv_getName() */
if (BOM!=0xFEFF && BOM!=0xFFFE)
{
log_err("File Missing BOM...Bailing!\n");
- return;
+ fclose(ucs_file_in);
+ break;
}
"\xff"
};
+#define ARG_CHAR_ARR_SIZE 8
+
/* get some character that can be converted and convert it */
static UBool getTestChar(UConverter *cnv, const char *converterName,
char charUTF8[4], int32_t *pCharUTF8Length,
- char char0[8], int32_t *pChar0Length,
- char char1[8], int32_t *pChar1Length) {
+ char char0[ARG_CHAR_ARR_SIZE], int32_t *pChar0Length,
+ char char1[ARG_CHAR_ARR_SIZE], int32_t *pChar1Length) {
UChar utf16[U16_MAX_LENGTH];
int32_t utf16Length;
utf16Source=utf16;
target=char0;
ucnv_fromUnicode(cnv,
- &target, char0+sizeof(char0),
+ &target, char0+ARG_CHAR_ARR_SIZE,
&utf16Source, utf16+utf16Length,
NULL, FALSE, &errorCode);
*pChar0Length=(int32_t)(target-char0);
utf16Source=utf16;
target=char1;
ucnv_fromUnicode(cnv,
- &target, char1+sizeof(char1),
+ &target, char1+ARG_CHAR_ARR_SIZE,
&utf16Source, utf16+utf16Length,
NULL, FALSE, &errorCode);
*pChar1Length=(int32_t)(target-char1);
<ClCompile>\r
<Optimization>Disabled</Optimization>\r
<AdditionalIncludeDirectories>..\..\..\include;..\..\tools\ctestfw;..\..\common;..\..\i18n;..\..\tools\toolutil;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>\r
- <PreprocessorDefinitions>WIN32;_DEBUG;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r
+ <PreprocessorDefinitions>U_ATTRIBUTE_DEPRECATED=;WIN32;_DEBUG;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>\r
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>\r
<BufferSecurityCheck>true</BufferSecurityCheck>\r
</Midl>\r
<ClCompile>\r
<AdditionalIncludeDirectories>..\..\..\include;..\..\tools\ctestfw;..\..\common;..\..\i18n;..\..\tools\toolutil;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>\r
- <PreprocessorDefinitions>WIN32;NDEBUG;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r
+ <PreprocessorDefinitions>U_ATTRIBUTE_DEPRECATED=;WIN32;NDEBUG;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r
<StringPooling>true</StringPooling>\r
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>\r
<BufferSecurityCheck>true</BufferSecurityCheck>\r
<ClCompile>\r
<Optimization>Disabled</Optimization>\r
<AdditionalIncludeDirectories>..\..\..\include;..\..\tools\ctestfw;..\..\common;..\..\i18n;..\..\tools\toolutil;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>\r
- <PreprocessorDefinitions>WIN64;WIN32;_DEBUG;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r
+ <PreprocessorDefinitions>U_ATTRIBUTE_DEPRECATED=;WIN64;WIN32;_DEBUG;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>\r
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>\r
<BufferSecurityCheck>true</BufferSecurityCheck>\r
</Midl>\r
<ClCompile>\r
<AdditionalIncludeDirectories>..\..\..\include;..\..\tools\ctestfw;..\..\common;..\..\i18n;..\..\tools\toolutil;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>\r
- <PreprocessorDefinitions>WIN64;WIN32;NDEBUG;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r
+ <PreprocessorDefinitions>U_ATTRIBUTE_DEPRECATED=;WIN64;WIN32;NDEBUG;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r
<StringPooling>true</StringPooling>\r
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>\r
<BufferSecurityCheck>true</BufferSecurityCheck>\r
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />\r
<ImportGroup Label="ExtensionTargets">\r
</ImportGroup>\r
-</Project>
+</Project>
\ No newline at end of file
cleanUpDataTable();
}
-/* obviously, on non-ascii platforms this is useless, but it's test/debug code */
/* if len < 0, we convert until we hit UChar 0x0000, which is not output. will add trailing null
* if there's room but won't be included in result. result < 0 indicates an error.
* Returns the number of chars written (not those that would be written if there's enough room.*/
static int32_t UCharsToEscapedAscii(const UChar* utext, int32_t len, char* resultChars, int32_t buflen) {
-#if U_CHARSET_FAMILY != U_ASCII_FAMILY
- return -1;
-#else
- static const UChar ESCAPE_MAP[] = {
- /*a*/ 0x61, 0x07,
- /*b*/ 0x62, 0x08,
- /*e*/ 0x65, 0x1b,
- /*f*/ 0x66, 0x0c,
- /*n*/ 0x6E, 0x0a,
- /*r*/ 0x72, 0x0d,
- /*t*/ 0x74, 0x09,
- /*v*/ 0x76, 0x0b
+ static const struct {
+ char escapedChar;
+ UChar sourceVal;
+ } ESCAPE_MAP[] = {
+ /*a*/ {'a', 0x07},
+ /*b*/ {'b', 0x08},
+ /*e*/ {'e', 0x1b},
+ /*f*/ {'f', 0x0c},
+ /*n*/ {'n', 0x0a},
+ /*r*/ {'r', 0x0d},
+ /*t*/ {'t', 0x09},
+ /*v*/ {'v', 0x0b}
};
static const int32_t ESCAPE_MAP_LENGTH = sizeof(ESCAPE_MAP)/sizeof(ESCAPE_MAP[0]);
static const char HEX_DIGITS[] = {
- 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37,
- 0x38, 0x39, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66
+ '0', '1', '2', '3', '4', '5', '6', '7',
+ '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'
};
int32_t i, j;
int32_t resultLen = 0;
break;
}
if(uc<0x20) {
- for(j=0;j<ESCAPE_MAP_LENGTH;j+=2) {
- if(uc==ESCAPE_MAP[j+1]) {
- break;
- }
+ for(j=0;j<ESCAPE_MAP_LENGTH && uc!=ESCAPE_MAP[j].sourceVal;j++) {
}
if(j<ESCAPE_MAP_LENGTH) {
if(resultLen>escapeLimit1) {
break;
}
resultChars[resultLen++]='\\';
- resultChars[resultLen++]=ESCAPE_MAP[j];
+ resultChars[resultLen++]=ESCAPE_MAP[j].escapedChar;
continue;
}
} else if(uc<0x7f) {
- resultChars[resultLen++] = uc;
+ u_austrncpy(resultChars + resultLen, &uc, 1);
+ resultLen++;
continue;
}
}
return resultLen;
-#endif
}
/*
locale, displayLocale, preflightLen, expectedLen);
} else if(u_strncmp(result, expected, len)) {
int32_t cap=len*6+1; /* worst case + space for trailing null */
- char* resultChars=malloc(cap);
+ char* resultChars=(char*)malloc(cap);
int32_t resultCharsLen=UCharsToEscapedAscii(result, len, resultChars, cap);
if(resultCharsLen<0 || resultCharsLen<cap-1) {
log_err("uloc_getDisplayName(%s, %s...) mismatch", locale, displayLocale);
log_err("Set was zero. Missing data?\n");
return;
}
- t = malloc(charsToTestSize * sizeof(tester *));
+ t = (tester **)malloc(charsToTestSize * sizeof(tester *));
t[0] = (tester *)malloc(sizeof(tester));
log_verbose("Testing UCA extensively for %d characters\n", charsToTestSize);
UChar testString[] = { 0x03b1, 0x03b2, 0x03b3 };
- int i;
+ uint32_t i;
log_verbose("Testing non-lead bytes in a sort key with and without reordering\n");
return ( *(int32_t*)a - *(int32_t*)b );
}
-static void TestEquivalentReorderingScripts() {
+static void TestEquivalentReorderingScripts(void) {
UErrorCode status = U_ZERO_ERROR;
int32_t equivalentScripts[50];
int32_t equivalentScriptsLength;
}
}
-static void TestReorderingAcrossCloning()
+static void TestReorderingAcrossCloning(void)
{
UErrorCode status = U_ZERO_ERROR;
UCollator *myCollation;
*/
static void doTestOneReorderingAPITestCase(const OneTestCase testCases[], uint32_t testCasesLen, const int32_t reorderTokens[], int32_t reorderTokensLen)
{
- int testCaseNum;
+ uint32_t testCaseNum;
UErrorCode status = U_ZERO_ERROR;
UCollator *myCollation;
doTestOneReorderingAPITestCase(privateUseCharacterStrings, LEN(privateUseCharacterStrings), apiRules, LEN(apiRules));
}
-static void TestMultipleReorder()
+static void TestMultipleReorder(void)
{
const char* strRules[] = {
"[reorder Grek Zzzz DIGIT Latn Hani]"
for (i = 0; i < LENGTHOF(notFixedWidth); i++) {
cnv = ucnv_open(notFixedWidth[i], &status);
if (cnv == NULL || U_FAILURE(status)) {
- log_data_err("Error open converter: %s - %s \n", fixedWidth[i], u_errorName(status));
+ log_data_err("Error open converter: %s - %s \n", notFixedWidth[i], u_errorName(status));
continue;
}
if (ucnv_isFixedWidth(cnv, &status)) {
- log_err("%s is NOT a fixedWidth converter but returned TRUE.\n", fixedWidth[i]);
+ log_err("%s is NOT a fixedWidth converter but returned TRUE.\n", notFixedWidth[i]);
}
ucnv_close(cnv);
}
/********************************************************************
* COPYRIGHT:
- * Copyright (c) 1998-2010, International Business Machines Corporation and
+ * Copyright (c) 1998-2011, International Business Machines Corporation and
* others. All Rights Reserved.
********************************************************************/
/*
}
}
-static void TestVersion()
+static void TestVersion(void)
{
UVersionInfo versionArray = {0x01, 0x00, 0x02, 0x02};
UVersionInfo versionArray2 = {0x01, 0x00, 0x02, 0x02};
}
}
-static void TestCompareVersions()
+static void TestCompareVersions(void)
{
/* use a 1d array to be palatable to java */
const char *testCases[] = {
nativeIndex = utext_getNativeIndex(actual);
/* Following returns U_INDEX_OUTOFBOUNDS_ERROR... looks like a bug in ucstrFuncs UTextFuncs [utext.cpp] */
/* len16 = utext_extract(actual, nativeIndex, nativeIndex + group_len, NULL, 0, &shallowStatus); */
- len16 = group_len;
+ len16 = (int32_t)group_len;
groupChars = (UChar *)malloc(sizeof(UChar)*(len16+1));
utext_extract(actual, nativeIndex, nativeIndex + group_len, groupChars, len16+1, &shallowStatus);
/*
*******************************************************************************
*
- * Copyright (C) 2003-2008, International Business Machines
+ * Copyright (C) 2003-2011, International Business Machines
* Corporation and others. All Rights Reserved.
*
*******************************************************************************
relativepath = ".."U_FILE_SEP_STRING".."U_FILE_SEP_STRING"test"U_FILE_SEP_STRING"testdata"U_FILE_SEP_STRING;
#endif
- filename = (char*) malloc(strlen(srcdatapath)+strlen(relativepath)+strlen(txtFileName)+10 );
profile = usprep_open(testdatapath, binFileName, errorCode);
if(*errorCode == U_FILE_ACCESS_ERROR) {
log_err("Failed to load %s data file. Error: %s \n", binFileName, u_errorName(*errorCode));
return;
}
+ filename = (char*) malloc(strlen(srcdatapath)+strlen(relativepath)+strlen(txtFileName)+10 );
/* open and load the txt file */
strcpy(filename,srcdatapath);
strcat(filename,relativepath);
}
-static void TestPCEBuffer_100df() {
+static void TestPCEBuffer_100df(void) {
UChar search[] =
{ 0x0020, 0x0020, 0x00df, 0x0020, 0x0041, 0x00df, 0x0020, 0x0061, 0x00df, 0x0020, 0x00c5, 0x00df, 0x0020, 0x212b, 0x00df, 0x0020, 0x0041, 0x030a, 0x00df, 0x0020, 0x00e5, 0x00df, 0x0020, 0x0061, 0x02da, 0x00df, 0x0020, 0x0061, 0x030a, 0x00df, 0x0020, 0xd8fa, 0xdeae, 0x00df, 0x0020, 0x2027, 0x00df }; /* 38 cp, 9 of them unpaired surrogates */
UChar source[] =
}
-static void TestPCEBuffer_2surr() {
+static void TestPCEBuffer_2surr(void) {
UChar search[] =
{ 0x0020, 0x0020, 0xdfff, 0x0020, 0x0041, 0xdfff, 0x0020, 0x0061, 0xdfff, 0x0020, 0x00c5, 0xdfff, 0x0020, 0x212b, 0xdfff, 0x0020, 0x0041, 0x030a, 0xdfff, 0x0020, 0x00e5, 0xdfff, 0x0020, 0x0061, 0x02da, 0xdfff, 0x0020, 0x0061, 0x030a, 0xdfff, 0x0020, 0xd8fa, 0xdeae, 0xdfff, 0x0020, 0x2027, 0xdfff }; /* 38 cp, 9 of them unpaired surrogates */
UChar source[] =
logln( UnicodeString(" Cal1 = ") + cal1->getTime(status) );
logln( UnicodeString(" Cal1 time in ms = ") + cal1->get(UCAL_MILLISECOND,status) );
- for( int32_t k = 0; k < 100 ; k++ );
+ for (int32_t k = 0; k < 100 ; k++)
+ ;
GregorianCalendar *cal2 = new GregorianCalendar(1997, 10, 11, 10, 20, 40,status);
/*cal2.set( Calendar::YEAR, 1997 );
void CalendarTest::TestTimeStamp() {
UErrorCode status = U_ZERO_ERROR;
- UDate start, time;
+ UDate start = 0.0, time;
Calendar *cal;
// Create a new Gregorian Calendar.
/*
************************************************************************
-* Copyright (c) 2007-2008, International Business Machines
+* Copyright (c) 2007-2011, International Business Machines
* Corporation and others. All Rights Reserved.
************************************************************************
*/
u_UCharsToChars(u, ch, len);
ch[len] = 0; /* include terminating \0 */
it_errln(UnicodeString("Parse Failed: Field ") + UnicodeString(ch) + UnicodeString(", err ") + UnicodeString(u_errorName(status)));
+ delete[] kv;
+ delete[] dest;
return -1;
}
u_UCharsToChars(u, ch, len);
ch[len] = 0; /* include terminating \0 */
it_errln(UnicodeString("Parse Failed: Value ") + UnicodeString(ch) + UnicodeString(", err ") + UnicodeString(u_errorName(status)));
+ delete[] kv;
+ delete[] dest;
return -1;
}
<ClCompile>\r
<Optimization>Disabled</Optimization>\r
<AdditionalIncludeDirectories>..\..\..\include;..\..\common;..\..\i18n;..\..\tools\toolutil;..\..\tools\ctestfw;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>\r
- <PreprocessorDefinitions>WIN32;_DEBUG;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r
+ <PreprocessorDefinitions>U_ATTRIBUTE_DEPRECATED=;WIN32;_DEBUG;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>\r
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>\r
<BufferSecurityCheck>true</BufferSecurityCheck>\r
<ClCompile>\r
<Optimization>Disabled</Optimization>\r
<AdditionalIncludeDirectories>..\..\..\include;..\..\common;..\..\i18n;..\..\tools\toolutil;..\..\tools\ctestfw;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>\r
- <PreprocessorDefinitions>WIN64;WIN32;_DEBUG;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r
+ <PreprocessorDefinitions>U_ATTRIBUTE_DEPRECATED=;WIN64;WIN32;_DEBUG;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>\r
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>\r
<BufferSecurityCheck>true</BufferSecurityCheck>\r
</Midl>\r
<ClCompile>\r
<AdditionalIncludeDirectories>..\..\..\include;..\..\common;..\..\i18n;..\..\tools\toolutil;..\..\tools\ctestfw;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>\r
- <PreprocessorDefinitions>WIN32;NDEBUG;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r
+ <PreprocessorDefinitions>U_ATTRIBUTE_DEPRECATED=;WIN32;NDEBUG;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r
<StringPooling>true</StringPooling>\r
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>\r
<DisableLanguageExtensions>true</DisableLanguageExtensions>\r
</Midl>\r
<ClCompile>\r
<AdditionalIncludeDirectories>..\..\..\include;..\..\common;..\..\i18n;..\..\tools\toolutil;..\..\tools\ctestfw;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>\r
- <PreprocessorDefinitions>WIN64;WIN32;NDEBUG;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r
+ <PreprocessorDefinitions>U_ATTRIBUTE_DEPRECATED=;WIN64;WIN32;NDEBUG;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r
<StringPooling>true</StringPooling>\r
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>\r
<DisableLanguageExtensions>true</DisableLanguageExtensions>\r
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />\r
<ImportGroup Label="ExtensionTargets">\r
</ImportGroup>\r
-</Project>\r
+</Project>
\ No newline at end of file
df->setMaximumFractionDigits(i);
//sb = new StringBuffer("");
fp.setField(0);
- logln(" getMaximumFractionDigits() = " + i);
- logln(" formated: " + df->format(d, sb, fp));
+ logln(UnicodeString(" getMaximumFractionDigits() = ") + i);
+ logln(UnicodeString(" formated: ") + df->format(d, sb, fp));
}
/*} catch (Exception foo) {
errln("Bug 4090504 regression test failed. Message : " + foo.getMessage());
int minIntDig = sdf->getMinimumIntegerDigits();
if (minIntDig != 0) {
errln("Test failed");
- errln(" Minimum integer digits : " + minIntDig);
+ errln(UnicodeString(" Minimum integer digits : ") + minIntDig);
UnicodeString temp;
- errln(" new pattern: " + sdf->toPattern(temp));
+ errln(UnicodeString(" new pattern: ") + sdf->toPattern(temp));
} else {
logln("Test passed");
- logln(" Minimum integer digits : " + minIntDig);
+ logln(UnicodeString(" Minimum integer digits : ") + minIntDig);
}
}
delete sdf;
// ======= Test clone, assignment operator && == operator.
PluralRules *dupRule = defRule.clone();
- if (dupRule!=NULL) {
+ if (dupRule==NULL) {
+ errln("ERROR: clone plural rules test failed!");
+ delete test;
+ return;
+ } else {
if ( *dupRule != defRule ) {
errln("ERROR: clone plural rules test failed!");
}
ucnv_close(conv);
if (U_FAILURE(status)) {
errln("ucnv_toUChars: ICU Error \"%s\"\n", u_errorName(status));
- delete retPtr;
+ delete []retPtr;
retPtr = 0;
ulen = 0;
};
break;
}
}
- nativeIndex = UTEXT_GETNATIVEINDEX(utext);
+ nativeIndex = (int32_t)UTEXT_GETNATIVEINDEX(utext);
return couldFind;
}
ucnv_close(conv);
if (U_FAILURE(status)) {
errln("ucnv_toUChars: ICU Error \"%s\"\n", u_errorName(status));
- delete retPtr;
+ delete []retPtr;
retPtr = 0;
ulen = 0;
};
if (U_FAILURE(status)) {
errln("Error opening rule based collator %s", u_errorName(status));
delete strsrch;
- if (tailored != NULL) {
- delete tailored;
- }
+ delete tailored;
return;
}
if (U_FAILURE(status) || (*strsrch->getCollator()) != (*tailored)) {
errln("Error setting rule based collator");
delete strsrch;
- if (tailored != NULL) {
- delete tailored;
- }
+ delete tailored;
}
strsrch->reset();
if (!assertEqualWithStringSearch(strsrch, &COLLATOR[1])) {
delete strsrch;
- if (tailored != NULL) {
- delete tailored;
- }
+ delete tailored;
return;
}
if (U_FAILURE(status) || (*strsrch->getCollator()) != (*m_en_us_)) {
errln("Error setting rule based collator");
delete strsrch;
- if (tailored != NULL) {
- delete tailored;
- }
+ delete tailored;
}
if (!assertEqualWithStringSearch(strsrch, &COLLATOR[0])) {
errln("Error searching collator test");
}
delete strsrch;
- if (tailored != NULL) {
- delete tailored;
- }
+ delete tailored;
}
void StringSearchTest::TestPattern()
const Formattable fargs( d, Formattable::kIsDate );
MessageFormat* fmt1 = new MessageFormat( formatStr, status );
- MessageFormat* fmt2 = new MessageFormat( *fmt1 );
- MessageFormat* fmt3;
- MessageFormat* fmt4;
+ MessageFormat* fmt2 = NULL;
+ MessageFormat* fmt3 = NULL;
+ MessageFormat* fmt4 = NULL;
- if (fmt1 == NULL) it_err("testCopyConstructor2: (fmt1 != NULL)");
+ if (fmt1 == NULL) {
+ it_err("testCopyConstructor2: (fmt1 != NULL)");
+ goto cleanup;
+ }
+ fmt2 = new MessageFormat( *fmt1 );
result = fmt1->format( &fargs, 1, resultStr, fp, status );
- if (fmt2 == NULL) it_err("testCopyConstructor2: (fmt2 != NULL)");
+ if (fmt2 == NULL) {
+ it_err("testCopyConstructor2: (fmt2 != NULL)");
+ goto cleanup;
+ }
fmt3 = (MessageFormat*) fmt1->clone();
fmt4 = (MessageFormat*) fmt2->clone();
- if (fmt3 == NULL) it_err("testCopyConstructor2: (fmt3 != NULL)");
- if (fmt4 == NULL) it_err("testCopyConstructor2: (fmt4 != NULL)");
+ if (fmt3 == NULL) {
+ it_err("testCopyConstructor2: (fmt3 != NULL)");
+ goto cleanup;
+ }
+ if (fmt4 == NULL) {
+ it_err("testCopyConstructor2: (fmt4 != NULL)");
+ goto cleanup;
+ }
result = fmt1->format( &fargs, 1, resultStr, fp, status );
result = fmt2->format( &fargs, 1, resultStr, fp, status );
result = fmt3->format( &fargs, 1, resultStr, fp, status );
result = fmt4->format( &fargs, 1, resultStr, fp, status );
+
+cleanup:
delete fmt1;
delete fmt2;
delete fmt3;
/********************************************************************
* COPYRIGHT:
- * Copyright (c) 2005-2010, International Business Machines Corporation and
+ * Copyright (c) 2005-2011, International Business Machines Corporation and
* others. All Rights Reserved.
********************************************************************/
/************************************************************************
utext_setNativeIndex(ut, 0);
int32_t count = 0;
UChar32 c = 0;
- int32_t nativeIndex = UTEXT_GETNATIVEINDEX(ut);
+ int64_t nativeIndex = UTEXT_GETNATIVEINDEX(ut);
TEST_ASSERT(nativeIndex == 0);
while ((c = utext_next32(ut)) != U_SENTINEL) {
TEST_ASSERT(c == 0x41);
UFILE *myFile = u_fopen(STANDARD_TEST_FILE, "wb", "en_US_POSIX", enc);
FILE *myCFile;
int shift = 0;
- int i;
+ int32_t i;
if (myFile == NULL) {
log_err("Can't write test file %s\n", STANDARD_TEST_FILE);
}
/* check if shift in and out */
- for(i=0;i<inLen;i++) {
+ for(i=0;i<(int32_t)inLen;i++) {
if(inBuf[i]==0x0E) { /* SO */
shift= 1;
} else if(inBuf[i]==0x0F) { /* SI */
<ClCompile>\r
<Optimization>Disabled</Optimization>\r
<AdditionalIncludeDirectories>..\..\..\include;..\..\tools\ctestfw;..\..\common;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>\r
- <PreprocessorDefinitions>WIN32;_DEBUG;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r
+ <PreprocessorDefinitions>U_ATTRIBUTE_DEPRECATED=;WIN32;_DEBUG;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>\r
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>\r
<BufferSecurityCheck>true</BufferSecurityCheck>\r
</Midl>\r
<ClCompile>\r
<AdditionalIncludeDirectories>..\..\..\include;..\..\tools\ctestfw;..\..\common;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>\r
- <PreprocessorDefinitions>WIN32;NDEBUG;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r
+ <PreprocessorDefinitions>U_ATTRIBUTE_DEPRECATED=;WIN32;NDEBUG;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r
<StringPooling>true</StringPooling>\r
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>\r
<DisableLanguageExtensions>true</DisableLanguageExtensions>\r
<ClCompile>\r
<Optimization>Disabled</Optimization>\r
<AdditionalIncludeDirectories>..\..\..\include;..\..\tools\ctestfw;..\..\common;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>\r
- <PreprocessorDefinitions>WIN64;WIN32;_DEBUG;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r
+ <PreprocessorDefinitions>U_ATTRIBUTE_DEPRECATED=;WIN64;WIN32;_DEBUG;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>\r
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>\r
<BufferSecurityCheck>true</BufferSecurityCheck>\r
</Midl>\r
<ClCompile>\r
<AdditionalIncludeDirectories>..\..\..\include;..\..\tools\ctestfw;..\..\common;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>\r
- <PreprocessorDefinitions>WIN64;WIN32;NDEBUG;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r
+ <PreprocessorDefinitions>U_ATTRIBUTE_DEPRECATED=;WIN64;WIN32;NDEBUG;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r
<StringPooling>true</StringPooling>\r
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>\r
<DisableLanguageExtensions>true</DisableLanguageExtensions>\r
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />\r
<ImportGroup Label="ExtensionTargets">\r
</ImportGroup>\r
-</Project>
+</Project>
\ No newline at end of file
int bufLen = 10000;
UChar *buf = (UChar *)malloc(bufLen * sizeof(UChar));
+ UChar *tmp;
int i = 0;
for(;;) {
}
i++;
if (i >= bufLen) {
+ tmp = buf;
bufLen += 10000;
buf = (UChar *)realloc(buf, bufLen);
+ if (buf == NULL) {
+ free(tmp);
+ return 0;
+ }
}
}
buf[i] = 0;
/********************************************************************
* COPYRIGHT:
- * Copyright (C) 2001-2005 IBM, Inc. All Rights Reserved.
+ * Copyright (C) 2001-2011 IBM, Inc. All Rights Reserved.
*
********************************************************************/
/********************************************************************************
}
if (options[7].doesOccur) {
- char inputfilename[128];
+ char inputfilename[128] = "";
// rules are to be used
if (options[5].doesOccur) {
strcpy(inputfilename, options[5].value);
* Add by Richard
*/
int getScriptElementsFromExemplars(ScriptElement scriptelem[], const char* locale) {
- UErrorCode error = U_ZERO_ERROR;
- UChar32 codepoint = 0;
+ UErrorCode error = U_ZERO_ERROR;
+ UChar32 codepoint = 0;
- UResourceBundle* ures = ures_open(NULL, locale, &error);
- if (U_FAILURE(error)) {
- fprintf(stdout, "Can not find resource bundle for locale: %s\n", locale);
+ UResourceBundle* ures = ures_open(NULL, locale, &error);
+ if (U_FAILURE(error)) {
+ fprintf(stdout, "Can not find resource bundle for locale: %s\n", locale);
return -1;
- }
- int32_t length;
- const UChar* exemplarChars = ures_getStringByKey(ures, "ExemplarCharacters", &length, &error);
-
- if (U_FAILURE(error)) {
- fprintf(stdout, "Can not find ExemplarCharacters in resource bundle\n");
+ }
+ int32_t length;
+ const UChar* exemplarChars = ures_getStringByKey(ures, "ExemplarCharacters", &length, &error);
+
+ if (U_FAILURE(error)) {
+ fprintf(stdout, "Can not find ExemplarCharacters in resource bundle\n");
return -1;
- }
+ }
- UChar* upperChars = new UChar[length*2];
- if (upperChars == 0) {
- fprintf(stdout, "Memory error\n");
+ UChar* upperChars = new UChar[length * 2];
+ if (upperChars == 0) {
+ fprintf(stdout, "Memory error\n");
return -1;
- }
+ }
- int32_t destLength = u_strToUpper(upperChars, length*2, exemplarChars, -1, locale, &error);
- if (U_FAILURE(error)) {
- fprintf(stdout, "Error when u_strToUpper() \n");
+ int32_t destLength = u_strToUpper(upperChars, length * 2, exemplarChars, -1, locale, &error);
+ if (U_FAILURE(error)) {
+ fprintf(stdout, "Error when u_strToUpper() \n");
return -1;
- }
-
- UChar* pattern = new UChar[length + destLength + 10];
- UChar left[2] = {0x005b, 0x0};
- UChar right[2] = {0x005d, 0x0};
- pattern = u_strcpy(pattern, left);
- pattern = u_strcat(pattern, exemplarChars);
- pattern = u_strcat(pattern, upperChars);
- pattern = u_strcat(pattern, right);
-
- UnicodeSet * uniset = new UnicodeSet(UnicodeString(pattern), error);
- if (U_FAILURE(error)) {
- fprintf(stdout, "Can not open USet \n");
+ }
+
+ UChar* pattern = new UChar[length + destLength + 10];
+ UChar left[2] = {0x005b, 0x0};
+ UChar right[2] = {0x005d, 0x0};
+ pattern = u_strcpy(pattern, left);
+ pattern = u_strcat(pattern, exemplarChars);
+ pattern = u_strcat(pattern, upperChars);
+ pattern = u_strcat(pattern, right);
+
+ UnicodeSet * uniset = new UnicodeSet(UnicodeString(pattern), error);
+ if (U_FAILURE(error)) {
+ fprintf(stdout, "Can not open USet \n");
return -1;
- }
-
- UnicodeSetIterator* usetiter = new UnicodeSetIterator(*uniset);
-
- int32_t count = 0;
-
- while (usetiter -> next()) {
- if (usetiter -> isString()) {
- UnicodeString strItem = usetiter -> getString();
-
- scriptelem[count].count = 0;
- for (int i = 0; i < strItem.length(); i++) {
- codepoint = strItem.char32At(i);
- UTF16_APPEND_CHAR_UNSAFE(scriptelem[count].ch,
- scriptelem[count].count, codepoint);
- scriptelem[count].tailored = FALSE;
- }
- } else {
- codepoint = usetiter -> getCodepoint();
- scriptelem[count].count = 0;
- UTF16_APPEND_CHAR_UNSAFE(scriptelem[count].ch,
- scriptelem[count].count, codepoint);
- scriptelem[count].tailored = FALSE;
- }
-
- count++;
- }
-
- return count;
+ }
+
+ UnicodeSetIterator* usetiter = new UnicodeSetIterator(*uniset);
+
+ int32_t count = 0;
+
+ while (usetiter -> next()) {
+ if (usetiter -> isString()) {
+ UnicodeString strItem = usetiter -> getString();
+
+ scriptelem[count].count = 0;
+ for (int i = 0; i < strItem.length(); i++) {
+ codepoint = strItem.char32At(i);
+ UTF16_APPEND_CHAR_UNSAFE(scriptelem[count].ch, scriptelem[count].count, codepoint);
+ scriptelem[count].tailored = FALSE;
+ }
+ } else {
+ codepoint = usetiter -> getCodepoint();
+ scriptelem[count].count = 0;
+ UTF16_APPEND_CHAR_UNSAFE(scriptelem[count].ch, scriptelem[count].count, codepoint);
+ scriptelem[count].tailored = FALSE;
+ }
+
+ count++;
+ }
+ delete []pattern;
+
+ return count;
}
/**
if (U_FAILURE(error)) {
fprintf(stdout, "Collator creation failed:");
fprintf(stdout, u_errorName(error));
- return;
+ break;
}
if ((error != U_USING_FALLBACK_WARNING && // not tailored
error != U_USING_DEFAULT_WARNING) ||
if (U_FAILURE(error)) {
fprintf(stdout, "Collator attribute setting failed:");
fprintf(stdout, u_errorName(error));
- return;
+ break;
}
UScriptCode scriptcode[32];
&error);
if (U_FAILURE(error)) {
fprintf(stdout, "Error getting lcale scripts\n");
- return;
+ break;
}
strcat(filename, locale);
OUTPUT_ = fopen(filename, "w");
if (OUTPUT_ == NULL) {
fprintf(stdout, "Cannot open file:%s\n", filename);
- return;
+ break;
}
outputHTMLHeader(locale, scriptcode, scriptcount);
- fprintf(stdout, "%s\n", locale);
-
+ fprintf(stdout, "%s\n", locale);
+
if(options[12].doesOccur) {
// use whole scripts
- serializeScripts(scriptcode, scriptcount);
+ serializeScripts(scriptcode, scriptcount);
} else {
// use exemplar chars
serializeScripts(scriptcode, scriptcount, locale);
/*
**********************************************************************
-* Copyright (C) 2009-2010, International Business Machines
+* Copyright (C) 2009-2011, International Business Machines
* Corporation and others. All Rights Reserved.
**********************************************************************
*
fseek(file, 0, SEEK_SET);
result = new char[fileSize+10];
if (result==NULL) {
- return result;
+ fclose(file);
+ return NULL;
}
long t = fread(result, 1, fileSize, file);