From 648e3d7de3e6caf21be6d94a6d5dca94e692e728 Mon Sep 17 00:00:00 2001 From: George Rhoten Date: Mon, 17 May 2004 06:33:22 +0000 Subject: [PATCH] ICU-3500 Fix some compiler warnings X-SVN-Rev: 15331 --- icu4c/source/common/iculserv.cpp | 2 +- icu4c/source/common/uloc.c | 1 - icu4c/source/i18n/ucol_sit.cpp | 65 ++++++++++++------------ icu4c/source/tools/genbrk/genbrk.cpp | 4 +- icu4c/source/tools/gencmn/gencmn.c | 65 ++++++++++++------------ icu4c/source/tools/gencnval/gencnval.c | 4 +- icu4c/source/tools/makeconv/genmbcs.c | 68 +++++++++++++------------- icu4c/source/tools/makeconv/makeconv.c | 6 +-- 8 files changed, 106 insertions(+), 109 deletions(-) diff --git a/icu4c/source/common/iculserv.cpp b/icu4c/source/common/iculserv.cpp index 2beb2b5b4e5..fae096916f4 100644 --- a/icu4c/source/common/iculserv.cpp +++ b/icu4c/source/common/iculserv.cpp @@ -401,7 +401,7 @@ LocaleKeyFactory::updateVisibleIDs(Hashtable& result, UErrorCode& status) const UnicodeString& LocaleKeyFactory::getDisplayName(const UnicodeString& id, const Locale& locale, UnicodeString& result) const { if ((_coverage & 0x1) == 0) { - UErrorCode status = U_ZERO_ERROR; + //UErrorCode status = U_ZERO_ERROR; // assume if this is called on us, we support some fallback of this id // if (isSupportedID(id, status)) { Locale loc; diff --git a/icu4c/source/common/uloc.c b/icu4c/source/common/uloc.c index ff84583bcff..2dfdfddbea2 100644 --- a/icu4c/source/common/uloc.c +++ b/icu4c/source/common/uloc.c @@ -840,7 +840,6 @@ _canonicalize(const char* localeID, UErrorCode* err) { int32_t i, j, len, fieldCount=0, scriptSize=0, variantSize=0, nameCapacity; char localeBuffer[ULOC_FULLNAME_CAPACITY]; - const char* original = localeID; const char* keywordAssign = NULL; const char* separatorIndicator = NULL; const char* addKeyword = NULL; diff --git a/icu4c/source/i18n/ucol_sit.cpp b/icu4c/source/i18n/ucol_sit.cpp index b2ffe3731b2..445be2d607a 100644 --- a/icu4c/source/i18n/ucol_sit.cpp +++ b/icu4c/source/i18n/ucol_sit.cpp @@ -63,7 +63,7 @@ struct CollatorSpec { U_CDECL_BEGIN typedef const char* U_CALLCONV -ActionFunction(CollatorSpec *spec, uint32_t value1, const char* string, +ActionFunction(CollatorSpec *spec, uint32_t value1, const char* string, UErrorCode *status); U_CDECL_END @@ -96,7 +96,7 @@ struct ShortStringOptions { U_CDECL_BEGIN static const char* U_CALLCONV -_processLocaleElement(CollatorSpec *spec, uint32_t value, const char* string, +_processLocaleElement(CollatorSpec *spec, uint32_t value, const char* string, UErrorCode *status) { int32_t len = 0; do { @@ -107,24 +107,24 @@ _processLocaleElement(CollatorSpec *spec, uint32_t value, const char* string, return string; } // skip the underscore at the end - return ++string; + return ++string; } U_CDECL_END U_CDECL_BEGIN static const char* U_CALLCONV -_processRFC3166Locale(CollatorSpec *spec, uint32_t value1, const char* string, +_processRFC3166Locale(CollatorSpec *spec, uint32_t value1, const char* string, UErrorCode *status) { - return string; + return string; } U_CDECL_END U_CDECL_BEGIN static const char* U_CALLCONV -_processCollatorOption(CollatorSpec *spec, uint32_t option, const char* string, +_processCollatorOption(CollatorSpec *spec, uint32_t option, const char* string, UErrorCode *status) { int32_t i = 0; - for(i = 0; i < sizeof(conversions)/sizeof(conversions[0]); i++) { + for(i = 0; i < (int32_t)(sizeof(conversions)/sizeof(conversions[0])); i++) { if(*string == conversions[i].letter) { spec->options[option] = conversions[i].value; if(*(++string) != '_' && *string) { @@ -140,7 +140,7 @@ _processCollatorOption(CollatorSpec *spec, uint32_t option, const char* string, U_CDECL_END -static UChar +static UChar readHexCodeUnit(const char **string, UErrorCode *status) { UChar result = 0; int32_t value = 0; @@ -160,7 +160,7 @@ readHexCodeUnit(const char **string, UErrorCode *status) { result = (result << 4) | value; (*string)++; } - + } U_CDECL_BEGIN @@ -171,7 +171,7 @@ _processVariableTop(CollatorSpec *spec, uint32_t value1, const char* string, UEr } U_CDECL_END -static ShortStringOptions options[UCOL_SIT_ITEMS_COUNT] = +static ShortStringOptions options[UCOL_SIT_ITEMS_COUNT] = { /* 00 UCOL_SIT_LANGUAGE */ { 'L', _processLocaleElement, 0 }, // language /* 01 UCOL_SIT_SCRIPT */ { 'Z', _processLocaleElement, 1 }, // script @@ -183,7 +183,7 @@ static ShortStringOptions options[UCOL_SIT_ITEMS_COUNT] = /* 07 UCOL_SIT_CASE_LEVEL */ { 'E', _processCollatorOption, UCOL_CASE_LEVEL }, // case level O, X, D /* 08 UCOL_SIT_CASE_FIRST */ { 'C', _processCollatorOption, UCOL_CASE_FIRST }, // case first L, U, X, D /* 09 UCOL_SIT_NUMERIC_COLLATION */ { 'D', _processCollatorOption, UCOL_NUMERIC_COLLATION }, // codan O, X, D -/* 10 UCOL_SIT_ALTERNATE_HANDLING */ { 'A', _processCollatorOption, UCOL_ALTERNATE_HANDLING }, // alternate N, S, D +/* 10 UCOL_SIT_ALTERNATE_HANDLING */ { 'A', _processCollatorOption, UCOL_ALTERNATE_HANDLING }, // alternate N, S, D /* 11 UCOL_SIT_NORMALIZATION_MODE */ { 'N', _processCollatorOption, UCOL_NORMALIZATION_MODE }, // norm O, X, D /* 12 UCOL_SIT_FRENCH_COLLATION */ { 'F', _processCollatorOption, UCOL_FRENCH_COLLATION }, // french O, X, D /* 13 UCOL_SIT_HIRAGANA_QUATERNARY] */ { 'H', _processCollatorOption, UCOL_HIRAGANA_QUATERNARY_MODE }, // hiragana O, X, D @@ -192,10 +192,9 @@ static ShortStringOptions options[UCOL_SIT_ITEMS_COUNT] = static -const char* ucol_sit_readOption(const char *start, CollatorSpec *spec, +const char* ucol_sit_readOption(const char *start, CollatorSpec *spec, UErrorCode *status) { - int32_t i = 0, j = 0, k = 0; - uint32_t value = 0; + int32_t i = 0; for(i = 0; i < UCOL_SIT_ITEMS_COUNT; i++) { if(*start == options[i].optionStart) { @@ -217,25 +216,25 @@ void ucol_sit_initCollatorSpecs(CollatorSpec *spec) { } } -/** +/** * Open a collator defined by a short form string. * The structure and the syntax of the string is defined in the "Naming collators" - * section of the users guide: + * section of the users guide: * http://oss.software.ibm.com/icu/userguide/Collate_Concepts.html#Naming_Collators - * The call to this function is equivalent to a call to ucol_open, followed by a + * The call to this function is equivalent to a call to ucol_open, followed by a * series of calls to ucol_setAttribute and ucol_setVariableTop. * Attributes are overriden by the subsequent attributes. So, for "S2_S3", final - * strength will be 3. 3066bis locale overrides individual locale parts. - * @param definition A short string containing a locale and a set of attributes. + * strength will be 3. 3066bis locale overrides individual locale parts. + * @param definition A short string containing a locale and a set of attributes. * Attributes not explicitly mentioned are left at the default * state for a locale. * @param parseError if not NULL, structure that will get filled with error's pre * and post context in case of error. - * @param status Error code. Apart from regular error conditions connected to + * @param status Error code. Apart from regular error conditions connected to * instantiating collators (like out of memory or similar), this * API will return an error if an invalid attribute or attribute/value * combination is specified. - * @return A pointer to a UCollator or 0 if an error occured (including an + * @return A pointer to a UCollator or 0 if an error occured (including an * invalid attribute). * @see ucol_open * @see ucol_setAttribute @@ -266,7 +265,7 @@ ucol_openFromShortString( const char *definition, while(U_SUCCESS(*status) && string < definitionEnd) { string = ucol_sit_readOption(string, &s, status); } - + if(U_FAILURE(*status)) { parseError->line = 0; parseError->offset = string - definition; @@ -274,7 +273,7 @@ ucol_openFromShortString( const char *definition, parseError->preContext[0] = 0; parseError->postContext[0] = 0; } - + // put the locale together, unless we have a done // locale int32_t i = 0; @@ -292,9 +291,9 @@ ucol_openFromShortString( const char *definition, uprv_strcat(s.locale, s.locElements[2]); } else if(*(s.locElements[3])) { // if there is a variant, we need an underscore uprv_strcat(s.locale, "_"); - } + } // add variant, if there - if(*(s.locElements[3])) { + if(*(s.locElements[3])) { uprv_strcat(s.locale, "_"); uprv_strcat(s.locale, s.locElements[3]); } @@ -319,7 +318,7 @@ ucol_openFromShortString( const char *definition, ucol_close(result); result = NULL; } - + UTRACE_EXIT_PTR_STATUS(result, *status); return result; } @@ -370,7 +369,7 @@ _processContractions(const void *context, UChar32 start, UChar32 limit, uint32_t UErrorCode status = U_ZERO_ERROR; USet *unsafe = (USet *)context; UChar contraction[256]; - if(value > UCOL_NOT_FOUND && getCETag(value) == CONTRACTION_TAG) { + if(value > UCOL_NOT_FOUND && getCETag(value) == CONTRACTION_TAG) { // this is a contraction // we want to add the code point for sure while(start < limit) { @@ -379,13 +378,13 @@ _processContractions(const void *context, UChar32 start, UChar32 limit, uint32_t // get the rest of the contraction string from the data structure start++; } - // check if there is anything else to add - if these lead + // check if there is anything else to add - if these lead // to a longer contraction } if(U_FAILURE(status)) { - return FALSE; + return FALSE; } else { - return TRUE; + return TRUE; } } U_CDECL_END @@ -436,7 +435,7 @@ ucol_getUnsafeSet( const UCollator *coll, fcd = unorm_getFCD16FromSurrogatePair(fcdTrieIndex, U16_LEAD(c), U16_TRAIL(c)); if (fcd != 0) { uset_add(unsafe, c); - } + } } } } @@ -450,7 +449,7 @@ ucol_getUnsafeSet( const UCollator *coll, /** * Get a set containing the contractions defined by the collator. The set includes * both the UCA contractions and the contractions defined by the collator - * @param coll collator + * @param coll collator * @param conts the set to hold the result * @param status to hold the error code * @return the size of the contraction set @@ -460,7 +459,7 @@ ucol_getUnsafeSet( const UCollator *coll, U_CAPI int32_t U_EXPORT2 ucol_getContractions( const UCollator *coll, USet *contractions, - UErrorCode *status) + UErrorCode *status) { // add contractions from the UCA int32_t width = coll->UCA->image->contractionUCACombosWidth; diff --git a/icu4c/source/tools/genbrk/genbrk.cpp b/icu4c/source/tools/genbrk/genbrk.cpp index 617c20e1e4e..deb930222fd 100644 --- a/icu4c/source/tools/genbrk/genbrk.cpp +++ b/icu4c/source/tools/genbrk/genbrk.cpp @@ -1,6 +1,6 @@ /* ********************************************************************** -* Copyright (C) 2002-2003, International Business Machines +* Copyright (C) 2002-2004, International Business Machines * Corporation and others. All Rights Reserved. ********************************************************************** * @@ -306,7 +306,7 @@ int main(int argc, char **argv) { RuleBasedBreakIterator *bi = new RuleBasedBreakIterator(ruleSourceS, parseError, status); if (U_FAILURE(status)) { fprintf(stderr, "createRuleBasedBreakIterator: ICU Error \"%s\" at line %d, column %d\n", - u_errorName(status), parseError.line, parseError.offset); + u_errorName(status), (int)parseError.line, (int)parseError.offset); exit(status); }; diff --git a/icu4c/source/tools/gencmn/gencmn.c b/icu4c/source/tools/gencmn/gencmn.c index ca1dc177f4e..610877d3f22 100644 --- a/icu4c/source/tools/gencmn/gencmn.c +++ b/icu4c/source/tools/gencmn/gencmn.c @@ -1,7 +1,7 @@ /* ******************************************************************************* * -* Copyright (C) 1999-2003, International Business Machines +* Copyright (C) 1999-2004, International Business Machines * Corporation and others. All Rights Reserved. * ******************************************************************************* @@ -486,24 +486,23 @@ addFile(const char *filename, UBool sourceTOC, UBool verbose) { if(!sourceTOC) { FileStream *file; - char *fullPath; fullPath = pathToFullPath(filename); /* store the pathname */ if(!embed) { - length = (uint32_t)(uprv_strlen(filename) + 1 + uprv_strlen(options[6].value) + 1); - s=allocString(length); - uprv_strcpy(s, options[6].value); - uprv_strcat(s, U_TREE_ENTRY_SEP_STRING); - uprv_strcat(s, filename); + length = (uint32_t)(uprv_strlen(filename) + 1 + uprv_strlen(options[6].value) + 1); + s=allocString(length); + uprv_strcpy(s, options[6].value); + uprv_strcat(s, U_TREE_ENTRY_SEP_STRING); + uprv_strcat(s, filename); } else { - /* compatibility mode */ - const char *base; - base = findBasename(filename); - length = (uint32_t)(uprv_strlen(base) + 1); - s=allocString(length); - uprv_memcpy(s, base, length); + /* compatibility mode */ + const char *base; + base = findBasename(filename); + length = (uint32_t)(uprv_strlen(base) + 1); + s=allocString(length); + uprv_memcpy(s, base, length); } /* get the basename */ @@ -543,20 +542,20 @@ addFile(const char *filename, UBool sourceTOC, UBool verbose) { char *t; if(embed) { - filename = findBasename(filename); + filename = findBasename(filename); } /* get and store the basename */ if(!embed) { - /* need to include the package name */ - length = (uint32_t)(uprv_strlen(filename) + 1 + uprv_strlen(options[6].value) + 1); - s=allocString(length); - uprv_strcpy(s, options[6].value); - uprv_strcat(s, U_TREE_ENTRY_SEP_STRING); - uprv_strcat(s, filename); + /* need to include the package name */ + length = (uint32_t)(uprv_strlen(filename) + 1 + uprv_strlen(options[6].value) + 1); + s=allocString(length); + uprv_strcpy(s, options[6].value); + uprv_strcat(s, U_TREE_ENTRY_SEP_STRING); + uprv_strcat(s, filename); } else { - length = (uint32_t)(uprv_strlen(filename) + 1); - s=allocString(length); - uprv_memcpy(s, filename, length); + length = (uint32_t)(uprv_strlen(filename) + 1); + s=allocString(length); + uprv_memcpy(s, filename, length); } fixDirToTreePath(s); files[fileCount].basename=s; @@ -643,18 +642,18 @@ compareFiles(const void *file1, const void *file2) { static void fixDirToTreePath(char *s) { - char *t; +#if (U_FILE_SEP_CHAR != U_TREE_ENTRY_SEP_CHAR) || ((U_FILE_ALT_SEP_CHAR != U_FILE_SEP_CHAR) && (U_FILE_ALT_SEP_CHAR != U_TREE_ENTRY_SEP_CHAR)) + char *t; +#endif #if (U_FILE_SEP_CHAR != U_TREE_ENTRY_SEP_CHAR) - for(t=s;t=uprv_strchr(t,U_FILE_SEP_CHAR);) { - *t = U_TREE_ENTRY_SEP_CHAR; - } -#endif -#if (U_FILE_ALT_SEP_CHAR != U_FILE_SEP_CHAR) -#if (U_FILE_ALT_SEP_CHAR != U_TREE_ENTRY_SEP_CHAR) - for(t=s;t=uprv_strchr(t,U_FILE_ALT_SEP_CHAR);) { - *t = U_TREE_ENTRY_SEP_CHAR; - } + for(t=s;t=uprv_strchr(t,U_FILE_SEP_CHAR);) { + *t = U_TREE_ENTRY_SEP_CHAR; + } #endif +#if (U_FILE_ALT_SEP_CHAR != U_FILE_SEP_CHAR) && (U_FILE_ALT_SEP_CHAR != U_TREE_ENTRY_SEP_CHAR) + for(t=s;t=uprv_strchr(t,U_FILE_ALT_SEP_CHAR);) { + *t = U_TREE_ENTRY_SEP_CHAR; + } #endif } /* diff --git a/icu4c/source/tools/gencnval/gencnval.c b/icu4c/source/tools/gencnval/gencnval.c index 312b3eb00f0..4c2663e037b 100644 --- a/icu4c/source/tools/gencnval/gencnval.c +++ b/icu4c/source/tools/gencnval/gencnval.c @@ -1,7 +1,7 @@ /* ******************************************************************************* * -* Copyright (C) 1999-2003, International Business Machines +* Copyright (C) 1999-2004, International Business Machines * Corporation and others. All Rights Reserved. * ******************************************************************************* @@ -134,7 +134,7 @@ static uint16_t aliasListsSize = 0; /* Were the standard tags declared before the aliases. */ static UBool standardTagsUsed = FALSE; static UBool verbose = FALSE; -static int32_t lineNum = 1; +static int lineNum = 1; /* prototypes --------------------------------------------------------------- */ diff --git a/icu4c/source/tools/makeconv/genmbcs.c b/icu4c/source/tools/makeconv/genmbcs.c index 4f885c00ceb..41d0101169d 100644 --- a/icu4c/source/tools/makeconv/genmbcs.c +++ b/icu4c/source/tools/makeconv/genmbcs.c @@ -1,7 +1,7 @@ /* ******************************************************************************* * -* Copyright (C) 2000-2003, International Business Machines +* Copyright (C) 2000-2004, International Business Machines * Corporation and others. All Rights Reserved. * ******************************************************************************* @@ -201,7 +201,7 @@ setFallback(MBCSData *mbcsData, uint32_t offset, UChar32 c) { /* if there is no fallback for this offset, then add one */ i=mbcsData->countToUFallbacks; if(i>=MBCS_MAX_FALLBACK_COUNT) { - fprintf(stderr, "error: too many toUnicode fallbacks, currently at: U+%x\n", c); + fprintf(stderr, "error: too many toUnicode fallbacks, currently at: U+%x\n", (int)c); return FALSE; } else { mbcsData->toUFallbacks[i].offset=offset; @@ -270,7 +270,7 @@ MBCSAddToUnicode(MBCSData *mbcsData, if(MBCS_ENTRY_IS_TRANSITION(entry)) { if(i==length) { fprintf(stderr, "error: byte sequence too short, ends in non-final state %hu: 0x%s (U+%x)\n", - state, printBytes(buffer, bytes, length), c); + (short)state, printBytes(buffer, bytes, length), (int)c); return FALSE; } state=(uint8_t)MBCS_ENTRY_TRANSITION_STATE(entry); @@ -278,21 +278,21 @@ MBCSAddToUnicode(MBCSData *mbcsData, } else { if(i0x%s\n", - c, printBytes(buffer, bytes, length)); + (int)c, printBytes(buffer, bytes, length)); return FALSE; case MBCS_STATE_CHANGE_ONLY: fprintf(stderr, "error: byte sequence ends in state-change-only at U+%04x<->0x%s\n", - c, printBytes(buffer, bytes, length)); + (int)c, printBytes(buffer, bytes, length)); return FALSE; case MBCS_STATE_UNASSIGNED: fprintf(stderr, "error: byte sequence ends in unassigned state at U+%04x<->0x%s\n", - c, printBytes(buffer, bytes, length)); + (int)c, printBytes(buffer, bytes, length)); return FALSE; case MBCS_STATE_FALLBACK_DIRECT_16: case MBCS_STATE_VALID_DIRECT_16: @@ -306,12 +306,12 @@ MBCSAddToUnicode(MBCSData *mbcsData, old=0x10000+MBCS_ENTRY_FINAL_VALUE(entry); } if(flag>=0) { - fprintf(stderr, "error: duplicate codepage byte sequence at U+%04x<->0x%s see U+%04lx\n", - c, printBytes(buffer, bytes, length), (long)old); + fprintf(stderr, "error: duplicate codepage byte sequence at U+%04x<->0x%s see U+%04x\n", + (int)c, printBytes(buffer, bytes, length), (int)old); return FALSE; } else if(VERBOSE) { - fprintf(stderr, "duplicate codepage byte sequence at U+%04x<->0x%s see U+%04lx\n", - c, printBytes(buffer, bytes, length), (long)old); + fprintf(stderr, "duplicate codepage byte sequence at U+%04x<->0x%s see U+%04x\n", + (int)c, printBytes(buffer, bytes, length), (int)old); } /* * Continue after the above warning @@ -336,17 +336,17 @@ MBCSAddToUnicode(MBCSData *mbcsData, /* check that this byte sequence is still unassigned */ if((old=mbcsData->unicodeCodeUnits[offset])!=0xfffe || (old=removeFallback(mbcsData, offset))!=-1) { if(flag>=0) { - fprintf(stderr, "error: duplicate codepage byte sequence at U+%04x<->0x%s see U+%04lx\n", - c, printBytes(buffer, bytes, length), (long)old); + fprintf(stderr, "error: duplicate codepage byte sequence at U+%04x<->0x%s see U+%04x\n", + (int)c, printBytes(buffer, bytes, length), (int)old); return FALSE; } else if(VERBOSE) { - fprintf(stderr, "duplicate codepage byte sequence at U+%04x<->0x%s see U+%04lx\n", - c, printBytes(buffer, bytes, length), (long)old); + fprintf(stderr, "duplicate codepage byte sequence at U+%04x<->0x%s see U+%04x\n", + (int)c, printBytes(buffer, bytes, length), (int)old); } } if(c>=0x10000) { fprintf(stderr, "error: code point does not fit into valid-16-bit state at U+%04x<->0x%s\n", - c, printBytes(buffer, bytes, length)); + (int)c, printBytes(buffer, bytes, length)); return FALSE; } if(flag>0) { @@ -374,12 +374,12 @@ MBCSAddToUnicode(MBCSData *mbcsData, real=mbcsData->unicodeCodeUnits[offset+1]; } if(flag>=0) { - fprintf(stderr, "error: duplicate codepage byte sequence at U+%04x<->0x%s see U+%04lx\n", - c, printBytes(buffer, bytes, length), (long)real); + fprintf(stderr, "error: duplicate codepage byte sequence at U+%04x<->0x%s see U+%04x\n", + (int)c, printBytes(buffer, bytes, length), (int)real); return FALSE; } else if(VERBOSE) { - fprintf(stderr, "duplicate codepage byte sequence at U+%04x<->0x%s see U+%04lx\n", - c, printBytes(buffer, bytes, length), (long)real); + fprintf(stderr, "duplicate codepage byte sequence at U+%04x<->0x%s see U+%04x\n", + (int)c, printBytes(buffer, bytes, length), (int)real); } } if(flag>0) { @@ -412,8 +412,8 @@ MBCSAddToUnicode(MBCSData *mbcsData, break; default: /* reserved, must never occur */ - fprintf(stderr, "internal error: byte sequence reached reserved action code, entry 0x%02lx: 0x%s (U+%x)\n", - (unsigned long)entry, printBytes(buffer, bytes, length), c); + fprintf(stderr, "internal error: byte sequence reached reserved action code, entry 0x%02x: 0x%s (U+%x)\n", + (int)entry, printBytes(buffer, bytes, length), (int)c); return FALSE; } @@ -459,7 +459,7 @@ MBCSSingleAddFromUnicode(MBCSData *mbcsData, if(mbcsData->stage1[index]==MBCS_STAGE_2_ALL_UNASSIGNED_INDEX) { /* allocate another block in stage 2 */ if(mbcsData->stage2Top>=MBCS_MAX_STAGE_2_TOP) { - fprintf(stderr, "error: too many stage 2 entries at U+%04x<->0x%02x\n", c, b); + fprintf(stderr, "error: too many stage 2 entries at U+%04x<->0x%02x\n", (int)c, b); return FALSE; } @@ -476,7 +476,7 @@ MBCSSingleAddFromUnicode(MBCSData *mbcsData, if(mbcsData->stage2Single[index]==0) { /* allocate another block in stage 3 */ if(mbcsData->stage3Top>=0x10000) { - fprintf(stderr, "error: too many code points at U+%04x<->0x%02x\n", c, b); + fprintf(stderr, "error: too many code points at U+%04x<->0x%02x\n", (int)c, b); return FALSE; } /* each block has 16 uint16_t entries */ @@ -500,11 +500,11 @@ MBCSSingleAddFromUnicode(MBCSData *mbcsData, if(old>=0x100) { if(flag>=0) { fprintf(stderr, "error: duplicate Unicode code point at U+%04x<->0x%02x see 0x%02x\n", - c, b, old&0xff); + (int)c, b, old&0xff); return FALSE; } else if(VERBOSE) { fprintf(stderr, "duplicate Unicode code point at U+%04x<->0x%02x see 0x%02x\n", - c, b, old&0xff); + (int)c, b, old&0xff); } /* continue after the above warning if the precision of the mapping is unspecified */ } @@ -538,13 +538,13 @@ MBCSAddFromUnicode(MBCSData *mbcsData, (*bytes==0xe || *bytes==0xf) ) { fprintf(stderr, "error: illegal mapping to SI or SO for SI/SO codepage: U+%04x<->0x%s\n", - c, printBytes(buffer, bytes, length)); + (int)c, printBytes(buffer, bytes, length)); return FALSE; } if(flag==1 && length==1 && *bytes==0) { fprintf(stderr, "error: unable to encode a |1 fallback from U+%04x to 0x%02x\n", - c, *bytes); + (int)c, *bytes); return FALSE; } @@ -562,7 +562,7 @@ MBCSAddFromUnicode(MBCSData *mbcsData, /* allocate another block in stage 2 */ if(mbcsData->stage2Top>=MBCS_MAX_STAGE_2_TOP) { fprintf(stderr, "error: too many stage 2 entries at U+%04x<->0x%s\n", - c, printBytes(buffer, bytes, length)); + (int)c, printBytes(buffer, bytes, length)); return FALSE; } @@ -580,7 +580,7 @@ MBCSAddFromUnicode(MBCSData *mbcsData, /* allocate another block in stage 3 */ if(mbcsData->stage3Top>=0x100000*(uint32_t)maxCharLength) { fprintf(stderr, "error: too many code points at U+%04x<->0x%s\n", - c, printBytes(buffer, bytes, length)); + (int)c, printBytes(buffer, bytes, length)); return FALSE; } /* each block has 16*maxCharLength bytes */ @@ -634,12 +634,12 @@ MBCSAddFromUnicode(MBCSData *mbcsData, /* check that this Unicode code point was still unassigned */ if((mbcsData->stage2[index]&(1UL<<(16+(c&0xf))))!=0 || old!=0) { if(flag>=0) { - fprintf(stderr, "error: duplicate Unicode code point at U+%04x<->0x%s see 0x%02lx\n", - c, printBytes(buffer, bytes, length), (unsigned long)old); + fprintf(stderr, "error: duplicate Unicode code point at U+%04x<->0x%s see 0x%02x\n", + (int)c, printBytes(buffer, bytes, length), (int)old); return FALSE; } else if(VERBOSE) { - fprintf(stderr, "duplicate Unicode code point at U+%04x<->0x%s see 0x%02lx\n", - c, printBytes(buffer, bytes, length), (unsigned long)old); + fprintf(stderr, "duplicate Unicode code point at U+%04x<->0x%s see 0x%02x\n", + (int)c, printBytes(buffer, bytes, length), (int)old); } /* continue after the above warning if the precision of the mapping is unspecified */ diff --git a/icu4c/source/tools/makeconv/makeconv.c b/icu4c/source/tools/makeconv/makeconv.c index c38232c13a3..315d2a6dbfb 100644 --- a/icu4c/source/tools/makeconv/makeconv.c +++ b/icu4c/source/tools/makeconv/makeconv.c @@ -1,7 +1,7 @@ /* ******************************************************************************** * - * Copyright (C) 1998-2003, International Business Machines + * Copyright (C) 1998-2004, International Business Machines * Corporation and others. All Rights Reserved. * ******************************************************************************** @@ -155,12 +155,12 @@ writeConverterData(ConvData *data, const char *cnvName, const char *cnvDir, UErr sz2 = udata_finish(mem, status); if(size != sz2) { - fprintf(stderr, "error: wrote %d bytes to the .cnv file but counted %d bytes\n", sz2, size); + fprintf(stderr, "error: wrote %u bytes to the .cnv file but counted %u bytes\n", (int)sz2, (int)size); *status=U_INTERNAL_PROGRAM_ERROR; } if(VERBOSE) { - fprintf(stderr, "- Wrote %d bytes to the udata.\n", sz2); + fprintf(stderr, "- Wrote %u bytes to the udata.\n", (int)sz2); } }