ICU-9457 Fix some compiler warnings
X-SVN-Rev: 32095
This commit is contained in:
parent
0c47bc5948
commit
dc75668c05
1
.gitignore
vendored
1
.gitignore
vendored
@ -669,6 +669,7 @@ icu4c/source/tools/gencfu/Makefile
|
||||
icu4c/source/tools/gencfu/Release
|
||||
icu4c/source/tools/gencfu/debug
|
||||
icu4c/source/tools/gencfu/gencfu
|
||||
icu4c/source/tools/gencfu/gencfu.1
|
||||
icu4c/source/tools/gencfu/gencfu.exe
|
||||
icu4c/source/tools/gencfu/gencfu.vcproj.*.*.user
|
||||
icu4c/source/tools/gencfu/release
|
||||
|
@ -182,7 +182,7 @@ MessagePattern::init(UErrorCode &errorCode) {
|
||||
}
|
||||
|
||||
MessagePattern::MessagePattern(const MessagePattern &other)
|
||||
: aposMode(other.aposMode), msg(other.msg),
|
||||
: UObject(other), aposMode(other.aposMode), msg(other.msg),
|
||||
partsList(NULL), parts(NULL), partsLength(0),
|
||||
numericValuesList(NULL), numericValues(NULL), numericValuesLength(0),
|
||||
hasArgNames(other.hasArgNames), hasArgNumbers(other.hasArgNumbers),
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
********************************************************************
|
||||
* COPYRIGHT:
|
||||
* Copyright (c) 1996-2011, International Business Machines Corporation and
|
||||
* Copyright (c) 1996-2012, International Business Machines Corporation and
|
||||
* others. All Rights Reserved.
|
||||
********************************************************************
|
||||
*
|
||||
@ -1297,13 +1297,15 @@ ucnv_getDefaultName() {
|
||||
#endif
|
||||
}
|
||||
|
||||
#if U_CHARSET_IS_UTF8
|
||||
U_CAPI void U_EXPORT2 ucnv_setDefaultName(const char *) {}
|
||||
#else
|
||||
/*
|
||||
This function is not thread safe, and it can't be thread safe.
|
||||
See internalSetName or the API reference for details.
|
||||
*/
|
||||
U_CAPI void U_EXPORT2
|
||||
ucnv_setDefaultName(const char *converterName) {
|
||||
#if !U_CHARSET_IS_UTF8
|
||||
if(converterName==NULL) {
|
||||
/* reset to the default codepage */
|
||||
gDefaultConverterName=NULL;
|
||||
@ -1329,8 +1331,8 @@ ucnv_setDefaultName(const char *converterName) {
|
||||
/* reset the converter cache */
|
||||
u_flushDefaultConverter();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
/* data swapping ------------------------------------------------------------ */
|
||||
|
||||
|
@ -2682,7 +2682,6 @@ int32_t DecimalFormat::compareSimpleAffix(const UnicodeString& affix,
|
||||
const UnicodeString& input,
|
||||
int32_t pos,
|
||||
UBool lenient) {
|
||||
UErrorCode status = U_ZERO_ERROR;
|
||||
int32_t start = pos;
|
||||
UChar32 affixChar = affix.char32At(0);
|
||||
int32_t affixLength = affix.length();
|
||||
|
@ -1734,7 +1734,7 @@ Format* MessageFormat::DummyFormat::clone() const {
|
||||
return new DummyFormat();
|
||||
}
|
||||
|
||||
UnicodeString& MessageFormat::DummyFormat::format(const Formattable& obj,
|
||||
UnicodeString& MessageFormat::DummyFormat::format(const Formattable&,
|
||||
UnicodeString& appendTo,
|
||||
UErrorCode& status) const {
|
||||
if (U_SUCCESS(status)) {
|
||||
@ -1755,7 +1755,7 @@ UnicodeString& MessageFormat::DummyFormat::format(const Formattable&,
|
||||
|
||||
UnicodeString& MessageFormat::DummyFormat::format(const Formattable&,
|
||||
UnicodeString& appendTo,
|
||||
FieldPositionIterator* posIter,
|
||||
FieldPositionIterator*,
|
||||
UErrorCode& status) const {
|
||||
if (U_SUCCESS(status)) {
|
||||
status = U_UNSUPPORTED_ERROR;
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
******************************************************************************
|
||||
*
|
||||
* Copyright (C) 1998-2011, International Business Machines
|
||||
* Copyright (C) 1998-2012, International Business Machines
|
||||
* Corporation and others. All Rights Reserved.
|
||||
*
|
||||
******************************************************************************
|
||||
@ -499,7 +499,7 @@ u_printf_u(const UChar *patternSpecification,
|
||||
* @draft ICU 49
|
||||
*/
|
||||
U_DRAFT UFILE * U_EXPORT2
|
||||
u_get_stdout();
|
||||
u_get_stdout(void);
|
||||
|
||||
/**
|
||||
* Write formatted data to a UFILE.
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
**********************************************************************
|
||||
* Copyright (C) 1998-2011, International Business Machines
|
||||
* Copyright (C) 1998-2012, International Business Machines
|
||||
* Corporation and others. All Rights Reserved.
|
||||
**********************************************************************
|
||||
*
|
||||
@ -252,10 +252,10 @@ date(UDate when,
|
||||
|
||||
if( format != NULL ) {
|
||||
if(!strcmp(format,FORMAT_MILLIS)) {
|
||||
printf("%.0lf\n", when);
|
||||
printf("%.0f\n", when);
|
||||
return;
|
||||
} else if(!strcmp(format, FORMAT_SECONDS)) {
|
||||
printf("%.3lf\n", when/1000.0);
|
||||
printf("%.3f\n", when/1000.0);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
/********************************************************************
|
||||
* COPYRIGHT:
|
||||
* Copyright (c) 1997-2010, International Business Machines Corporation and
|
||||
* Copyright (c) 1997-2012, International Business Machines Corporation and
|
||||
* others. All Rights Reserved.
|
||||
********************************************************************/
|
||||
/*******************************************************************************
|
||||
@ -491,14 +491,14 @@ void
|
||||
backAndForth(UCollationElements *iter)
|
||||
{
|
||||
/* Run through the iterator forwards and stick it into an array */
|
||||
int32_t index, o;
|
||||
int32_t idx, o;
|
||||
UErrorCode status = U_ZERO_ERROR;
|
||||
int32_t orderLength = 0;
|
||||
OrderAndOffset *orders = getOrders(iter, &orderLength);
|
||||
|
||||
|
||||
/* Now go through it backwards and make sure we get the same values */
|
||||
index = orderLength;
|
||||
idx = orderLength;
|
||||
ucol_reset(iter);
|
||||
|
||||
/* synwee : changed */
|
||||
@ -508,39 +508,39 @@ backAndForth(UCollationElements *iter)
|
||||
#endif
|
||||
ucol_getOffset(iter);
|
||||
|
||||
index -= 1;
|
||||
if (o != orders[index].order) {
|
||||
idx -= 1;
|
||||
if (o != orders[idx].order) {
|
||||
if (o == 0)
|
||||
index ++;
|
||||
idx ++;
|
||||
else {
|
||||
while (index > 0 && orders[-- index].order == 0) {
|
||||
while (idx > 0 && orders[-- idx].order == 0) {
|
||||
/* nothing... */
|
||||
}
|
||||
|
||||
if (o != orders[index].order) {
|
||||
log_err("Mismatched order at index %d: 0x%8.8X vs. 0x%8.8X\n", index,
|
||||
orders[index].order, o);
|
||||
if (o != orders[idx].order) {
|
||||
log_err("Mismatched order at index %d: 0x%8.8X vs. 0x%8.8X\n", idx,
|
||||
orders[idx].order, o);
|
||||
goto bail;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#if TEST_OFFSETS
|
||||
if (offset != orders[index].offset) {
|
||||
log_err("Mismatched offset at index %d: %d vs. %d\n", index,
|
||||
orders[index].offset, offset);
|
||||
if (offset != orders[idx].offset) {
|
||||
log_err("Mismatched offset at index %d: %d vs. %d\n", idx,
|
||||
orders[idx].offset, offset);
|
||||
goto bail;
|
||||
}
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
while (index != 0 && orders[index - 1].order == 0) {
|
||||
index -= 1;
|
||||
while (idx != 0 && orders[idx - 1].order == 0) {
|
||||
idx -= 1;
|
||||
}
|
||||
|
||||
if (index != 0) {
|
||||
log_err("Didn't get back to beginning - index is %d\n", index);
|
||||
if (idx != 0) {
|
||||
log_err("Didn't get back to beginning - index is %d\n", idx);
|
||||
|
||||
ucol_reset(iter);
|
||||
log_err("\nnext: ");
|
||||
|
@ -614,7 +614,7 @@ void TestSafeClone() {
|
||||
UCollator * someClonedCollators [CLONETEST_COLLATOR_COUNT];
|
||||
UCollator * col;
|
||||
UErrorCode err = U_ZERO_ERROR;
|
||||
int8_t index = 6; /* Leave this here to test buffer alingment in memory*/
|
||||
int8_t idx = 6; /* Leave this here to test buffer alingment in memory*/
|
||||
uint8_t buffer [CLONETEST_COLLATOR_COUNT] [U_COL_SAFECLONE_BUFFERSIZE];
|
||||
int32_t bufferSize = U_COL_SAFECLONE_BUFFERSIZE;
|
||||
const char sampleRuleChars[] = "&Z < CH";
|
||||
@ -635,8 +635,8 @@ void TestSafeClone() {
|
||||
someCollators[2] = ucol_open("ja_JP", &err);
|
||||
someCollators[3] = ucol_openRules(sampleRule, -1, UCOL_ON, UCOL_TERTIARY, NULL, &err);
|
||||
if(U_FAILURE(err)) {
|
||||
for (index = 0; index < CLONETEST_COLLATOR_COUNT; index++) {
|
||||
ucol_close(someCollators[index]);
|
||||
for (idx = 0; idx < CLONETEST_COLLATOR_COUNT; idx++) {
|
||||
ucol_close(someCollators[idx]);
|
||||
}
|
||||
log_data_err("Couldn't open one or more collators\n");
|
||||
return;
|
||||
@ -724,45 +724,45 @@ void TestSafeClone() {
|
||||
|
||||
/* change orig & clone & make sure they are independent */
|
||||
|
||||
for (index = 0; index < CLONETEST_COLLATOR_COUNT; index++)
|
||||
for (idx = 0; idx < CLONETEST_COLLATOR_COUNT; idx++)
|
||||
{
|
||||
ucol_setStrength(someCollators[index], UCOL_IDENTICAL);
|
||||
ucol_setStrength(someCollators[idx], UCOL_IDENTICAL);
|
||||
bufferSize = 1;
|
||||
err = U_ZERO_ERROR;
|
||||
ucol_close(ucol_safeClone(someCollators[index], buffer[index], &bufferSize, &err));
|
||||
ucol_close(ucol_safeClone(someCollators[idx], buffer[idx], &bufferSize, &err));
|
||||
if (err != U_SAFECLONE_ALLOCATED_WARNING) {
|
||||
log_err("FAIL: collator number %d was not allocated.\n", index);
|
||||
log_err("FAIL: status of Collator[%d] is %d (hex: %x).\n", index, err, err);
|
||||
log_err("FAIL: collator number %d was not allocated.\n", idx);
|
||||
log_err("FAIL: status of Collator[%d] is %d (hex: %x).\n", idx, err, err);
|
||||
}
|
||||
|
||||
bufferSize = U_COL_SAFECLONE_BUFFERSIZE;
|
||||
err = U_ZERO_ERROR;
|
||||
someClonedCollators[index] = ucol_safeClone(someCollators[index], buffer[index], &bufferSize, &err);
|
||||
if (someClonedCollators[index] == NULL
|
||||
|| someClonedCollators[index] < (UCollator *)buffer[index]
|
||||
|| someClonedCollators[index] > (UCollator *)(buffer[index]+(U_COL_SAFECLONE_BUFFERSIZE-1)))
|
||||
someClonedCollators[idx] = ucol_safeClone(someCollators[idx], buffer[idx], &bufferSize, &err);
|
||||
if (someClonedCollators[idx] == NULL
|
||||
|| someClonedCollators[idx] < (UCollator *)buffer[idx]
|
||||
|| someClonedCollators[idx] > (UCollator *)(buffer[idx]+(U_COL_SAFECLONE_BUFFERSIZE-1)))
|
||||
{
|
||||
log_err("FAIL: Cloned collator didn't use provided buffer.\n");
|
||||
return;
|
||||
}
|
||||
if (!ucol_equals(someClonedCollators[index], someCollators[index])) {
|
||||
log_err("FAIL: Cloned collator is not equal to original at index = %d.\n", index);
|
||||
if (!ucol_equals(someClonedCollators[idx], someCollators[idx])) {
|
||||
log_err("FAIL: Cloned collator is not equal to original at index = %d.\n", idx);
|
||||
}
|
||||
|
||||
/* Check the usability */
|
||||
ucol_setStrength(someCollators[index], UCOL_PRIMARY);
|
||||
ucol_setAttribute(someCollators[index], UCOL_CASE_LEVEL, UCOL_OFF, &err);
|
||||
ucol_setStrength(someCollators[idx], UCOL_PRIMARY);
|
||||
ucol_setAttribute(someCollators[idx], UCOL_CASE_LEVEL, UCOL_OFF, &err);
|
||||
|
||||
doAssert( (ucol_equal(someCollators[index], test1, u_strlen(test1), test2, u_strlen(test2))), "Result should be \"abcda\" == \"abCda\"");
|
||||
doAssert( (ucol_equal(someCollators[idx], test1, u_strlen(test1), test2, u_strlen(test2))), "Result should be \"abcda\" == \"abCda\"");
|
||||
|
||||
/* Close the original to make sure that the clone is usable. */
|
||||
ucol_close(someCollators[index]);
|
||||
ucol_close(someCollators[idx]);
|
||||
|
||||
ucol_setStrength(someClonedCollators[index], UCOL_TERTIARY);
|
||||
ucol_setAttribute(someClonedCollators[index], UCOL_CASE_LEVEL, UCOL_OFF, &err);
|
||||
doAssert( (ucol_greater(someClonedCollators[index], test1, u_strlen(test1), test2, u_strlen(test2))), "Result should be \"abCda\" >>> \"abcda\" ");
|
||||
ucol_setStrength(someClonedCollators[idx], UCOL_TERTIARY);
|
||||
ucol_setAttribute(someClonedCollators[idx], UCOL_CASE_LEVEL, UCOL_OFF, &err);
|
||||
doAssert( (ucol_greater(someClonedCollators[idx], test1, u_strlen(test1), test2, u_strlen(test2))), "Result should be \"abCda\" >>> \"abcda\" ");
|
||||
|
||||
ucol_close(someClonedCollators[index]);
|
||||
ucol_close(someClonedCollators[idx]);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
/********************************************************************
|
||||
* COPYRIGHT:
|
||||
* Copyright (c) 1997-2011, International Business Machines Corporation and
|
||||
* Copyright (c) 1997-2012, International Business Machines Corporation and
|
||||
* others. All Rights Reserved.
|
||||
********************************************************************/
|
||||
/* file name: cbiditst.cpp
|
||||
@ -3593,7 +3593,7 @@ testReorderingMode(void) {
|
||||
int tc, mode, option, level;
|
||||
uint32_t optionValue, optionBack;
|
||||
UBiDiReorderingMode modeValue, modeBack;
|
||||
int32_t srcLen, destLen, index;
|
||||
int32_t srcLen, destLen, idx;
|
||||
const char *expectedChars;
|
||||
UBool testOK = TRUE;
|
||||
|
||||
@ -3651,13 +3651,13 @@ testReorderingMode(void) {
|
||||
}
|
||||
|
||||
if (modes[mode].value == UBIDI_REORDER_INVERSE_NUMBERS_AS_L) {
|
||||
index = -1;
|
||||
idx = -1;
|
||||
expectedChars = inverseBasic(pBiDi2, srcChars, srcLen,
|
||||
options[option].value, paraLevels[level], destChars);
|
||||
}
|
||||
else {
|
||||
index = outIndices[tc][mode][option][level];
|
||||
expectedChars = textOut[index];
|
||||
idx = outIndices[tc][mode][option][level];
|
||||
expectedChars = textOut[idx];
|
||||
}
|
||||
if (!assertStringsEqual(expectedChars, destChars, srcChars,
|
||||
modes[mode].description,
|
||||
@ -3666,7 +3666,7 @@ testReorderingMode(void) {
|
||||
testOK = FALSE;
|
||||
}
|
||||
if (options[option].value == UBIDI_OPTION_INSERT_MARKS &&
|
||||
!assertRoundTrip(pBiDi3, tc, index, srcChars,
|
||||
!assertRoundTrip(pBiDi3, tc, idx, srcChars,
|
||||
destChars, dest, destLen,
|
||||
mode, option, paraLevels[level])) {
|
||||
testOK = FALSE;
|
||||
@ -3677,7 +3677,7 @@ testReorderingMode(void) {
|
||||
paraLevels[level])) {
|
||||
testOK = FALSE;
|
||||
}
|
||||
else if (index > -1 && !checkMaps(pBiDi, index, srcChars,
|
||||
else if (idx > -1 && !checkMaps(pBiDi, idx, srcChars,
|
||||
destChars, modes[mode].description,
|
||||
options[option].description, paraLevels[level],
|
||||
TRUE)) {
|
||||
@ -3967,7 +3967,7 @@ checkMaps(UBiDi *pBiDi, int32_t stringIndex, const char *src, const char *dest,
|
||||
int32_t actualLogicalMap[MAX_MAP_LENGTH];
|
||||
int32_t actualVisualMap[MAX_MAP_LENGTH];
|
||||
int32_t getIndexMap[MAX_MAP_LENGTH];
|
||||
int32_t i, srcLen, resLen, index;
|
||||
int32_t i, srcLen, resLen, idx;
|
||||
const int32_t *expectedLogicalMap, *expectedVisualMap;
|
||||
UErrorCode rc = U_ZERO_ERROR;
|
||||
UBool testOK = TRUE;
|
||||
@ -4037,9 +4037,9 @@ checkMaps(UBiDi *pBiDi, int32_t stringIndex, const char *src, const char *dest,
|
||||
testOK = FALSE;
|
||||
}
|
||||
for (i = 0; i < srcLen; i++) {
|
||||
index = ubidi_getVisualIndex(pBiDi, i, &rc);
|
||||
idx = ubidi_getVisualIndex(pBiDi, i, &rc);
|
||||
assertSuccessful("ubidi_getVisualIndex", &rc);
|
||||
getIndexMap[i] = index;
|
||||
getIndexMap[i] = idx;
|
||||
}
|
||||
if (memcmp(actualLogicalMap, getIndexMap, srcLen * sizeof(int32_t))) {
|
||||
char actChars[MAX_MAP_LENGTH];
|
||||
@ -4066,9 +4066,9 @@ checkMaps(UBiDi *pBiDi, int32_t stringIndex, const char *src, const char *dest,
|
||||
testOK = FALSE;
|
||||
}
|
||||
for (i = 0; i < resLen; i++) {
|
||||
index = ubidi_getLogicalIndex(pBiDi, i, &rc);
|
||||
idx = ubidi_getLogicalIndex(pBiDi, i, &rc);
|
||||
assertSuccessful("ubidi_getLogicalIndex", &rc);
|
||||
getIndexMap[i] = index;
|
||||
getIndexMap[i] = idx;
|
||||
}
|
||||
if (memcmp(actualVisualMap, getIndexMap, resLen * sizeof(int32_t))) {
|
||||
char actChars[MAX_MAP_LENGTH];
|
||||
|
@ -1,6 +1,6 @@
|
||||
/********************************************************************
|
||||
* COPYRIGHT:
|
||||
* Copyright (c) 1997-2011, International Business Machines Corporation and
|
||||
* Copyright (c) 1997-2012, International Business Machines Corporation and
|
||||
* others. All Rights Reserved.
|
||||
********************************************************************/
|
||||
/*****************************************************************************
|
||||
@ -1700,7 +1700,7 @@ static void TestConvertSafeClone()
|
||||
UChar *pUCharTargetLimit = uniCharBuffer + sizeof(uniCharBuffer)/sizeof(*uniCharBuffer);
|
||||
const UChar * pUniBuffer;
|
||||
const UChar *uniBufferLimit = uniBuffer + sizeof(uniBuffer)/sizeof(*uniBuffer);
|
||||
int32_t index, j;
|
||||
int32_t idx, j;
|
||||
|
||||
err = U_ZERO_ERROR;
|
||||
cnv = ucnv_open(names[0], &err);
|
||||
@ -1787,22 +1787,22 @@ static void TestConvertSafeClone()
|
||||
/* Do these cloned converters work at all - shuffle UChars to chars & back again..*/
|
||||
|
||||
for(j = 0; j < LENGTHOF(bufferSizes); ++j) {
|
||||
for (index = 0; index < LENGTHOF(names); index++)
|
||||
for (idx = 0; idx < LENGTHOF(names); idx++)
|
||||
{
|
||||
err = U_ZERO_ERROR;
|
||||
cnv = ucnv_open(names[index], &err);
|
||||
cnv = ucnv_open(names[idx], &err);
|
||||
if(U_FAILURE(err)) {
|
||||
log_data_err("ucnv_open(\"%s\") failed - %s\n", names[index], u_errorName(err));
|
||||
log_data_err("ucnv_open(\"%s\") failed - %s\n", names[idx], u_errorName(err));
|
||||
continue;
|
||||
}
|
||||
|
||||
if(j == 0) {
|
||||
/* preflight to get maxBufferSize */
|
||||
actualSizes[index] = 0;
|
||||
ucnv_safeClone(cnv, NULL, &actualSizes[index], &err);
|
||||
if(actualSizes[index] > maxBufferSize) {
|
||||
maxBufferSize = actualSizes[index];
|
||||
maxName = names[index];
|
||||
actualSizes[idx] = 0;
|
||||
ucnv_safeClone(cnv, NULL, &actualSizes[idx], &err);
|
||||
if(actualSizes[idx] > maxBufferSize) {
|
||||
maxBufferSize = actualSizes[idx];
|
||||
maxName = names[idx];
|
||||
}
|
||||
}
|
||||
|
||||
@ -1814,10 +1814,10 @@ static void TestConvertSafeClone()
|
||||
/* close the original immediately to make sure that the clone works by itself */
|
||||
ucnv_close(cnv);
|
||||
|
||||
if( actualSizes[index] <= (bufferSizes[j] - (int32_t)sizeof(UAlignedMemory)) &&
|
||||
if( actualSizes[idx] <= (bufferSizes[j] - (int32_t)sizeof(UAlignedMemory)) &&
|
||||
err == U_SAFECLONE_ALLOCATED_WARNING
|
||||
) {
|
||||
log_err("ucnv_safeClone(%s) did a heap clone although the buffer was large enough\n", names[index]);
|
||||
log_err("ucnv_safeClone(%s) did a heap clone although the buffer was large enough\n", names[idx]);
|
||||
}
|
||||
|
||||
/* check if the clone function overwrote any bytes that it is not supposed to touch */
|
||||
@ -1827,13 +1827,13 @@ static void TestConvertSafeClone()
|
||||
containsAnyOtherByte(buffer[1]+bufferSize, (int32_t)(sizeof(buffer)-(sizeof(buffer[0])+bufferSize)), 0xaa)
|
||||
) {
|
||||
log_err("cloning %s in a stack buffer overwrote bytes outside the bufferSize %d (requested %d)\n",
|
||||
names[index], bufferSize, bufferSizes[j]);
|
||||
names[idx], bufferSize, bufferSizes[j]);
|
||||
}
|
||||
} else {
|
||||
/* heap-allocated the clone */
|
||||
if(containsAnyOtherByte(buffer[0], (int32_t)sizeof(buffer), 0xaa)) {
|
||||
log_err("cloning %s used the heap (bufferSize %d, requested %d) but overwrote stack buffer bytes\n",
|
||||
names[index], bufferSize, bufferSizes[j]);
|
||||
names[idx], bufferSize, bufferSizes[j]);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -6494,9 +6494,9 @@ static void TestHaniReorderWithOtherRules(void)
|
||||
const char* strRules[] = {
|
||||
"[reorder Hani] &b<a"
|
||||
};
|
||||
const int32_t apiRules[] = {
|
||||
/*const int32_t apiRules[] = {
|
||||
USCRIPT_HAN
|
||||
};
|
||||
};*/
|
||||
|
||||
const static OneTestCase privateUseCharacterStrings[] = {
|
||||
{ {0x4e00}, {0x0041}, UCOL_LESS },
|
||||
@ -6559,7 +6559,6 @@ static void TestReorderWithNumericCollation()
|
||||
int32_t fortyThreeP_sortKey_reorder_Length;
|
||||
UCollationResult collResult;
|
||||
UCollationResult collResultReorder;
|
||||
int i;
|
||||
|
||||
log_verbose("Testing reordering with and without numeric collation\n");
|
||||
|
||||
|
@ -1598,7 +1598,7 @@ static UBool testTag(const char* frag,
|
||||
int32_t count = 0;
|
||||
int32_t row_count=0;
|
||||
int32_t column_count=0;
|
||||
int32_t index = 0;
|
||||
int32_t idx = 0;
|
||||
int32_t tag_count= 0;
|
||||
const char* testdatapath;
|
||||
char verboseOutput[256];
|
||||
@ -1774,25 +1774,25 @@ static UBool testTag(const char* frag,
|
||||
|
||||
|
||||
for (j=0; j<10; ++j){
|
||||
index = count ? (randi(count * 3) - count) : (randi(200) - 100);
|
||||
idx = count ? (randi(count * 3) - count) : (randi(200) - 100);
|
||||
status = U_ZERO_ERROR;
|
||||
string=kERROR;
|
||||
array=ures_getByKey(theBundle, tag, array, &status);
|
||||
if(!U_FAILURE(status)){
|
||||
UChar *t=NULL;
|
||||
t=(UChar*)ures_getStringByIndex(array, index, &len, &status);
|
||||
t=(UChar*)ures_getStringByIndex(array, idx, &len, &status);
|
||||
if(!U_FAILURE(status)){
|
||||
UChar element[3];
|
||||
string=t;
|
||||
u_strcpy(expected_string, base);
|
||||
u_uastrcpy(element, itoa1(index,buf));
|
||||
u_uastrcpy(element, itoa1(idx,buf));
|
||||
u_strcat(expected_string, element);
|
||||
} else {
|
||||
u_strcpy(expected_string, kERROR);
|
||||
}
|
||||
|
||||
}
|
||||
expected_status = (index >= 0 && index < count) ? expected_resource_status : U_MISSING_RESOURCE_ERROR;
|
||||
expected_status = (idx >= 0 && idx < count) ? expected_resource_status : U_MISSING_RESOURCE_ERROR;
|
||||
CONFIRM_ErrorCode(status,expected_status);
|
||||
CONFIRM_EQ(string,expected_string);
|
||||
|
||||
@ -1918,11 +1918,11 @@ static UBool testTag(const char* frag,
|
||||
tag_count=ures_getSize(tags);
|
||||
CONFIRM_INT_GE((int32_t)tag_count, (int32_t)0);
|
||||
|
||||
for(index=0; index <tag_count; index++){
|
||||
for(idx=0; idx <tag_count; idx++){
|
||||
UResourceBundle *tagelement=NULL;
|
||||
const char *key=NULL;
|
||||
UChar* value=NULL;
|
||||
tagelement=ures_getByIndex(tags, index, tagelement, &status);
|
||||
tagelement=ures_getByIndex(tags, idx, tagelement, &status);
|
||||
key=ures_getKey(tagelement);
|
||||
value=(UChar*)ures_getNextString(tagelement, &len, &key, &status);
|
||||
log_verbose("tag = %s, value = %s\n", key, u_austrcpy(verboseOutput, value));
|
||||
@ -1939,13 +1939,13 @@ static UBool testTag(const char* frag,
|
||||
|
||||
/*---------taggedArrayItem----------------------------------------------*/
|
||||
count = 0;
|
||||
for (index=-20; index<20; ++index)
|
||||
for (idx=-20; idx<20; ++idx)
|
||||
{
|
||||
|
||||
status = U_ZERO_ERROR;
|
||||
string = kERROR;
|
||||
strcpy(item_tag, "tag");
|
||||
strcat(item_tag, itoa1(index,buf));
|
||||
strcat(item_tag, itoa1(idx,buf));
|
||||
tags=ures_getByKey(theBundle, tag, tags, &status);
|
||||
if(U_SUCCESS(status)){
|
||||
UResourceBundle *tagelement=NULL;
|
||||
@ -1964,14 +1964,14 @@ static UBool testTag(const char* frag,
|
||||
string=t;
|
||||
}
|
||||
}
|
||||
if (index < 0) {
|
||||
if (idx < 0) {
|
||||
CONFIRM_ErrorCode(status,U_MISSING_RESOURCE_ERROR);
|
||||
}
|
||||
else{
|
||||
if (status != U_MISSING_RESOURCE_ERROR) {
|
||||
UChar element[3];
|
||||
u_strcpy(expected_string, base);
|
||||
u_uastrcpy(element, itoa1(index,buf));
|
||||
u_uastrcpy(element, itoa1(idx,buf));
|
||||
u_strcat(expected_string, element);
|
||||
CONFIRM_EQ(string,expected_string);
|
||||
count++;
|
||||
@ -2802,7 +2802,7 @@ static void TestStackReuse(void) {
|
||||
*/
|
||||
extern const UChar *
|
||||
tres_getString(const UResourceBundle *resB,
|
||||
int32_t index, const char *key,
|
||||
int32_t idx, const char *key,
|
||||
int32_t *length,
|
||||
UErrorCode *status) {
|
||||
char buffer8[16];
|
||||
@ -2816,8 +2816,8 @@ tres_getString(const UResourceBundle *resB,
|
||||
if(length == NULL) {
|
||||
length = &length16;
|
||||
}
|
||||
if(index >= 0) {
|
||||
s16 = ures_getStringByIndex(resB, index, length, status);
|
||||
if(idx >= 0) {
|
||||
s16 = ures_getStringByIndex(resB, idx, length, status);
|
||||
} else if(key != NULL) {
|
||||
s16 = ures_getStringByKey(resB, key, length, status);
|
||||
} else {
|
||||
@ -2832,8 +2832,8 @@ tres_getString(const UResourceBundle *resB,
|
||||
for(forceCopy = FALSE; forceCopy <= TRUE; ++forceCopy) {
|
||||
p8 = buffer8;
|
||||
length8 = (int32_t)sizeof(buffer8);
|
||||
if(index >= 0) {
|
||||
s8 = ures_getUTF8StringByIndex(resB, index, p8, &length8, forceCopy, status);
|
||||
if(idx >= 0) {
|
||||
s8 = ures_getUTF8StringByIndex(resB, idx, p8, &length8, forceCopy, status);
|
||||
} else if(key != NULL) {
|
||||
s8 = ures_getUTF8StringByKey(resB, key, p8, &length8, forceCopy, status);
|
||||
} else {
|
||||
@ -2849,8 +2849,8 @@ tres_getString(const UResourceBundle *resB,
|
||||
if(p8 == NULL) {
|
||||
return s16;
|
||||
}
|
||||
if(index >= 0) {
|
||||
s8 = ures_getUTF8StringByIndex(resB, index, p8, &length8, forceCopy, status);
|
||||
if(idx >= 0) {
|
||||
s8 = ures_getUTF8StringByIndex(resB, idx, p8, &length8, forceCopy, status);
|
||||
} else if(key != NULL) {
|
||||
s8 = ures_getUTF8StringByKey(resB, key, p8, &length8, forceCopy, status);
|
||||
} else {
|
||||
@ -2867,13 +2867,13 @@ tres_getString(const UResourceBundle *resB,
|
||||
|
||||
if(forceCopy && s8 != p8) {
|
||||
log_err("ures_getUTF8String(%p, %ld, '%s') did not write the string to dest\n",
|
||||
resB, (long)index, key);
|
||||
resB, (long)idx, key);
|
||||
}
|
||||
|
||||
/* verify NUL-termination */
|
||||
if((p8 != buffer8 || length8 < sizeof(buffer8)) && s8[length8] != 0) {
|
||||
log_err("ures_getUTF8String(%p, %ld, '%s') did not NUL-terminate\n",
|
||||
resB, (long)index, key);
|
||||
resB, (long)idx, key);
|
||||
}
|
||||
/* verify correct string */
|
||||
i16 = i8 = 0;
|
||||
@ -2882,17 +2882,17 @@ tres_getString(const UResourceBundle *resB,
|
||||
U8_NEXT(s8, i8, length8, c8);
|
||||
if(c16 != c8) {
|
||||
log_err("ures_getUTF8String(%p, %ld, '%s') got a bad string, c16=U+%04lx!=U+%04lx=c8 before i16=%ld\n",
|
||||
resB, (long)index, key, (long)c16, (long)c8, (long)i16);
|
||||
resB, (long)idx, key, (long)c16, (long)c8, (long)i16);
|
||||
}
|
||||
}
|
||||
/* verify correct length */
|
||||
if(i16 < length16) {
|
||||
log_err("ures_getUTF8String(%p, %ld, '%s') UTF-8 string too short, length8=%ld, length16=%ld\n",
|
||||
resB, (long)index, key, (long)length8, (long)length16);
|
||||
resB, (long)idx, key, (long)length8, (long)length16);
|
||||
}
|
||||
if(i8 < length8) {
|
||||
log_err("ures_getUTF8String(%p, %ld, '%s') UTF-8 string too long, length8=%ld, length16=%ld\n",
|
||||
resB, (long)index, key, (long)length8, (long)length16);
|
||||
resB, (long)idx, key, (long)length8, (long)length16);
|
||||
}
|
||||
|
||||
/* clean up */
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
*******************************************************************************
|
||||
*
|
||||
* Copyright (C) 2003-2011, International Business Machines
|
||||
* Copyright (C) 2003-2012, International Business Machines
|
||||
* Corporation and others. All Rights Reserved.
|
||||
*
|
||||
*******************************************************************************
|
||||
@ -150,7 +150,7 @@ compareMapping(UStringPrepProfile* data, uint32_t codepoint, uint32_t* mapping,i
|
||||
int32_t length=0;
|
||||
UBool isIndex = FALSE;
|
||||
UStringPrepType retType;
|
||||
int32_t value=0, index=0, delta=0;
|
||||
int32_t value=0, idx=0, delta=0;
|
||||
int32_t* indexes = data->indexes;
|
||||
UTrie trie = data->sprepTrie;
|
||||
const uint16_t* mappingData = data->mappingData;
|
||||
@ -169,18 +169,18 @@ compareMapping(UStringPrepProfile* data, uint32_t codepoint, uint32_t* mapping,i
|
||||
}
|
||||
|
||||
if(isIndex){
|
||||
index = value;
|
||||
if(index >= indexes[_SPREP_ONE_UCHAR_MAPPING_INDEX_START] &&
|
||||
index < indexes[_SPREP_TWO_UCHARS_MAPPING_INDEX_START]){
|
||||
idx = value;
|
||||
if(idx >= indexes[_SPREP_ONE_UCHAR_MAPPING_INDEX_START] &&
|
||||
idx < indexes[_SPREP_TWO_UCHARS_MAPPING_INDEX_START]){
|
||||
length = 1;
|
||||
}else if(index >= indexes[_SPREP_TWO_UCHARS_MAPPING_INDEX_START] &&
|
||||
index < indexes[_SPREP_THREE_UCHARS_MAPPING_INDEX_START]){
|
||||
}else if(idx >= indexes[_SPREP_TWO_UCHARS_MAPPING_INDEX_START] &&
|
||||
idx < indexes[_SPREP_THREE_UCHARS_MAPPING_INDEX_START]){
|
||||
length = 2;
|
||||
}else if(index >= indexes[_SPREP_THREE_UCHARS_MAPPING_INDEX_START] &&
|
||||
index < indexes[_SPREP_FOUR_UCHARS_MAPPING_INDEX_START]){
|
||||
}else if(idx >= indexes[_SPREP_THREE_UCHARS_MAPPING_INDEX_START] &&
|
||||
idx < indexes[_SPREP_FOUR_UCHARS_MAPPING_INDEX_START]){
|
||||
length = 3;
|
||||
}else{
|
||||
length = mappingData[index++];
|
||||
length = mappingData[idx++];
|
||||
}
|
||||
}else{
|
||||
delta = value;
|
||||
@ -203,15 +203,15 @@ compareMapping(UStringPrepProfile* data, uint32_t codepoint, uint32_t* mapping,i
|
||||
if(isIndex){
|
||||
for(i =0; i< mapLength; i++){
|
||||
if(mapping[i] <= 0xFFFF){
|
||||
if(mappingData[index+i] != (uint16_t)mapping[i]){
|
||||
log_err("Did not get the expected result. Expected: 0x%04X Got: 0x%04X \n", mapping[i], mappingData[index+i]);
|
||||
if(mappingData[idx+i] != (uint16_t)mapping[i]){
|
||||
log_err("Did not get the expected result. Expected: 0x%04X Got: 0x%04X \n", mapping[i], mappingData[idx+i]);
|
||||
}
|
||||
}else{
|
||||
UChar lead = U16_LEAD(mapping[i]);
|
||||
UChar trail = U16_TRAIL(mapping[i]);
|
||||
if(mappingData[index+i] != lead ||
|
||||
mappingData[index+i+1] != trail){
|
||||
log_err( "Did not get the expected result. Expected: 0x%04X 0x%04X Got: 0x%04X 0x%04X\n", lead, trail, mappingData[index+i], mappingData[index+i+1]);
|
||||
if(mappingData[idx+i] != lead ||
|
||||
mappingData[idx+i+1] != trail){
|
||||
log_err( "Did not get the expected result. Expected: 0x%04X 0x%04X Got: 0x%04X 0x%04X\n", lead, trail, mappingData[idx+i], mappingData[idx+i+1]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -836,8 +836,6 @@ TimeZoneTest::checkContainsAll(StringEnumeration *s1, const char *name1,
|
||||
*/
|
||||
void TimeZoneTest::TestShortZoneIDs()
|
||||
{
|
||||
UErrorCode status = U_ZERO_ERROR;
|
||||
|
||||
int32_t i;
|
||||
// Create a small struct to hold the array
|
||||
struct
|
||||
|
@ -31,6 +31,7 @@
|
||||
#include "uparse.h"
|
||||
#include "sprpimpl.h"
|
||||
|
||||
#include "unicode/uclean.h"
|
||||
#include "unicode/udata.h"
|
||||
#include "unicode/utypes.h"
|
||||
#include "unicode/putil.h"
|
||||
|
@ -120,7 +120,7 @@ void cmd_version(UBool /* noLoad */, UErrorCode &errorCode)
|
||||
void cmd_cleanup()
|
||||
{
|
||||
u_cleanup();
|
||||
fprintf(stderr,"ICU u_cleanup() called.\n");
|
||||
fprintf(stdout, "ICU u_cleanup() called.\n");
|
||||
}
|
||||
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/******************************************************************************
|
||||
* Copyright (C) 2009-2011, International Business Machines
|
||||
* Copyright (C) 2009-2012, International Business Machines
|
||||
* Corporation and others. All Rights Reserved.
|
||||
*******************************************************************************
|
||||
*/
|
||||
@ -24,7 +24,7 @@ parseFlagsFile(const char *fileName, char **flagBuffer, int32_t flagBufferSize,
|
||||
char* buffer = uprv_malloc(sizeof(char) * currentBufferSize);
|
||||
char* tmpFlagBuffer = uprv_malloc(sizeof(char) * flagBufferSize);
|
||||
UBool allocateMoreSpace = FALSE;
|
||||
int32_t index, i;
|
||||
int32_t idx, i;
|
||||
int32_t result = 0;
|
||||
|
||||
FileStream *f = T_FileStream_open(fileName, "r");
|
||||
@ -65,7 +65,7 @@ parseFlagsFile(const char *fileName, char **flagBuffer, int32_t flagBufferSize,
|
||||
T_FileStream_rewind(f);
|
||||
break;
|
||||
} else {
|
||||
index = extractFlag(buffer, currentBufferSize, tmpFlagBuffer, flagBufferSize, flagNames, numOfFlags, status);
|
||||
idx = extractFlag(buffer, currentBufferSize, tmpFlagBuffer, flagBufferSize, flagNames, numOfFlags, status);
|
||||
if (U_FAILURE(*status)) {
|
||||
if (*status == U_BUFFER_OVERFLOW_ERROR) {
|
||||
result = currentBufferSize;
|
||||
@ -75,8 +75,8 @@ parseFlagsFile(const char *fileName, char **flagBuffer, int32_t flagBufferSize,
|
||||
break;
|
||||
} else {
|
||||
if (flagNames != NULL) {
|
||||
if (index >= 0) {
|
||||
uprv_strcpy(flagBuffer[index], tmpFlagBuffer);
|
||||
if (idx >= 0) {
|
||||
uprv_strcpy(flagBuffer[idx], tmpFlagBuffer);
|
||||
} else {
|
||||
/* No match found. Skip it. */
|
||||
continue;
|
||||
@ -106,7 +106,7 @@ parseFlagsFile(const char *fileName, char **flagBuffer, int32_t flagBufferSize,
|
||||
* Extract the setting after the '=' and store it in flag excluding the newline character.
|
||||
*/
|
||||
static int32_t extractFlag(char* buffer, int32_t bufferSize, char* flag, int32_t flagSize, const char **flagNames, int32_t numOfFlags, UErrorCode *status) {
|
||||
int32_t i, index = -1;
|
||||
int32_t i, idx = -1;
|
||||
char *pBuffer;
|
||||
int32_t offset=0;
|
||||
UBool bufferWritten = FALSE;
|
||||
@ -141,13 +141,13 @@ static int32_t extractFlag(char* buffer, int32_t bufferSize, char* flag, int32_t
|
||||
offset--; /* Move offset back 1 because of '='*/
|
||||
for (i = 0; i < numOfFlags; i++) {
|
||||
if (uprv_strncmp(buffer, flagNames[i], offset) == 0) {
|
||||
index = i;
|
||||
idx = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return index;
|
||||
return idx;
|
||||
}
|
||||
|
||||
/*
|
||||
|
Loading…
Reference in New Issue
Block a user