From e3697c8f0a579b643317c4c44e0ba25fed70eabb Mon Sep 17 00:00:00 2001 From: John Emmons Date: Fri, 12 Aug 2011 21:16:53 +0000 Subject: [PATCH] ICU-8707 Clean up compiler warnings from GCC X-SVN-Rev: 30503 --- icu4c/source/common/icuplug.c | 12 ++++++------ icu4c/source/common/uvectr32.h | 4 ++-- icu4c/source/tools/ctestfw/ctest.c | 4 ++-- icu4c/source/tools/gencnval/gencnval.c | 20 ++++++++++---------- icu4c/source/tools/pkgdata/pkgdata.cpp | 4 ++++ icu4c/source/tools/toolutil/package.cpp | 4 ++-- icu4c/source/tools/toolutil/pkg_gencmn.c | 2 +- 7 files changed, 27 insertions(+), 23 deletions(-) diff --git a/icu4c/source/common/icuplug.c b/icu4c/source/common/icuplug.c index 5040be0526d..2e064bcfc60 100644 --- a/icu4c/source/common/icuplug.c +++ b/icu4c/source/common/icuplug.c @@ -755,29 +755,29 @@ uplug_init(UErrorCode *status) { continue; } else { p = linebuf; - while(*p&&isspace(*p)) + while(*p&&isspace((int)*p)) p++; if(!*p || *p=='#') continue; libName = p; - while(*p&&!isspace(*p)) { + while(*p&&!isspace((int)*p)) { p++; } if(!*p || *p=='#') continue; /* no tab after libname */ *p=0; /* end of libname */ p++; - while(*p&&isspace(*p)) { + while(*p&&isspace((int)*p)) { p++; } if(!*p||*p=='#') continue; /* no symname after libname +tab */ symName = p; - while(*p&&!isspace(*p)) { + while(*p&&!isspace((int)*p)) { p++; } if(*p) { /* has config */ *p=0; ++p; - while(*p&&isspace(*p)) { + while(*p&&isspace((int)*p)) { p++; } if(*p) { @@ -788,7 +788,7 @@ uplug_init(UErrorCode *status) { /* chop whitespace at the end of the config */ if(config!=NULL&&*config!=0) { p = config+strlen(config); - while(p>config&&isspace(*(--p))) { + while(p>config&&isspace((int)*(--p))) { *p=0; } } diff --git a/icu4c/source/common/uvectr32.h b/icu4c/source/common/uvectr32.h index ff49d49902f..d03eba62d00 100644 --- a/icu4c/source/common/uvectr32.h +++ b/icu4c/source/common/uvectr32.h @@ -1,6 +1,6 @@ /* ********************************************************************** -* Copyright (C) 1999-2010, International Business Machines +* Copyright (C) 1999-2011, International Business Machines * Corporation and others. All Rights Reserved. ********************************************************************** */ @@ -219,7 +219,7 @@ inline UBool UVector32::ensureCapacity(int32_t minimumCapacity, UErrorCode &stat } inline int32_t UVector32::elementAti(int32_t index) const { - return (0 <= index && index < count) ? elements[index] : 0; + return (index >= 0 && count > 0 && count - index > 0) ? elements[index] : 0; } diff --git a/icu4c/source/tools/ctestfw/ctest.c b/icu4c/source/tools/ctestfw/ctest.c index c1eb0de8d6a..22b626b78fb 100644 --- a/icu4c/source/tools/ctestfw/ctest.c +++ b/icu4c/source/tools/ctestfw/ctest.c @@ -1213,13 +1213,13 @@ ctest_xml_init(const char *rootName) { fprintf(stderr," Error: couldn't open XML output file %s\n", XML_FILE_NAME); return 1; } - while(*rootName&&!isalnum(*rootName)) { + while(*rootName&&!isalnum((int)*rootName)) { rootName++; } strcpy(XML_PREFIX,rootName); { char *p = XML_PREFIX+strlen(XML_PREFIX); - for(p--;*p&&p>XML_PREFIX&&!isalnum(*p);p--) { + for(p--;*p&&p>XML_PREFIX&&!isalnum((int)*p);p--) { *p=0; } } diff --git a/icu4c/source/tools/gencnval/gencnval.c b/icu4c/source/tools/gencnval/gencnval.c index ccbaf1467a6..0f0a915887b 100644 --- a/icu4c/source/tools/gencnval/gencnval.c +++ b/icu4c/source/tools/gencnval/gencnval.c @@ -1,7 +1,7 @@ /* ******************************************************************************* * -* Copyright (C) 1999-2009, International Business Machines +* Copyright (C) 1999-2011, International Business Machines * Corporation and others. All Rights Reserved. * ******************************************************************************* @@ -330,7 +330,7 @@ parseFile(FileStream *in) { /* Read non-empty lines that don't start with a space character. */ while (T_FileStream_readLine(in, lastLine, MAX_LINE_SIZE) != NULL) { lastLineSize = chomp(lastLine); - if (lineSize == 0 || (lastLineSize > 0 && isspace(*lastLine))) { + if (lineSize == 0 || (lastLineSize > 0 && isspace((int)*lastLine))) { uprv_strcpy(line + lineSize, lastLine); lineSize += lastLineSize; } else if (lineSize > 0) { @@ -341,7 +341,7 @@ parseFile(FileStream *in) { } if (validParse || lineSize > 0) { - if (isspace(*line)) { + if (isspace((int)*line)) { fprintf(stderr, "%s:%d: error: cannot start an alias with a space\n", path, lineNum-1); exit(U_PARSE_ERROR); } else if (line[0] == '{') { @@ -386,7 +386,7 @@ chomp(char *line) { *s = 0; break; } - if (!isspace(*s)) { + if (!isspace((int)*s)) { lastNonSpace = s; } ++s; @@ -417,7 +417,7 @@ parseLine(const char *line) { /* get the converter name */ start=pos; - while(line[pos]!=0 && !isspace(line[pos])) { + while(line[pos]!=0 && !isspace((int)line[pos])) { ++pos; } limit=pos; @@ -436,7 +436,7 @@ parseLine(const char *line) { for(;;) { /* skip white space */ - while(line[pos]!=0 && isspace(line[pos])) { + while(line[pos]!=0 && isspace((int)line[pos])) { ++pos; } @@ -447,7 +447,7 @@ parseLine(const char *line) { /* get an alias name */ start=pos; - while(line[pos]!=0 && line[pos]!='{' && !isspace(line[pos])) { + while(line[pos]!=0 && line[pos]!='{' && !isspace((int)line[pos])) { ++pos; } limit=pos; @@ -469,7 +469,7 @@ parseLine(const char *line) { /* addAlias(alias, 0, cnv, FALSE);*/ /* skip whitespace */ - while (line[pos] && isspace(line[pos])) { + while (line[pos] && isspace((int)line[pos])) { ++pos; } @@ -478,7 +478,7 @@ parseLine(const char *line) { ++pos; do { start = pos; - while (line[pos] && line[pos] != '}' && !isspace( line[pos])) { + while (line[pos] && line[pos] != '}' && !isspace((int)line[pos])) { ++pos; } limit = pos; @@ -489,7 +489,7 @@ parseLine(const char *line) { addAlias(alias, tag, cnv, (UBool)(line[limit-1] == '*')); } - while (line[pos] && isspace(line[pos])) { + while (line[pos] && isspace((int)line[pos])) { ++pos; } } while (line[pos] && line[pos] != '}'); diff --git a/icu4c/source/tools/pkgdata/pkgdata.cpp b/icu4c/source/tools/pkgdata/pkgdata.cpp index f237fe44322..cc52e2d6483 100644 --- a/icu4c/source/tools/pkgdata/pkgdata.cpp +++ b/icu4c/source/tools/pkgdata/pkgdata.cpp @@ -513,7 +513,9 @@ static int runCommand(const char* command, UBool specialHandling) { goto normal_command_mode; #endif } else { +#if !(defined(USING_CYGWIN) || U_PLATFORM == U_PF_MINGW || U_PLATFORM == U_PF_OS400) normal_command_mode: +#endif cmd = (char *)command; } @@ -937,7 +939,9 @@ static int32_t pkg_createSymLinks(const char *targetDir, UBool specialHandling) goto normal_symlink_mode; #endif } else { +#if U_PLATFORM != U_PF_CYGWIN normal_symlink_mode: +#endif sprintf(name1, "%s.%s", libFileNames[LIB_FILE], pkgDataFlags[SO_EXT]); sprintf(name2, "%s", libFileNames[LIB_FILE_VERSION]); } diff --git a/icu4c/source/tools/toolutil/package.cpp b/icu4c/source/tools/toolutil/package.cpp index 7b7f015356a..792bdea0e0c 100644 --- a/icu4c/source/tools/toolutil/package.cpp +++ b/icu4c/source/tools/toolutil/package.cpp @@ -1,7 +1,7 @@ /* ******************************************************************************* * -* Copyright (C) 1999-2010, International Business Machines +* Copyright (C) 1999-2011, International Business Machines * Corporation and others. All Rights Reserved. * ******************************************************************************* @@ -1235,7 +1235,7 @@ void Package::setItemCapacity(int32_t max) Item *newItems = (Item*)uprv_malloc(max * sizeof(items[0])); Item *oldItems = items; if(newItems == NULL) { - fprintf(stderr, "icupkg: Out of memory trying to allocate %ld bytes for %d items\n", max*sizeof(items[0]), max); + fprintf(stderr, "icupkg: Out of memory trying to allocate %u bytes for %d items\n", max*sizeof(items[0]), max); exit(U_MEMORY_ALLOCATION_ERROR); } if(items && itemCount>0) { diff --git a/icu4c/source/tools/toolutil/pkg_gencmn.c b/icu4c/source/tools/toolutil/pkg_gencmn.c index d6cf05c5ba1..cc02c513eef 100644 --- a/icu4c/source/tools/toolutil/pkg_gencmn.c +++ b/icu4c/source/tools/toolutil/pkg_gencmn.c @@ -411,7 +411,7 @@ addFile(const char *filename, const char *name, const char *source, UBool source fileMax += CHUNK_FILE_COUNT; files = uprv_realloc(files, fileMax*sizeof(files[0])); /* note: never freed. */ if(files==NULL) { - fprintf(stderr, "pkgdata/gencmn: Could not allocate %ld bytes for %d files\n", (fileMax*sizeof(files[0])), fileCount); + fprintf(stderr, "pkgdata/gencmn: Could not allocate %u bytes for %d files\n", (fileMax*sizeof(files[0])), fileCount); exit(U_MEMORY_ALLOCATION_ERROR); } } -- 2.40.0