From da1272de5791b5e2acfcf46d06b3f23fcbd9e295 Mon Sep 17 00:00:00 2001 From: Michael Ow Date: Fri, 8 Oct 2010 20:14:26 +0000 Subject: [PATCH] ICU-7447 Fix some GCC and VA compiler warnings. X-SVN-Rev: 28778 --- icu4c/source/common/ucnv_bld.c | 2 +- icu4c/source/common/utrie2.cpp | 6 +++--- icu4c/source/common/utrie2_builder.c | 1 + icu4c/source/i18n/decimfmt.cpp | 2 +- icu4c/source/test/cintltst/cnumtst.c | 2 +- icu4c/source/test/cintltst/putiltst.c | 4 ++-- icu4c/source/tools/ctestfw/ctest.c | 7 ++++--- icu4c/source/tools/toolutil/flagparser.c | 2 +- 8 files changed, 14 insertions(+), 12 deletions(-) diff --git a/icu4c/source/common/ucnv_bld.c b/icu4c/source/common/ucnv_bld.c index 0b7e2beef6e..a95b7b8172d 100644 --- a/icu4c/source/common/ucnv_bld.c +++ b/icu4c/source/common/ucnv_bld.c @@ -1037,7 +1037,7 @@ ucnv_flushCache () int32_t pos; int32_t tableDeletedNum = 0; const UHashElement *e; - UErrorCode status = U_ILLEGAL_ARGUMENT_ERROR; + /*UErrorCode status = U_ILLEGAL_ARGUMENT_ERROR;*/ int32_t i, remaining; UTRACE_ENTRY_OC(UTRACE_UCNV_FLUSH_CACHE); diff --git a/icu4c/source/common/utrie2.cpp b/icu4c/source/common/utrie2.cpp index f0518625bca..55678605ba8 100644 --- a/icu4c/source/common/utrie2.cpp +++ b/icu4c/source/common/utrie2.cpp @@ -487,7 +487,7 @@ utrie2_swap(const UDataSwapper *ds, /* enumeration -------------------------------------------------------------- */ -#define MIN(a, b) ((a)<(b) ? (a) : (b)) +#define MIN_VALUE(a, b) ((a)<(b) ? (a) : (b)) /* default UTrie2EnumValue() returns the input value itself */ static uint32_t U_CALLCONV @@ -569,14 +569,14 @@ enumEitherTrie(const UTrie2 *trie, * This special block has half the normal length. */ i2Block=UTRIE2_LSCP_INDEX_2_OFFSET; - tempLimit=MIN(0xdc00, limit); + tempLimit=MIN_VALUE(0xdc00, limit); } else { /* * Switch back to the normal part of the index-2 table. * Enumerate the second half of the surrogates block. */ i2Block=0xd800>>UTRIE2_SHIFT_2; - tempLimit=MIN(0xe000, limit); + tempLimit=MIN_VALUE(0xe000, limit); } } else { /* supplementary code points */ diff --git a/icu4c/source/common/utrie2_builder.c b/icu4c/source/common/utrie2_builder.c index 0b2c620ab28..1f3c4c1352d 100644 --- a/icu4c/source/common/utrie2_builder.c +++ b/icu4c/source/common/utrie2_builder.c @@ -1466,4 +1466,5 @@ utrie2_swapAnyVersion(const UDataSwapper *ds, return 0; } } + return 0; } diff --git a/icu4c/source/i18n/decimfmt.cpp b/icu4c/source/i18n/decimfmt.cpp index f50ecaeae72..85b9085eefd 100644 --- a/icu4c/source/i18n/decimfmt.cpp +++ b/icu4c/source/i18n/decimfmt.cpp @@ -1177,7 +1177,7 @@ DecimalFormat::subformat(UnicodeString& appendTo, DigitList& digits, UBool isInteger) const { - char zero = '0'; + // char zero = '0'; // DigitList returns digits as '0' thru '9', so we will need to // always need to subtract the character 0 to get the numeric value to use for indexing. diff --git a/icu4c/source/test/cintltst/cnumtst.c b/icu4c/source/test/cintltst/cnumtst.c index 53245bc02fe..6eec88f1e9f 100644 --- a/icu4c/source/test/cintltst/cnumtst.c +++ b/icu4c/source/test/cintltst/cnumtst.c @@ -100,7 +100,7 @@ static void TestInt64Parse() char* st1 = "009223372036854775808"; const int size = 21; - const int textLength = size; + /*const int textLength = size;*/ UChar text[21]; diff --git a/icu4c/source/test/cintltst/putiltst.c b/icu4c/source/test/cintltst/putiltst.c index c3dc07e85b3..84a519501cf 100644 --- a/icu4c/source/test/cintltst/putiltst.c +++ b/icu4c/source/test/cintltst/putiltst.c @@ -478,11 +478,11 @@ static void Test_aestrncpy(int32_t line, const uint8_t *expect, const uint8_t *s } if(!uprv_memcmp(str_buf, expect, AESTRNCPY_SIZE)) { log_verbose("\n%s:%d: OK - compared OK.", __FILE__, line); - log_verbose("\n%s:%d: expected: %s", __FILE__, line, dump_binline(expect)); + log_verbose("\n%s:%d: expected: %s", __FILE__, line, dump_binline((uint8_t *)expect)); log_verbose("\n%s:%d: got : %s\n", __FILE__, line, dump_binline(str_buf)); } else { log_err ("\n%s:%d: FAIL: uprv_aestrncpy output differs", __FILE__, line); - log_err ("\n%s:%d: expected: %s", __FILE__, line, dump_binline(expect)); + log_err ("\n%s:%d: expected: %s", __FILE__, line, dump_binline((uint8_t *)expect)); log_err ("\n%s:%d: got : %s\n", __FILE__, line, dump_binline(str_buf)); } } diff --git a/icu4c/source/tools/ctestfw/ctest.c b/icu4c/source/tools/ctestfw/ctest.c index 91e7fbef320..1336967a2fc 100644 --- a/icu4c/source/tools/ctestfw/ctest.c +++ b/icu4c/source/tools/ctestfw/ctest.c @@ -11,6 +11,7 @@ #include #include #include +#include #include "unicode/utrace.h" #include "unicode/uclean.h" @@ -32,7 +33,7 @@ /** * How many lines of scrollage can go by before we need to remind the user what the test is. */ -#define PAGE_SIZE 25 +#define PAGE_SIZE_LIMIT 25 #ifndef SHOW_TIMES #define SHOW_TIMES 1 @@ -408,7 +409,7 @@ static void iterateTestsWithLevel ( const TestNode* root, if(!ON_LINE) { /* had some output */ int spaces = FLAG_INDENT-(depth-1); log_testinfo_i("} %*s[OK] ", spaces, "---"); - if((GLOBAL_PRINT_COUNT-myGLOBAL_PRINT_COUNT)>PAGE_SIZE) { + if((GLOBAL_PRINT_COUNT-myGLOBAL_PRINT_COUNT)>PAGE_SIZE_LIMIT) { log_testinfo(" %s ", pathToFunction); /* in case they forgot. */ } } else { @@ -451,7 +452,7 @@ static void iterateTestsWithLevel ( const TestNode* root, log_testinfo_i("} "); /* TODO: summarize subtests */ if((depth>1) && (ERROR_COUNT > myERROR_COUNT)) { log_testinfo("[%d %s in %s] ", ERROR_COUNT-myERROR_COUNT, (ERROR_COUNT-myERROR_COUNT)==1?"error":"errors", pathToFunction); - } else if((GLOBAL_PRINT_COUNT-myGLOBAL_PRINT_COUNT)>PAGE_SIZE || (depth<1)) { + } else if((GLOBAL_PRINT_COUNT-myGLOBAL_PRINT_COUNT)>PAGE_SIZE_LIMIT || (depth<1)) { if(pathToFunction[0]) { log_testinfo(" %s ", pathToFunction); /* in case they forgot. */ } else { diff --git a/icu4c/source/tools/toolutil/flagparser.c b/icu4c/source/tools/toolutil/flagparser.c index 718a2551602..41ec9c9ce61 100644 --- a/icu4c/source/tools/toolutil/flagparser.c +++ b/icu4c/source/tools/toolutil/flagparser.c @@ -45,7 +45,7 @@ parseFlagsFile(const char *fileName, char **flagBuffer, int32_t flagBufferSize, buffer = uprv_malloc(sizeof(char) * currentBufferSize); if (buffer == NULL) { *status = U_MEMORY_ALLOCATION_ERROR; - return; + return -1; } } for (i = 0; i < numOfFlags; i++) {