ICU-8707 Clean up compiler warnings from GCC

X-SVN-Rev: 30503
This commit is contained in:
John Emmons 2011-08-12 21:16:53 +00:00
parent d895f91300
commit e3697c8f0a
7 changed files with 27 additions and 23 deletions

View 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;
}
}

View 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;
}

View 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;
}
}

View 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] != '}');

View 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]);
}

View 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) {

View 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);
}
}