ICU-20672 Compiler Warning Cleanup.

This commit is contained in:
Andy Heninger 2019-06-20 11:51:27 -07:00
parent 5a23d83fa2
commit 6f0627b5d8
9 changed files with 16 additions and 7 deletions

View file

@ -280,7 +280,7 @@ UChar32 getRange(const void *t, UChar32 start,
int32_t prevI3Block = -1;
int32_t prevBlock = -1;
UChar32 c = start;
uint32_t trieValue, value;
uint32_t trieValue, value = nullValue;
bool haveValue = false;
do {
int32_t i3Block;

View file

@ -478,8 +478,8 @@ UnicodeString& ListFormatter::format_(
if (index == 0) {
offset = 0;
}
int32_t offsetFirst;
int32_t offsetSecond;
int32_t offsetFirst = 0;
int32_t offsetSecond = 0;
int32_t prefixLength = 0;
// for n items, there are 2 * (n + 1) boundary including 0 and the upper
// edge.

View file

@ -40,7 +40,7 @@ void TestGetTZTransition(void);
void TestGetWindowsTimeZoneID(void);
void TestGetTimeZoneIDByWindowsID(void);
void TestJpnCalAddSetNextEra();
void TestJpnCalAddSetNextEra(void);
void addCalTest(TestNode** root);

View file

@ -1783,6 +1783,7 @@ static void TestKeywordVariants(void)
status = U_ZERO_ERROR;
resultLen = uloc_getName(testCases[i].localeID, buffer, 256, &status);
(void)resultLen;
U_ASSERT(resultLen < 256);
if (U_SUCCESS(status)) {
if (testCases[i].expectedLocaleID == 0) {

View file

@ -1836,6 +1836,7 @@ static void TestRBNFRounding() {
}
len = unum_formatDouble(fmt, 10.123456789, fmtbuf, FORMAT_BUF_CAPACITY, NULL, &status);
U_ASSERT(len < FORMAT_BUF_CAPACITY);
(void)len;
if (U_FAILURE(status)) {
log_err_status(status, "unum_formatDouble 10.123456789 failed with %s\n", u_errorName(status));
}
@ -3235,6 +3236,7 @@ static void TestParseCases(void) {
status = U_ZERO_ERROR;
decstr[0] = 0;
dclen = unum_parseDecimal(unumDec, itemPtr->text, -1, &parsePos, decstr, 32, &status);
(void)dclen;
if (status != itemPtr->decStatus || parsePos != itemPtr->decPos || uprv_strcmp(decstr,itemPtr->decString) != 0) {
char btext[32];
u_austrcpy(btext, itemPtr->text);
@ -3366,6 +3368,7 @@ static void TestSetMaxFracAndRoundIncr(void) {
status = U_ZERO_ERROR;
ulen = unum_toPattern(unf, FALSE, ubuf, kUBufMax, &status);
(void)ulen;
if ( U_FAILURE(status) ) {
log_err("test %s: unum_toPattern fails with %s\n", itemPtr->descrip, u_errorName(status));
} else if (u_strcmp(ubuf,itemPtr->expPattern)!=0) {

View file

@ -1110,7 +1110,11 @@ CalendarTest::TestAddRollExtensive()
status = U_ZERO_ERROR;
for (i = 0; i < limit; i++) {
temp->add(e, 1, status);
if (U_FAILURE(status)) { limit = i; status = U_ZERO_ERROR; }
if (U_FAILURE(status)) {
limit = i;
status = U_ZERO_ERROR;
break; // Suppress compile warning. Shouldn't be necessary, but it is.
}
}
for (i = 0; i < limit; i++) {
temp->add(e, -1, status);

View file

@ -38,7 +38,7 @@ void DataDrivenNumberFormatTestSuite::run(const char *fileName, UBool runAllTest
}
UnicodeString columnValues[kNumberFormatTestTupleFieldCount];
ENumberFormatTestTupleField columnTypes[kNumberFormatTestTupleFieldCount];
int32_t columnCount;
int32_t columnCount = 0;
int32_t state = 0;
while(U_SUCCESS(status)) {
// Read a new line if necessary.

View file

@ -736,7 +736,7 @@ void RBBITest::TestExtended() {
int32_t tagValue = 0; // The numeric value of a <nnn> tag.
UnicodeString rules; // Holds rules from a <rules> ... </rules> block
int32_t rulesFirstLine; // Line number of the start of current <rules> block
int32_t rulesFirstLine = 0; // Line number of the start of current <rules> block
for (charIdx = 0; charIdx < len; ) {
status = U_ZERO_ERROR;

View file

@ -1049,6 +1049,7 @@ static void writeStringInU8(FILE *out, const UnicodeString &s) {
int32_t destIdx = 0;
U8_APPEND(bufForOneChar, destIdx, (int32_t)sizeof(bufForOneChar), c, isError);
U_ASSERT(!isError);
(void)isError;
fwrite(bufForOneChar, 1, destIdx, out);
}
}