ICU-8578 Apply patch to fix some compiler warnings and related issues

X-SVN-Rev: 30205
This commit is contained in:
Michael Ow 2011-06-10 18:56:08 +00:00
parent 8f86f7b5b7
commit 310c23c24e
45 changed files with 246 additions and 209 deletions

View file

@ -86,7 +86,7 @@
<TypeLibraryName>.\..\..\lib\icuuc.tlb</TypeLibraryName>
</Midl>
<ClCompile>
<PreprocessorDefinitions>WIN32;NDEBUG;_CRT_SECURE_NO_DEPRECATE;U_COMMON_IMPLEMENTATION;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>U_ATTRIBUTE_DEPRECATED=;WIN32;NDEBUG;_CRT_SECURE_NO_DEPRECATE;U_COMMON_IMPLEMENTATION;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<StringPooling>true</StringPooling>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<FunctionLevelLinking>true</FunctionLevelLinking>
@ -125,7 +125,7 @@
</Midl>
<ClCompile>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>WIN32;_DEBUG;_CRT_SECURE_NO_DEPRECATE;U_COMMON_IMPLEMENTATION;RBBI_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>U_ATTRIBUTE_DEPRECATED=;WIN32;_DEBUG;_CRT_SECURE_NO_DEPRECATE;U_COMMON_IMPLEMENTATION;RBBI_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<BufferSecurityCheck>true</BufferSecurityCheck>
@ -165,7 +165,7 @@
<TypeLibraryName>.\..\..\lib64\icuuc.tlb</TypeLibraryName>
</Midl>
<ClCompile>
<PreprocessorDefinitions>WIN64;WIN32;NDEBUG;_CRT_SECURE_NO_DEPRECATE;U_COMMON_IMPLEMENTATION;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>U_ATTRIBUTE_DEPRECATED=;WIN64;WIN32;NDEBUG;_CRT_SECURE_NO_DEPRECATE;U_COMMON_IMPLEMENTATION;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<StringPooling>true</StringPooling>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<FunctionLevelLinking>true</FunctionLevelLinking>
@ -202,7 +202,7 @@
</Midl>
<ClCompile>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>WIN64;WIN32;_DEBUG;_CRT_SECURE_NO_DEPRECATE;U_COMMON_IMPLEMENTATION;RBBI_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>U_ATTRIBUTE_DEPRECATED=;WIN64;WIN32;_DEBUG;_CRT_SECURE_NO_DEPRECATE;U_COMMON_IMPLEMENTATION;RBBI_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<BufferSecurityCheck>true</BufferSecurityCheck>
@ -1744,7 +1744,7 @@ copy "%(FullPath)" ..\..\include\unicode\%(FileName).h</Command>
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">copy "%(FullPath)" unicode\%(FileName).h
copy "%(FullPath)" ..\..\include\unicode\%(FileName).h</Command>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">unicode\%(Filename).h;..\..\include\unicode\%(Filename).h;%(Outputs)</Outputs>
<Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">copy "%(FullPath)" unicode\%(FileName).h
<Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">copy "%(FullPath)" unicode\%(FileName).h
copy "%(FullPath)" ..\..\include\unicode\%(FileName).h</Command>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">unicode\%(Filename).h;..\..\include\unicode\%(Filename).h;%(Outputs)</Outputs>
<Command Condition="'$(Configuration)|$(Platform)'=='Release|x64'">copy "%(FullPath)" unicode\%(FileName).h

View file

