ICU-10624 Compiler warning cleanups, continued.

X-SVN-Rev: 34855
This commit is contained in:
Andy Heninger 2014-01-10 08:35:00 +00:00
parent 1996008111
commit 301814f85f
11 changed files with 52 additions and 45 deletions

View File

@ -1,5 +1,5 @@
/********************************************************************
* Copyright (c) 1997-2013, International Business Machines
* Copyright (c) 1997-2014, International Business Machines
* Corporation and others. All Rights Reserved.
********************************************************************/
/*****************************************************************************
@ -2417,10 +2417,10 @@ static void TestStrcollNull(void) {
const UChar u16han[] = {0x5c71, 0x5ddd, 0};
const int32_t u16hanLen = 2;
const char u8asc[] = {0x49, 0x42, 0x4D, 0};
const char *u8asc = "\x49\x42\x4D";
const int32_t u8ascLen = 3;
const char u8han[] = {0xE5, 0xB1, 0xB1, 0xE5, 0xB7, 0x9D, 0};
const char *u8han = "\xE5\xB1\xB1\xE5\xB7\x9D";
const int32_t u8hanLen = 6;
coll = ucol_open(NULL, &status);

View File

@ -837,7 +837,8 @@ static void TestConvert()
/*Reads the BOM*/
fread(&BOM, sizeof(UChar), 1, ucs_file_in);
size_t numRead = fread(&BOM, sizeof(UChar), 1, ucs_file_in);
(void)numRead;
if (BOM!=0xFEFF && BOM!=0xFFFE)
{
log_err("File Missing BOM...Bailing!\n");

View File

@ -1,6 +1,6 @@
/********************************************************************
* COPYRIGHT:
* Copyright (c) 1997-2013, International Business Machines Corporation and
* Copyright (c) 1997-2014, International Business Machines Corporation and
* others. All Rights Reserved.
********************************************************************/
/********************************************************************************
@ -1492,6 +1492,7 @@ static void TestContext(void) {
char bbuf1[kBbufMax];
char bbuf2[kBbufMax];
int32_t len = udat_format(udfmt, today, ubuf, kUbufMax, NULL, &status);
(void)len;
if ( U_FAILURE(status) ) {
log_err("FAIL: udat_format today for locale %s, capitalizationContext %d, status %s\n",
textRelContextItemPtr->locale, (int)textRelContextItemPtr->capitalizationContext, u_errorName(status) );

View File

@ -1,6 +1,6 @@
/********************************************************************
* COPYRIGHT:
* Copyright (c) 1997-2013, International Business Machines Corporation and
* Copyright (c) 1997-2014, International Business Machines Corporation and
* others. All Rights Reserved.
********************************************************************/
/*****************************************************************************
@ -1094,6 +1094,7 @@ static void TestDisplayNameBrackets()
log_data_err("uldn_open fails for displayLocale %s, status=%s\n", itemPtr->displayLocale, u_errorName(status));
}
#endif
(void)ulen; /* Suppress variable not used warning */
}
}

View File

@ -1,6 +1,6 @@
/********************************************************************
* COPYRIGHT:
* Copyright (c) 1997-2013, International Business Machines Corporation and
* Copyright (c) 1997-2014, International Business Machines Corporation and
* others. All Rights Reserved.
********************************************************************/
/********************************************************************************
@ -2339,6 +2339,7 @@ static void TestUNumberingSystem(void) {
itemPtr->locale, itemPtr->numsys, itemPtr->radix, itemPtr->isAlgorithmic, numsys, radix, isAlgorithmic);
}
ulen = unumsys_getDescription(unumsys, ubuf, kNumSysDescripBufMax, &status);
(void)ulen; // Suppress variable not used warning.
if ( U_FAILURE(status) || u_strcmp(ubuf, itemPtr->description) != 0 ) {
log_data_err("unumsys description for locale %s, description unexpected and/or status %\n", myErrorName(status));
}

View File

@ -1,6 +1,6 @@
/********************************************************************
* COPYRIGHT:
* Copyright (c) 2001-2013, International Business Machines Corporation and
* Copyright (c) 2001-2014, International Business Machines Corporation and
* others. All Rights Reserved.
********************************************************************/
/********************************************************************************
@ -851,7 +851,7 @@ static void Test_UChar_UTF8_API(void){
* Test with an illegal lead byte that would be followed by more than 3 trail bytes.
* See ticket #10371.
*/
static const char src[1]={ 0xf8 };
static const char src[1]={ (char)0xf8 };
UChar out16[10];
err=U_ZERO_ERROR;
u_strFromUTF8(out16, LENGTHOF(out16), NULL, src, 1, &err);

