]> granicus.if.org Git - icu/commitdiff
ICU-8707 Clean up compiler warnings from GCC
authorJohn Emmons <emmo@us.ibm.com>
Fri, 12 Aug 2011 21:16:53 +0000 (21:16 +0000)
committerJohn Emmons <emmo@us.ibm.com>
Fri, 12 Aug 2011 21:16:53 +0000 (21:16 +0000)
X-SVN-Rev: 30503

icu4c/source/common/icuplug.c
icu4c/source/common/uvectr32.h
icu4c/source/tools/ctestfw/ctest.c
icu4c/source/tools/gencnval/gencnval.c
icu4c/source/tools/pkgdata/pkgdata.cpp
icu4c/source/tools/toolutil/package.cpp
icu4c/source/tools/toolutil/pkg_gencmn.c

index 5040be0526d5c214cf96644845f58bb21d104648..2e064bcfc6027d09a0c9902cde4b1f75bdb8587f 100644 (file)
@@ -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;
             }
           }
index ff49d49902f7ce77adb17df9a8a503b884ef92a1..d03eba62d00275d37223e60851a7d9e2d50d001d 100644 (file)
@@ -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;
 }
 
 
index c1eb0de8d6a7a6b823d41d5c5e2c06541d82e599..22b626b78fb42170dad74dc3505212a14550cb57 100644 (file)
@@ -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;
     }
   }
index ccbaf1467a66ba3918bdcc5ca4380c90b7817c87..0f0a915887b0004f8801dc1b9d04395edb3cdd99 100644 (file)
@@ -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] != '}');
index f237fe44322173aa7fd9ff083de3334d470c13f6..cc52e2d6483d708d659923050f6f531c1d2cd6fa 100644 (file)
@@ -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]);
     }
index 7b7f015356ab4c47426a17ec61a92abf3ebf9f97..792bdea0e0c5954ad2967d5c6e436ccd7759ea9a 100644 (file)
@@ -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) {
index d6cf05c5ba1e3984bcb79a8d9affdc0996b3e7d1..cc02c513eefd896586b044b7d4dbd158374caf47 100644 (file)
@@ -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);
       }
     }