@ -809,6 +809,7 @@ uplug_init(UErrorCode *status) {
}
}
}
fclose(f);
} else {
#if UPLUG_TRACE
DBG((stderr, "Can't open plugin file %s\n", plugin_file));

View file

@ -535,7 +535,7 @@ uloc_getDisplayName(const char *locale,
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) {

View file

@ -957,7 +957,7 @@ uprv_convertToPosix(uint32_t hostid, UErrorCode* status)
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;

View file

@ -1464,6 +1464,7 @@ _appendKeywordsToLanguageTag(const char* localeID, char* appendAt, int32_t capac
ext = uprv_malloc(sizeof(ExtensionListEntry));
if (ext == NULL) {
*status = U_MEMORY_ALLOCATION_ERROR;
goto cleanup;
}
ext->key = POSIX_KEY;
ext->value = POSIX_VALUE;
@ -1531,6 +1532,7 @@ _appendKeywordsToLanguageTag(const char* localeID, char* appendAt, int32_t capac
}
} while (attr != NULL || ext != NULL);
}
cleanup:
/* clean up */
ext = firstExt;
while (ext != NULL) {
@ -2047,13 +2049,13 @@ ultag_parse(const char* tag, int32_t tagLen, int32_t* parsedLen, UErrorCode* sta
/* 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 */

View file

@ -111,6 +111,7 @@
# define U_CDECL_END
#endif
#ifndef U_ATTRIBUTE_DEPRECATED
/**
* \def U_ATTRIBUTE_DEPRECATED
* This is used for GCC specific attributes
@ -128,6 +129,8 @@
#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*/

View file

@ -115,6 +115,7 @@ private:
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);
@ -191,8 +192,8 @@ const UnicodeSet* UnicodeSet::getInclusions(int32_t src, UErrorCode &status) {
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);

View file

@ -1,6 +1,6 @@
/*
******************************************************************************
* Copyright (c) 1996-2010, International Business Machines
* Copyright (c) 1996-2011, International Business Machines
* Corporation and others. All Rights Reserved.
******************************************************************************
* File unorm.cpp
@ -126,13 +126,16 @@ unorm_iterate(UCharIterator *src, UBool forward,
} 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
) {
@ -227,13 +230,16 @@ unorm_concatenate(const UChar *left, int32_t leftLength,
} 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

View file

@ -1,7 +1,7 @@
/*
*******************************************************************************
*
* Copyright (C) 2001-2010, International Business Machines
* Copyright (C) 2001-2011, International Business Machines
* Corporation and others. All Rights Reserved.
*
*******************************************************************************
@ -591,6 +591,9 @@ unorm_compare(const UChar *s1, int32_t length1,
} else {
uni32=NULL; // unused
}
if(U_FAILURE(*pErrorCode)) {
return 0;
}
FilteredNormalizer2 fn2(*n2, *uni32);
if(normOptions&UNORM_UNICODE_3_2) {
n2=&fn2;

View file

@ -867,10 +867,11 @@ UVector *AlphabeticIndex::firstStringsInScript(UErrorCode &status) {
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 {

View file

@ -87,7 +87,7 @@
</Midl>
<ClCompile>
<AdditionalIncludeDirectories>..\..\include;..\common;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;NDEBUG;_CRT_SECURE_NO_DEPRECATE;U_I18N_IMPLEMENTATION;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>U_ATTRIBUTE_DEPRECATED=;WIN32;NDEBUG;_CRT_SECURE_NO_DEPRECATE;U_I18N_IMPLEMENTATION;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<StringPooling>true</StringPooling>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<FunctionLevelLinking>true</FunctionLevelLinking>
@ -129,7 +129,7 @@
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>..\..\include;..\common;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;_DEBUG;_CRT_SECURE_NO_DEPRECATE;U_I18N_IMPLEMENTATION;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>U_ATTRIBUTE_DEPRECATED=;WIN32;_DEBUG;_CRT_SECURE_NO_DEPRECATE;U_I18N_IMPLEMENTATION;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<BufferSecurityCheck>true</BufferSecurityCheck>
@ -172,7 +172,7 @@
</Midl>
<ClCompile>
<AdditionalIncludeDirectories>..\..\include;..\common;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN64;WIN32;NDEBUG;_CRT_SECURE_NO_DEPRECATE;U_I18N_IMPLEMENTATION;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>U_ATTRIBUTE_DEPRECATED=;WIN64;WIN32;NDEBUG;_CRT_SECURE_NO_DEPRECATE;U_I18N_IMPLEMENTATION;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<StringPooling>true</StringPooling>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<FunctionLevelLinking>true</FunctionLevelLinking>
@ -212,7 +212,7 @@
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>..\..\include;..\common;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN64;WIN32;_DEBUG;_CRT_SECURE_NO_DEPRECATE;U_I18N_IMPLEMENTATION;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>U_ATTRIBUTE_DEPRECATED=;WIN64;WIN32;_DEBUG;_CRT_SECURE_NO_DEPRECATE;U_I18N_IMPLEMENTATION;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<BufferSecurityCheck>true</BufferSecurityCheck>
@ -1524,4 +1524,4 @@
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>
</Project>

View file

@ -548,7 +548,7 @@ void MessageFormat::setArgStartFormat(int32_t argStart,
}
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) :

View file

@ -206,7 +206,7 @@ PluralRules::getKeywords(UErrorCode& status) const {
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;

View file

@ -991,7 +991,7 @@ private:
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);

View file

@ -484,7 +484,7 @@ public:
/**
* @internal
*/
class PluralSelector : public UMemory {
class U_I18N_API PluralSelector : public UMemory {
public:
/**
* Given a number, returns the appropriate PluralFormat keyword.

View file

@ -27,7 +27,7 @@ U_NAMESPACE_BEGIN
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;
}
@ -35,12 +35,12 @@ SpoofImpl::SpoofImpl(SpoofData *data, UErrorCode &status) :
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("");
}

View file

@ -2,7 +2,7 @@
#
# 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.
#
@ -124,7 +124,8 @@ UCLN_NO_AUTO_CLEANUP = @UCLN_NO_AUTO_CLEANUP@
# 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

View file

@ -1,6 +1,6 @@
/**************************************************************************
*
* Copyright (C) 2000-2010, International Business Machines
* Copyright (C) 2000-2011, International Business Machines
* Corporation and others. All Rights Reserved.
*
***************************************************************************
@ -397,7 +397,6 @@ UErrorCode convsample_06()
char inBuf[BUFFERSIZE];
const char *source;
const char *sourceLimit;
UChar *uBuf;
int32_t uBufSize = 0;
UConverter *conv;
UErrorCode status = U_ZERO_ERROR;
@ -438,8 +437,6 @@ UErrorCode convsample_06()
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)) &&
@ -473,6 +470,9 @@ UErrorCode convsample_06()
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++;

View file

@ -895,35 +895,35 @@ roundtripBOCU1(UConverter *bocu1, int32_t number, const UChar *text, int32_t len
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);

View file

@ -127,7 +127,7 @@ static void TestCalendar()
/*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:

View file

@ -594,8 +594,8 @@ static void TestConvert()
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() */
@ -885,7 +885,8 @@ static void TestConvert()
if (BOM!=0xFEFF && BOM!=0xFFFE)
{
log_err("File Missing BOM...Bailing!\n");
return;
fclose(ucs_file_in);
break;
}
@ -2478,11 +2479,13 @@ static const char *const badUTF8[]={
"\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;
@ -2507,7 +2510,7 @@ static UBool getTestChar(UConverter *cnv, const char *converterName,
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);
@ -2515,7 +2518,7 @@ static UBool getTestChar(UConverter *cnv, const char *converterName,
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);

View file

@ -84,7 +84,7 @@
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>..\..\..\include;..\..\tools\ctestfw;..\..\common;..\..\i18n;..\..\tools\toolutil;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;_DEBUG;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>U_ATTRIBUTE_DEPRECATED=;WIN32;_DEBUG;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
<BufferSecurityCheck>true</BufferSecurityCheck>
@ -122,7 +122,7 @@
</Midl>
<ClCompile>
<AdditionalIncludeDirectories>..\..\..\include;..\..\tools\ctestfw;..\..\common;..\..\i18n;..\..\tools\toolutil;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;NDEBUG;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>U_ATTRIBUTE_DEPRECATED=;WIN32;NDEBUG;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<StringPooling>true</StringPooling>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<BufferSecurityCheck>true</BufferSecurityCheck>
@ -160,7 +160,7 @@
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>..\..\..\include;..\..\tools\ctestfw;..\..\common;..\..\i18n;..\..\tools\toolutil;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN64;WIN32;_DEBUG;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>U_ATTRIBUTE_DEPRECATED=;WIN64;WIN32;_DEBUG;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
<BufferSecurityCheck>true</BufferSecurityCheck>
@ -197,7 +197,7 @@
</Midl>
<ClCompile>
<AdditionalIncludeDirectories>..\..\..\include;..\..\tools\ctestfw;..\..\common;..\..\i18n;..\..\tools\toolutil;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN64;WIN32;NDEBUG;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>U_ATTRIBUTE_DEPRECATED=;WIN64;WIN32;NDEBUG;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<StringPooling>true</StringPooling>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<BufferSecurityCheck>true</BufferSecurityCheck>
@ -376,4 +376,4 @@
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>
</Project>

View file

@ -561,28 +561,27 @@ static void TestSimpleResourceInfo() {
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;
@ -601,21 +600,19 @@ static int32_t UCharsToEscapedAscii(const UChar* utext, int32_t len, char* resul
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;
}
@ -637,7 +634,6 @@ static int32_t UCharsToEscapedAscii(const UChar* utext, int32_t len, char* resul
}
return resultLen;
#endif
}
/*
@ -747,7 +743,7 @@ static void TestDisplayNames()
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);

View file

@ -1671,7 +1671,7 @@ static void TestComposeDecompose(void) {
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);
@ -5920,7 +5920,7 @@ static void TestNonLeadBytesDuringCollationReordering(void)
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");
@ -6208,7 +6208,7 @@ static int compareUScriptCodes(const void * a, const void * b)
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;
@ -6282,7 +6282,7 @@ static void TestEquivalentReorderingScripts() {
}
}
static void TestReorderingAcrossCloning()
static void TestReorderingAcrossCloning(void)
{
UErrorCode status = U_ZERO_ERROR;
UCollator *myCollation;
@ -6348,7 +6348,7 @@ static void TestReorderingAcrossCloning()
*/
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;
@ -6477,7 +6477,7 @@ static void TestHaniReorder(void)
doTestOneReorderingAPITestCase(privateUseCharacterStrings, LEN(privateUseCharacterStrings), apiRules, LEN(apiRules));
}
static void TestMultipleReorder()
static void TestMultipleReorder(void)
{
const char* strRules[] = {
"[reorder Grek Zzzz DIGIT Latn Hani]"

View file

@ -5579,12 +5579,12 @@ TestIsFixedWidth() {
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);
}

View file

@ -1,6 +1,6 @@
/********************************************************************
* COPYRIGHT:
* Copyright (c) 1998-2010, International Business Machines Corporation and
* Copyright (c) 1998-2011, International Business Machines Corporation and
* others. All Rights Reserved.
********************************************************************/
/*
@ -185,7 +185,7 @@ static void TestPUtilAPI(void){
}
}
static void TestVersion()
static void TestVersion(void)
{
UVersionInfo versionArray = {0x01, 0x00, 0x02, 0x02};
UVersionInfo versionArray2 = {0x01, 0x00, 0x02, 0x02};
@ -288,7 +288,7 @@ static void TestVersion()
}
}
static void TestCompareVersions()
static void TestCompareVersions(void)
{
/* use a 1d array to be palatable to java */
const char *testCases[] = {

View file

@ -1757,7 +1757,7 @@ static void TestUTextAPI(void) {
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);

View file

@ -1,7 +1,7 @@
/*
*******************************************************************************
*
* Copyright (C) 2003-2008, International Business Machines
* Copyright (C) 2003-2011, International Business Machines
* Corporation and others. All Rights Reserved.
*
*******************************************************************************
@ -285,7 +285,6 @@ doStringPrepTest(const char* binFileName, const char* txtFileName, int32_t optio
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) {
@ -295,6 +294,7 @@ doStringPrepTest(const char* binFileName, const char* txtFileName, int32_t optio
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);

View file

@ -2893,7 +2893,7 @@ exit:
}
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[] =
@ -2904,7 +2904,7 @@ static void TestPCEBuffer_100df() {
}
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[] =

View file

@ -775,7 +775,8 @@ void CalendarRegressionTest::test4092362() {
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 );

View file

@ -2175,7 +2175,7 @@ void CalendarTest::Test1624() {
void CalendarTest::TestTimeStamp() {
UErrorCode status = U_ZERO_ERROR;
UDate start, time;
UDate start = 0.0, time;
Calendar *cal;
// Create a new Gregorian Calendar.

View file

@ -1,6 +1,6 @@
/*
************************************************************************
* Copyright (c) 2007-2008, International Business Machines
* Copyright (c) 2007-2011, International Business Machines
* Corporation and others. All Rights Reserved.
************************************************************************
*/
@ -119,6 +119,8 @@ int32_t FieldsSet::parseFrom(const UnicodeString& str, const
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;
}
@ -132,6 +134,8 @@ int32_t FieldsSet::parseFrom(const UnicodeString& str, const
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;
}

View file

@ -85,7 +85,7 @@
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>..\..\..\include;..\..\common;..\..\i18n;..\..\tools\toolutil;..\..\tools\ctestfw;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;_DEBUG;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>U_ATTRIBUTE_DEPRECATED=;WIN32;_DEBUG;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
<BufferSecurityCheck>true</BufferSecurityCheck>
@ -125,7 +125,7 @@
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>..\..\..\include;..\..\common;..\..\i18n;..\..\tools\toolutil;..\..\tools\ctestfw;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN64;WIN32;_DEBUG;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>U_ATTRIBUTE_DEPRECATED=;WIN64;WIN32;_DEBUG;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
<BufferSecurityCheck>true</BufferSecurityCheck>
@ -161,7 +161,7 @@
</Midl>
<ClCompile>
<AdditionalIncludeDirectories>..\..\..\include;..\..\common;..\..\i18n;..\..\tools\toolutil;..\..\tools\ctestfw;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;NDEBUG;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>U_ATTRIBUTE_DEPRECATED=;WIN32;NDEBUG;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<StringPooling>true</StringPooling>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<DisableLanguageExtensions>true</DisableLanguageExtensions>
@ -196,7 +196,7 @@
</Midl>
<ClCompile>
<AdditionalIncludeDirectories>..\..\..\include;..\..\common;..\..\i18n;..\..\tools\toolutil;..\..\tools\ctestfw;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN64;WIN32;NDEBUG;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>U_ATTRIBUTE_DEPRECATED=;WIN64;WIN32;NDEBUG;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<StringPooling>true</StringPooling>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<DisableLanguageExtensions>true</DisableLanguageExtensions>
@ -533,4 +533,4 @@
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>
</Project>

View file

@ -712,8 +712,8 @@ void NumberFormatRegressionTest::Test4090504 (void)
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());
@ -1994,12 +1994,12 @@ void NumberFormatRegressionTest::Test4147295(void)
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;

View file

@ -104,7 +104,11 @@ void PluralRulesTest::testAPI(/*char *par*/)
// ======= 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!");
}

View file

@ -2146,7 +2146,7 @@ cleanUpAndReturn:
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;
};

View file

@ -3173,7 +3173,7 @@ static UBool utextOffsetToNative(UText *utext, int32_t unistrOffset, int32_t& na
break;
}
}
nativeIndex = UTEXT_GETNATIVEINDEX(utext);
nativeIndex = (int32_t)UTEXT_GETNATIVEINDEX(utext);
return couldFind;
}
@ -3784,7 +3784,7 @@ cleanUpAndReturn:
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;
};