View File

@ -1,6 +1,6 @@
/************************************************************************
* COPYRIGHT:
* Copyright (c) 1997-2013, International Business Machines Corporation
* Copyright (c) 1997-2014, International Business Machines Corporation
* and others. All Rights Reserved.
************************************************************************/
#include "unicode/utypes.h"
@ -2912,6 +2912,7 @@ void CalendarTest::TestHebrewMonthValidation() {
// 5777 is NOT a lear year and does not have month Adar I
pCal->set(5777, HebrewCalendar::ADAR_1, 1);
d = pCal->getTime(status);
(void)d;
if (status == U_ILLEGAL_ARGUMENT_ERROR) {
logln("Info: U_ILLEGAL_ARGUMENT_ERROR, because 5777 Adar I 1 is not a valid date.");
} else {

View File

@ -1,6 +1,6 @@
/********************************************************************
* COPYRIGHT:
* Copyright (c) 1997-2013, International Business Machines
* Copyright (c) 1997-2014, International Business Machines
* Corporation and others. All Rights Reserved.
********************************************************************/
@ -4218,38 +4218,38 @@ void DateFormatTest::TestDateFormatLeniency() {
{ NULL, true, UnicodeString(""), UnicodeString(""), UnicodeString("") }
};
UErrorCode status = U_ZERO_ERROR;
Calendar* cal = Calendar::createInstance(status);
LocalPointer<Calendar> cal(Calendar::createInstance(status));
if (U_FAILURE(status)) {
dataerrln(UnicodeString("FAIL: Unable to create Calendar for default timezone and locale."));
} else {
cal->setTime(july022008, status);
const TestDateFormatLeniencyItem * itemPtr;
for (itemPtr = items; itemPtr->locale != NULL; itemPtr++ ) {
Locale locale = Locale::createFromName(itemPtr->locale);
status = U_ZERO_ERROR;
ParsePosition pos(0);
SimpleDateFormat * sdmft = new SimpleDateFormat(itemPtr->pattern, locale, status);
if (U_FAILURE(status)) {
dataerrln("Unable to create SimpleDateFormat - %s", u_errorName(status));
continue;
}
sdmft->setLenient(itemPtr->leniency);
sdmft->setBooleanAttribute(UDAT_PARSE_ALLOW_WHITESPACE, itemPtr->leniency, status).setBooleanAttribute(UDAT_PARSE_ALLOW_NUMERIC, itemPtr->leniency, status);
/*UDate d = */sdmft->parse(itemPtr->parseString, pos);
delete sdmft;
if(pos.getErrorIndex() > -1)
if(itemPtr->expectedResult.length() != 0) {
errln("error: unexpected error - " + itemPtr->parseString + " - error index " + pos.getErrorIndex() + " - leniency " + itemPtr->leniency);
continue;
} else {
continue;
}
}
return;
}
delete cal;
cal->setTime(july022008, status);
const TestDateFormatLeniencyItem * itemPtr;
LocalPointer<SimpleDateFormat> sdmft;
for (itemPtr = items; itemPtr->locale != NULL; itemPtr++ ) {
Locale locale = Locale::createFromName(itemPtr->locale);
status = U_ZERO_ERROR;
ParsePosition pos(0);
sdmft.adoptInstead(new SimpleDateFormat(itemPtr->pattern, locale, status));
if (U_FAILURE(status)) {
dataerrln("Unable to create SimpleDateFormat - %s", u_errorName(status));
continue;
}
sdmft->setLenient(itemPtr->leniency);
sdmft->setBooleanAttribute(UDAT_PARSE_ALLOW_WHITESPACE, itemPtr->leniency, status).
setBooleanAttribute(UDAT_PARSE_ALLOW_NUMERIC, itemPtr->leniency, status);
UDate d = sdmft->parse(itemPtr->parseString, pos);
(void)d;
// TODO: Ticket 10625. Nothing here is checking the expected result when the parse succeeds.
if ((pos.getErrorIndex() > -1) && (itemPtr->expectedResult.length() != 0)) {
errln("error: unexpected error - " + itemPtr->parseString +
" - error index " + pos.getErrorIndex() +
" - leniency " + itemPtr->leniency);
}
}
}
#endif /* #if !UCONFIG_NO_FORMATTING */

View File

@ -1,6 +1,6 @@
/*
*******************************************************************************
* Copyright (C) 2007-2013, International Business Machines Corporation and
* Copyright (C) 2007-2014, International Business Machines Corporation and
* others. All Rights Reserved.
********************************************************************************
@ -224,7 +224,7 @@ void PluralRulesTest::testAPI(/*char *par*/)
for (int32_t i=0; i<LENGTHOF(fData); i++) {
if ((newRules->select(fData[i])== KEYWORD_A) != isKeywordA[i]) {
errln("File %s, Line %d, ERROR: plural rules for decimal fractions test failed!\n"
" number = %g, expected %s", __FILE__, __LINE__, fData[i], isKeywordA?"TRUE":"FALSE");
" number = %g, expected %s", __FILE__, __LINE__, fData[i], isKeywordA[i]?"TRUE":"FALSE");
}
}

