ICU-3500 Fix some compiler warnings

X-SVN-Rev: 15394
This commit is contained in:
George Rhoten 2004-05-19 04:01:34 +00:00
parent 8064ff5e19
commit 6f1f6cf374
6 changed files with 58 additions and 58 deletions

View file

@ -1,7 +1,7 @@
/*
*******************************************************************************
*
* Copyright (C) 1999-2003, International Business Machines
* Copyright (C) 1999-2004, International Business Machines
* Corporation and others. All Rights Reserved.
*
*******************************************************************************
@ -274,7 +274,7 @@ main(int argc, char* argv[]) {
out = stdout;
#if defined(WIN32) || defined(U_CYGWIN)
if (_setmode(_fileno(out), _O_BINARY) == -1) {
fprintf(stderr, "%s: couldn't set standard output to binary mode\n, pname");
fprintf(stderr, "%s: couldn't set standard output to binary mode\n", pname);
return 4;
}
#endif
@ -507,15 +507,15 @@ static void printOutAlias(FILE *out, UConverter *converter, UResourceBundle *pa
len = truncsize;
}
if(U_SUCCESS(*status)) {
static const UChar open[] = { 0x003A, 0x0061, 0x006C, 0x0069, 0x0061, 0x0073, 0x0020, 0x007B, 0x0020, 0x0022 }; /* ":alias { \"" */
static const UChar close[] = { 0x0022, 0x0020, 0x007D, 0x0020 }; /* "\" } " */
static const UChar openStr[] = { 0x003A, 0x0061, 0x006C, 0x0069, 0x0061, 0x0073, 0x0020, 0x007B, 0x0020, 0x0022 }; /* ":alias { \"" */
static const UChar closeStr[] = { 0x0022, 0x0020, 0x007D, 0x0020 }; /* "\" } " */
printIndent(out, converter, indent);
if(key != NULL) {
printCString(out, converter, key, -1);
}
printString(out, converter, open, (int32_t)(sizeof(open) / sizeof(*open)));
printString(out, converter, openStr, (int32_t)(sizeof(openStr) / sizeof(*openStr)));
printString(out, converter, string, len);
printString(out, converter, close, (int32_t)(sizeof(close) / sizeof(*close)));
printString(out, converter, closeStr, (int32_t)(sizeof(closeStr) / sizeof(*closeStr)));
if(verbose) {
printCString(out, converter, " // ALIAS", -1);
}
@ -551,19 +551,19 @@ static void printOutBundle(FILE *out, UConverter *converter, UResourceBundle *re
}
printIndent(out, converter, indent);
if(key != NULL) {
static const UChar open[] = { 0x0020, 0x007B, 0x0020, 0x0022 }; /* " { \"" */
static const UChar close[] = { 0x0022, 0x0020, 0x007D }; /* "\" }" */
static const UChar openStr[] = { 0x0020, 0x007B, 0x0020, 0x0022 }; /* " { \"" */
static const UChar closeStr[] = { 0x0022, 0x0020, 0x007D }; /* "\" }" */
printCString(out, converter, key, (int32_t)uprv_strlen(key));
printString(out, converter, open, (int32_t)(sizeof(open)/sizeof(*open)));
printString(out, converter, openStr, (int32_t)(sizeof(openStr)/sizeof(*openStr)));
printString(out, converter, string, len);
printString(out, converter, close, (int32_t)(sizeof(close) / sizeof(*close)));
printString(out, converter, closeStr, (int32_t)(sizeof(closeStr) / sizeof(*closeStr)));
} else {
static const UChar open[] = { 0x0022 }; /* "\"" */
static const UChar close[] = { 0x0022, 0x002C }; /* "\"," */
static const UChar openStr[] = { 0x0022 }; /* "\"" */
static const UChar closeStr[] = { 0x0022, 0x002C }; /* "\"," */
printString(out, converter, open, (int32_t)(sizeof(open) / sizeof(*open)));
printString(out, converter, openStr, (int32_t)(sizeof(openStr) / sizeof(*openStr)));
printString(out, converter, string, (int32_t)(u_strlen(string)));
printString(out, converter, close, (int32_t)(sizeof(close) / sizeof(*close)));
printString(out, converter, closeStr, (int32_t)(sizeof(closeStr) / sizeof(*closeStr)));
}
if(verbose) {
@ -577,18 +577,18 @@ static void printOutBundle(FILE *out, UConverter *converter, UResourceBundle *re
case RES_INT :
{
static const UChar open[] = { 0x003A, 0x0069, 0x006E, 0x0074, 0x0020, 0x007B, 0x0020 }; /* ":int { " */
static const UChar close[] = { 0x0020, 0x007D }; /* " }" */
static const UChar openStr[] = { 0x003A, 0x0069, 0x006E, 0x0074, 0x0020, 0x007B, 0x0020 }; /* ":int { " */
static const UChar closeStr[] = { 0x0020, 0x007D }; /* " }" */
UChar num[20];
printIndent(out, converter, indent);
if(key != NULL) {
printCString(out, converter, key, -1);
}
printString(out, converter, open, (int32_t)(sizeof(open) / sizeof(*open)));
printString(out, converter, openStr, (int32_t)(sizeof(openStr) / sizeof(*openStr)));
uprv_itou(num, 20, ures_getInt(resource, status), 10, 0);
printString(out, converter, num, u_strlen(num));
printString(out, converter, close, (int32_t)(sizeof(close) / sizeof(*close)));
printString(out, converter, closeStr, (int32_t)(sizeof(closeStr) / sizeof(*closeStr)));
if(verbose) {
printCString(out, converter, "// INT", -1);
@ -609,17 +609,17 @@ static void printOutBundle(FILE *out, UConverter *converter, UResourceBundle *re
len = truncsize;
}
if(U_SUCCESS(*status)) {
static const UChar open[] = { 0x003A, 0x0062, 0x0069, 0x006E, 0x0061, 0x0072, 0x0079, 0x0020, 0x007B, 0x0020 }; /* ":binary { " */
static const UChar close[] = { 0x0020, 0x007D, 0x0020 }; /* " } " */
static const UChar openStr[] = { 0x003A, 0x0062, 0x0069, 0x006E, 0x0061, 0x0072, 0x0079, 0x0020, 0x007B, 0x0020 }; /* ":binary { " */
static const UChar closeStr[] = { 0x0020, 0x007D, 0x0020 }; /* " } " */
printIndent(out, converter, indent);
if(key != NULL) {
printCString(out, converter, key, -1);
}
printString(out, converter, open, (int32_t)(sizeof(open) / sizeof(*open)));
printString(out, converter, openStr, (int32_t)(sizeof(openStr) / sizeof(*openStr)));
for(i = 0; i<len; i++) {
printHex(out, converter, *data++);
}
printString(out, converter, close, (int32_t)(sizeof(close) / sizeof(*close)));
printString(out, converter, closeStr, (int32_t)(sizeof(closeStr) / sizeof(*closeStr)));
if(verbose) {
printCString(out, converter, " // BINARY", -1);
}
@ -634,15 +634,15 @@ static void printOutBundle(FILE *out, UConverter *converter, UResourceBundle *re
int32_t len = 0;
const int32_t *data = ures_getIntVector(resource, &len, status);
if(U_SUCCESS(*status)) {
static const UChar open[] = { 0x003A, 0x0069, 0x006E, 0x0074, 0x0076, 0x0065, 0x0063, 0x0074, 0x006F, 0x0072, 0x0020, 0x007B, 0x0020 }; /* ":intvector { " */
static const UChar close[] = { 0x0020, 0x007D, 0x0020 }; /* " } " */
static const UChar openStr[] = { 0x003A, 0x0069, 0x006E, 0x0074, 0x0076, 0x0065, 0x0063, 0x0074, 0x006F, 0x0072, 0x0020, 0x007B, 0x0020 }; /* ":intvector { " */
static const UChar closeStr[] = { 0x0020, 0x007D, 0x0020 }; /* " } " */
UChar num[20];
printIndent(out, converter, indent);
if(key != NULL) {
printCString(out, converter, key, -1);
}
printString(out, converter, open, (int32_t)(sizeof(open) / sizeof(*open)));
printString(out, converter, openStr, (int32_t)(sizeof(openStr) / sizeof(*openStr)));
for(i = 0; i < len - 1; i++) {
int32_t numLen = uprv_itou(num, 20, data[i], 10, 0);
num[numLen++] = 0x002C; /* ',' */
@ -654,7 +654,7 @@ static void printOutBundle(FILE *out, UConverter *converter, UResourceBundle *re
uprv_itou(num, 20, data[len - 1], 10, 0);
printString(out, converter, num, u_strlen(num));
}
printString(out, converter, close, (int32_t)(sizeof(close) / sizeof(*close)));
printString(out, converter, closeStr, (int32_t)(sizeof(closeStr) / sizeof(*closeStr)));
if(verbose) {
printCString(out, converter, "// INTVECTOR", -1);
}
@ -667,8 +667,8 @@ static void printOutBundle(FILE *out, UConverter *converter, UResourceBundle *re
case RES_TABLE :
case RES_ARRAY :
{
static const UChar open[] = { 0x007B }; /* "{" */
static const UChar close[] = { 0x007D, '\n' }; /* "}\n" */
static const UChar openStr[] = { 0x007B }; /* "{" */
static const UChar closeStr[] = { 0x007D, '\n' }; /* "}\n" */
UResourceBundle *t = NULL;
ures_resetIterator(resource);
@ -676,7 +676,7 @@ static void printOutBundle(FILE *out, UConverter *converter, UResourceBundle *re
if(key != NULL) {
printCString(out, converter, key, -1);
}
printString(out, converter, open, (int32_t)(sizeof(open) / sizeof(*open)));
printString(out, converter, openStr, (int32_t)(sizeof(openStr) / sizeof(*openStr)));
if(verbose) {
if(ures_getType(resource) == RES_TABLE) {
printCString(out, converter, "// TABLE", -1);
@ -721,7 +721,7 @@ static void printOutBundle(FILE *out, UConverter *converter, UResourceBundle *re
}
printIndent(out, converter, indent);
printString(out, converter, close, (int32_t)(sizeof(close) / sizeof(*close)));
printString(out, converter, closeStr, (int32_t)(sizeof(closeStr) / sizeof(*closeStr)));
ures_close(t);
}
break;

View file

@ -1,7 +1,7 @@
/*
*******************************************************************************
*
* Copyright (C) 1998-2000, International Business Machines
* Copyright (C) 1998-2004, International Business Machines
* Corporation and others. All Rights Reserved.
*
*******************************************************************************
@ -25,7 +25,7 @@ void error(uint32_t linenumber, const char *msg, ...)
va_list va;
va_start(va, msg);
fprintf(stderr, "%s:%d: ", gCurrentFileName, linenumber);
fprintf(stderr, "%s:%u: ", gCurrentFileName, (int)linenumber);
vfprintf(stderr, msg, va);
fprintf(stderr, "\n");
va_end(va);
@ -63,7 +63,7 @@ void warning(uint32_t linenumber, const char *msg, ...)
va_list va;
va_start(va, msg);
fprintf(stderr, "%s:%d: warning: ", gCurrentFileName, linenumber);
fprintf(stderr, "%s:%u: warning: ", gCurrentFileName, (int)linenumber);
vfprintf(stderr, msg, va);
fprintf(stderr, "\n");
va_end(va);

View file

@ -1,7 +1,7 @@
/*
*******************************************************************************
*
* Copyright (C) 2000-2003, International Business Machines
* Copyright (C) 2000-2004, International Business Machines
* Corporation and others. All Rights Reserved.
*
*******************************************************************************
@ -414,7 +414,7 @@ void bundle_write(struct SRBRoot *bundle, const char *outputDir, const char *out
size = udata_finish(mem, status);
if(top != size) {
fprintf(stderr, "genrb error: wrote %u bytes but counted %u\n",
size, top);
(int)size, (int)top);
*status = U_INTERNAL_PROGRAM_ERROR;
}
}

View file

@ -1,7 +1,7 @@
/*
*******************************************************************************
*
* Copyright (C) 2002-2003, International Business Machines
* Copyright (C) 2002-2004, International Business Machines
* Corporation and others. All Rights Reserved.
*
*******************************************************************************
@ -386,7 +386,7 @@ static char* convertAndEscape(char** pDest, int32_t destCap, int32_t* destLength
case 0x1E:
case 0x1F:
*status = U_ILLEGAL_CHAR_FOUND;
fprintf(stderr, "Illegal Character \\u%04X! \n",c);
fprintf(stderr, "Illegal Character \\u%04X!\n",(int)c);
uprv_free(dest);
return NULL;
default:
@ -397,7 +397,7 @@ static char* convertAndEscape(char** pDest, int32_t destCap, int32_t* destLength
U8_APPEND((unsigned char*)dest,destLen,destCap,c,isError);
if(isError){
*status = U_ILLEGAL_CHAR_FOUND;
fprintf(stderr, "Illegal Character \\U%08X! \n",c);
fprintf(stderr, "Illegal Character \\U%08X!\n",(int)c);
uprv_free(dest);
return NULL;
}

View file

@ -1,7 +1,7 @@
/*
*******************************************************************************
*
* Copyright (C) 2000-2003, International Business Machines
* Copyright (C) 2000-2004, International Business Machines
* Corporation and others. All Rights Reserved.
*
*******************************************************************************
@ -279,7 +279,7 @@ static uint32_t addToInverse(UCAElements *element, UErrorCode *status) {
addNewInverse(element, status);
} else if(compareCEs(inverseTable[inversePos], element->CEs) > 0) {
while((compResult = compareCEs(inverseTable[--position], element->CEs)) > 0);
if(VERBOSE) { fprintf(stdout, "p:%i ", position); }
if(VERBOSE) { fprintf(stdout, "p:%u ", (int)position); }
if(compResult == 0) {
addToExistingInverse(element, position, status);
} else {
@ -316,9 +316,9 @@ static InverseUCATableHeader *assembleInverseTable(UErrorCode *status)
for(i = 2; i<inversePos; i++) {
if(compareCEs(inverseTable[i-1], inverseTable[i]) > 0) {
fprintf(stderr, "Error at %i: %08X & %08X\n", i, inverseTable[i-1][0], inverseTable[i][0]);
fprintf(stderr, "Error at %i: %08X & %08X\n", (int)i, (int)inverseTable[i-1][0], (int)inverseTable[i][0]);
} else if(inverseTable[i-1][0] == inverseTable[i][0] && !(inverseTable[i-1][1] < inverseTable[i][1])) {
fprintf(stderr, "Continuation error at %i: %08X %08X & %08X %08X\n", i, inverseTable[i-1][0], inverseTable[i-1][1], inverseTable[i][0], inverseTable[i][1]);
fprintf(stderr, "Continuation error at %i: %08X %08X & %08X %08X\n", (int)i, (int)inverseTable[i-1][0], (int)inverseTable[i-1][1], (int)inverseTable[i][0], (int)inverseTable[i][1]);
}
}
@ -870,15 +870,15 @@ struct {
int32_t surrogateCount = 0;
while(!feof(data)) {
if(U_FAILURE(*status)) {
fprintf(stderr, "Something returned an error %i (%s) while processing line %i of %s. Exiting...\n",
*status, u_errorName(*status), line, filename);
fprintf(stderr, "Something returned an error %i (%s) while processing line %u of %s. Exiting...\n",
*status, u_errorName(*status), (int)line, filename);
exit(*status);
}
element = readAnElement(data, t, &consts, status);
line++;
if(VERBOSE) {
fprintf(stdout, "%i ", line);
fprintf(stdout, "%u ", (int)line);
}
if(element != NULL) {
// we have read the line, now do something sensible with the read data!
@ -922,13 +922,13 @@ struct {
}*/
if (VERBOSE) {
fprintf(stdout, "\nLines read: %i\n", line);
fprintf(stdout, "Surrogate count: %i\n", surrogateCount);
fprintf(stdout, "\nLines read: %u\n", (int)line);
fprintf(stdout, "Surrogate count: %i\n", (int)surrogateCount);
fprintf(stdout, "Raw data breakdown:\n");
/*fprintf(stdout, "Compact array stage1 top: %i, stage2 top: %i\n", t->mapping->stage1Top, t->mapping->stage2Top);*/
fprintf(stdout, "Number of contractions: %i\n", noOfContractions);
fprintf(stdout, "Contraction image size: %i\n", t->image->contractionSize);
fprintf(stdout, "Expansions size: %i\n", t->expansions->position);
fprintf(stdout, "Number of contractions: %u\n", (int)noOfContractions);
fprintf(stdout, "Contraction image size: %u\n", (int)t->image->contractionSize);
fprintf(stdout, "Expansions size: %i\n", (int)t->expansions->position);
}
@ -938,7 +938,7 @@ struct {
/* do the closure */
int32_t noOfClosures = uprv_uca_canonicalClosure(t, status);
if(noOfClosures != 0) {
fprintf(stderr, "Warning: %i canonical closures occured!\n", noOfClosures);
fprintf(stderr, "Warning: %i canonical closures occured!\n", (int)noOfClosures);
}
/* test */
@ -947,9 +947,9 @@ struct {
if (VERBOSE) {
fprintf(stdout, "Compacted data breakdown:\n");
/*fprintf(stdout, "Compact array stage1 top: %i, stage2 top: %i\n", t->mapping->stage1Top, t->mapping->stage2Top);*/
fprintf(stdout, "Number of contractions: %i\n", noOfContractions);
fprintf(stdout, "Contraction image size: %i\n", t->image->contractionSize);
fprintf(stdout, "Expansions size: %i\n", t->expansions->position);
fprintf(stdout, "Number of contractions: %u\n", (int)noOfContractions);
fprintf(stdout, "Contraction image size: %u\n", (int)t->image->contractionSize);
fprintf(stdout, "Expansions size: %i\n", (int)t->expansions->position);
}
if(U_FAILURE(*status)) {

View file

@ -1,7 +1,7 @@
/*
*******************************************************************************
*
* Copyright (C) 2003, International Business Machines
* Copyright (C) 2003-2004, International Business Machines
* Corporation and others. All Rights Reserved.
*
*******************************************************************************
@ -830,7 +830,7 @@ addFromUTrieEntry(CnvExtData *extData, UChar32 c, uint32_t value) {
extData->stage1[i1]=(uint16_t)newBlock;
extData->stage2Top=newBlock+MBCS_STAGE_2_BLOCK_SIZE;
if(extData->stage2Top>LENGTHOF(extData->stage2)) {
fprintf(stderr, "error: too many stage 2 entries at U+%04x\n", c);
fprintf(stderr, "error: too many stage 2 entries at U+%04x\n", (int)c);
exit(U_MEMORY_ALLOCATION_ERROR);
}
}
@ -852,7 +852,7 @@ addFromUTrieEntry(CnvExtData *extData, UChar32 c, uint32_t value) {
extData->stage3Top=newBlock+MBCS_STAGE_3_BLOCK_SIZE;
if(extData->stage3Top>LENGTHOF(extData->stage3)) {
fprintf(stderr, "error: too many stage 3 entries at U+%04x\n", c);
fprintf(stderr, "error: too many stage 3 entries at U+%04x\n", (int)c);
exit(U_MEMORY_ALLOCATION_ERROR);
}
}
@ -896,7 +896,7 @@ addFromUTrieEntry(CnvExtData *extData, UChar32 c, uint32_t value) {
}
} else {
if((i3b=extData->stage3bTop++)>=LENGTHOF(extData->stage3b)) {
fprintf(stderr, "error: too many stage 3b entries at U+%04x\n", c);
fprintf(stderr, "error: too many stage 3b entries at U+%04x\n", (int)c);
exit(U_MEMORY_ALLOCATION_ERROR);
}