View file

@ -1074,9 +1074,7 @@ void StringSearchTest::TestCollator()
if (U_FAILURE(status)) {
errln("Error opening rule based collator %s", u_errorName(status));
delete strsrch;
if (tailored != NULL) {
delete tailored;
}
delete tailored;
return;
}
@ -1084,16 +1082,12 @@ void StringSearchTest::TestCollator()
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;
}
@ -1102,17 +1096,13 @@ void StringSearchTest::TestCollator()
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()

View file

@ -1410,26 +1410,41 @@ static void _testCopyConstructor2()
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;

View file

@ -1,6 +1,6 @@
/********************************************************************
* COPYRIGHT:
* Copyright (c) 2005-2010, International Business Machines Corporation and
* Copyright (c) 2005-2011, International Business Machines Corporation and
* others. All Rights Reserved.
********************************************************************/
/************************************************************************
@ -1910,7 +1910,7 @@ void UTextTest::Ticket6847() {
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);

View file

@ -920,7 +920,7 @@ static void TestCodepageFlush(void) {
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);
@ -946,7 +946,7 @@ static void TestCodepageFlush(void) {
}
/* 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 */

View file

@ -86,7 +86,7 @@
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>..\..\..\include;..\..\tools\ctestfw;..\..\common;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;_DEBUG;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>U_ATTRIBUTE_DEPRECATED=;WIN32;_DEBUG;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<BufferSecurityCheck>true</BufferSecurityCheck>
@ -124,7 +124,7 @@
</Midl>
<ClCompile>
<AdditionalIncludeDirectories>..\..\..\include;..\..\tools\ctestfw;..\..\common;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;NDEBUG;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>U_ATTRIBUTE_DEPRECATED=;WIN32;NDEBUG;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<StringPooling>true</StringPooling>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<DisableLanguageExtensions>true</DisableLanguageExtensions>
@ -162,7 +162,7 @@
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>..\..\..\include;..\..\tools\ctestfw;..\..\common;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN64;WIN32;_DEBUG;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>U_ATTRIBUTE_DEPRECATED=;WIN64;WIN32;_DEBUG;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<BufferSecurityCheck>true</BufferSecurityCheck>
@ -198,7 +198,7 @@
</Midl>
<ClCompile>
<AdditionalIncludeDirectories>..\..\..\include;..\..\tools\ctestfw;..\..\common;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN64;WIN32;NDEBUG;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>U_ATTRIBUTE_DEPRECATED=;WIN64;WIN32;NDEBUG;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<StringPooling>true</StringPooling>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<DisableLanguageExtensions>true</DisableLanguageExtensions>
@ -259,4 +259,4 @@
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>
</Project>