View File

@ -1,5 +1,5 @@
/********************************************************************
* Copyright (c) 2008-2013, International Business Machines Corporation and
* Copyright (c) 2008-2014, International Business Machines Corporation and
* others. All Rights Reserved.
********************************************************************/
@ -21,6 +21,8 @@
#include <iostream>
#endif
#define LENGTHOF(array) (int32_t)(sizeof(array)/sizeof((array)[0]))
void TimeUnitTest::runIndexedTest( int32_t index, UBool exec, const char* &name, char* /*par*/ ) {
if (exec) logln("TestSuite TimeUnitTest");
switch (index) {
@ -387,7 +389,7 @@ void TimeUnitTest::test10219Plurals() {
dataerrln("generating NumberFormat Object failed: %s", u_errorName(status));
return;
}
for (int32_t i = 0; i < sizeof(expected) / sizeof(expected[0]); ++i) {
for (int32_t i = 0; i < LENGTHOF(expected); ++i) {
nf->setMaximumFractionDigits(i);
nf->setRoundingMode(DecimalFormat::kRoundDown);
tuf.setNumberFormat(*nf, status);

View File

@ -1,5 +1,5 @@
/******************************************************************************
* Copyright (C) 2000-2013, International Business Machines
* Copyright (C) 2000-2014, International Business Machines
* Corporation and others. All Rights Reserved.
*******************************************************************************
* file name: pkgdata.cpp
@ -1985,7 +1985,7 @@ static void loadLists(UPKGOptions *o, UErrorCode *status)
if (cmdBuf[0] != 0) {
uprv_strncat(cmdBuf, U_FILE_SEP_STRING, 1024);
}
uprv_strncat(cmdBuf, cmd, 1024);
uprv_strncat(cmdBuf, cmd, 1023);
if(verbose) {
fprintf(stdout, "# Calling icu-config: %s\n", cmdBuf);