diff --git a/icu4c/source/tools/toolutil/ucbuf.c b/icu4c/source/tools/toolutil/ucbuf.c index 5c19cef3076..9d6e4415079 100644 --- a/icu4c/source/tools/toolutil/ucbuf.c +++ b/icu4c/source/tools/toolutil/ucbuf.c @@ -407,16 +407,16 @@ ucbuf_getcx32(UCHARBUF* buf,UErrorCode* error) { * to c32 or not */ if(c32==0xFFFFFFFF){ - if(buf->showWarning) { - char context[20]; - int32_t len = 20; - if(length < len) { - len = length; - } - context[len]= 0 ; /* null terminate the buffer */ - u_UCharsToChars( buf->currentPos, context, len); - fprintf(stderr,"Bad escape: [%c%s]...\n", c1,context); - } + if(buf->showWarning) { + char context[20]; + int32_t len = 20; + if(length < len) { + len = length; + } + context[len]= 0 ; /* null terminate the buffer */ + u_UCharsToChars( buf->currentPos, context, len); + fprintf(stderr,"Bad escape: [%c%s]...\n", c1,context); + } *error= U_ILLEGAL_ESCAPE_SEQUENCE; return c1; }else if(c32!=c2 || (c32==0x0075 && c2==0x0075 && c1==0x005C) /* for \u0075 c2=0x0075 and c32==0x0075*/){ diff --git a/icu4c/source/tools/toolutil/ucm.c b/icu4c/source/tools/toolutil/ucm.c index d881b1b87fc..3ccedbb5bcc 100644 --- a/icu4c/source/tools/toolutil/ucm.c +++ b/icu4c/source/tools/toolutil/ucm.c @@ -934,7 +934,7 @@ ucm_addMapping(UCMTable *table, table->mappingsCapacity*sizeof(UCMapping)); if(table->mappings==NULL) { fprintf(stderr, "ucm error: unable to allocate %d UCMappings\n", - table->mappingsCapacity); + (int)table->mappingsCapacity); exit(U_MEMORY_ALLOCATION_ERROR); } @@ -950,7 +950,7 @@ ucm_addMapping(UCMTable *table, table->codePoints=(UChar32 *)uprv_malloc(table->codePointsCapacity*4); if(table->codePoints==NULL) { fprintf(stderr, "ucm error: unable to allocate %d UChar32s\n", - table->codePointsCapacity); + (int)table->codePointsCapacity); exit(U_MEMORY_ALLOCATION_ERROR); } } @@ -960,7 +960,7 @@ ucm_addMapping(UCMTable *table, table->bytes=(uint8_t *)uprv_malloc(table->bytesCapacity); if(table->bytes==NULL) { fprintf(stderr, "ucm error: unable to allocate %d bytes\n", - table->bytesCapacity); + (int)table->bytesCapacity); exit(U_MEMORY_ALLOCATION_ERROR); } } diff --git a/icu4c/source/tools/toolutil/ucmstate.c b/icu4c/source/tools/toolutil/ucmstate.c index a769e1fe23d..5b90297b38e 100644 --- a/icu4c/source/tools/toolutil/ucmstate.c +++ b/icu4c/source/tools/toolutil/ucmstate.c @@ -529,16 +529,16 @@ ucm_processStates(UCMStates *states) { entry=states->stateTable[state][cell]; if((uint8_t)MBCS_ENTRY_STATE(entry)>=states->countStates) { fprintf(stderr, "ucm error: state table entry [%x][%x] has a next state of %x that is too high\n", - state, cell, MBCS_ENTRY_STATE(entry)); + (int)state, (int)cell, (int)MBCS_ENTRY_STATE(entry)); exit(U_INVALID_TABLE_FORMAT); } if(MBCS_ENTRY_IS_FINAL(entry) && (states->stateFlags[MBCS_ENTRY_STATE(entry)]&0xf)!=MBCS_STATE_FLAG_DIRECT) { fprintf(stderr, "ucm error: state table entry [%x][%x] is final but has a non-initial next state of %x\n", - state, cell, MBCS_ENTRY_STATE(entry)); + (int)state, (int)cell, (int)MBCS_ENTRY_STATE(entry)); exit(U_INVALID_TABLE_FORMAT); } else if(MBCS_ENTRY_IS_TRANSITION(entry) && (states->stateFlags[MBCS_ENTRY_STATE(entry)]&0xf)==MBCS_STATE_FLAG_DIRECT) { fprintf(stderr, "ucm error: state table entry [%x][%x] is not final but has an initial next state of %x\n", - state, cell, MBCS_ENTRY_STATE(entry)); + (int)state, (int)cell, (int)MBCS_ENTRY_STATE(entry)); exit(U_INVALID_TABLE_FORMAT); } } @@ -547,11 +547,11 @@ ucm_processStates(UCMStates *states) { /* is this an SI/SO (like EBCDIC-stateful) state table? */ if(states->countStates>=2 && (states->stateFlags[1]&0xf)==MBCS_STATE_FLAG_DIRECT) { if(states->maxCharLength!=2) { - fprintf(stderr, "ucm error: SI/SO codepages must have max 2 bytes/char (not %x)\n", states->maxCharLength); + fprintf(stderr, "ucm error: SI/SO codepages must have max 2 bytes/char (not %x)\n", (int)states->maxCharLength); exit(U_INVALID_TABLE_FORMAT); } if(states->countStates<3) { - fprintf(stderr, "ucm error: SI/SO codepages must have at least 3 states (not %x)\n", states->countStates); + fprintf(stderr, "ucm error: SI/SO codepages must have at least 3 states (not %x)\n", (int)states->countStates); exit(U_INVALID_TABLE_FORMAT); } /* are the SI/SO all in the right places? */ @@ -573,7 +573,7 @@ ucm_processStates(UCMStates *states) { /* check that no unexpected state is a "direct" one */ while(statecountStates) { if((states->stateFlags[state]&0xf)==MBCS_STATE_FLAG_DIRECT) { - fprintf(stderr, "ucm error: state %d is 'initial' - not supported except for SI/SO codepages\n", state); + fprintf(stderr, "ucm error: state %d is 'initial' - not supported except for SI/SO codepages\n", (int)state); exit(U_INVALID_TABLE_FORMAT); } ++state; @@ -1034,7 +1034,7 @@ ucm_countChars(UCMStates *states, * must consist of only double-byte sequences */ if(count>1 && states->outputType==MBCS_OUTPUT_2_SISO && length!=2*count) { - fprintf(stderr, "ucm error: SI/SO (like EBCDIC-stateful) result with %d characters does not contain all DBCS\n", count); + fprintf(stderr, "ucm error: SI/SO (like EBCDIC-stateful) result with %d characters does not contain all DBCS\n", (int)count); return -1; }