View file

@ -1377,6 +1377,7 @@ UCollator *openRulesCollator() {
int bufLen = 10000;
UChar *buf = (UChar *)malloc(bufLen * sizeof(UChar));
UChar *tmp;
int i = 0;
for(;;) {
@ -1389,8 +1390,13 @@ UCollator *openRulesCollator() {
}
i++;
if (i >= bufLen) {
tmp = buf;
bufLen += 10000;
buf = (UChar *)realloc(buf, bufLen);
if (buf == NULL) {
free(tmp);
return 0;
}
}
}
buf[i] = 0;

View file

@ -1,6 +1,6 @@
/********************************************************************
* COPYRIGHT:
* Copyright (C) 2001-2005 IBM, Inc. All Rights Reserved.
* Copyright (C) 2001-2011 IBM, Inc. All Rights Reserved.
*
********************************************************************/
/********************************************************************************
@ -572,7 +572,7 @@ CLOSETAILOR :
}
if (options[7].doesOccur) {
char inputfilename[128];
char inputfilename[128] = "";
// rules are to be used
if (options[5].doesOccur) {
strcpy(inputfilename, options[5].value);
@ -955,75 +955,74 @@ inline UBool checkInScripts(UScriptCode script[], int scriptcount,
* 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);
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");
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;
UnicodeSetIterator* usetiter = new UnicodeSetIterator(*uniset);
while (usetiter -> next()) {
if (usetiter -> isString()) {
UnicodeString strItem = usetiter -> getString();
int32_t count = 0;
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;
}
while (usetiter -> next()) {
if (usetiter -> isString()) {
UnicodeString strItem = usetiter -> getString();
count++;
}
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;
}
return count;
count++;
}
delete []pattern;
return count;
}
/**
@ -1483,7 +1482,7 @@ void serializeScripts() {
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) ||
@ -1493,7 +1492,7 @@ void serializeScripts() {
if (U_FAILURE(error)) {
fprintf(stdout, "Collator attribute setting failed:");
fprintf(stdout, u_errorName(error));
return;
break;
}
UScriptCode scriptcode[32];
@ -1501,7 +1500,7 @@ void serializeScripts() {
&error);
if (U_FAILURE(error)) {
fprintf(stdout, "Error getting lcale scripts\n");
return;
break;
}
strcat(filename, locale);
@ -1509,14 +1508,14 @@ void serializeScripts() {
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);

View file

@ -1,6 +1,6 @@
/*
**********************************************************************
* Copyright (C) 2009-2010, International Business Machines
* Copyright (C) 2009-2011, International Business Machines
* Corporation and others. All Rights Reserved.
**********************************************************************
*
@ -313,7 +313,8 @@ int main(int argc, char **argv) {
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);