diff --git a/icu4c/source/tools/makeconv/genmbcs.c b/icu4c/source/tools/makeconv/genmbcs.c index 48a73cfda3..4ff5c80914 100644 --- a/icu4c/source/tools/makeconv/genmbcs.c +++ b/icu4c/source/tools/makeconv/genmbcs.c @@ -1315,7 +1315,7 @@ compactToUnicodeHelper(MBCSData *mbcsData) { static UBool transformEUC(MBCSData *mbcsData) { - uint8_t *p, *q; + uint8_t *p8; uint32_t i, value, oldLength=mbcsData->maxCharLength, old3Top=mbcsData->stage3Top, new3Top; uint8_t b; @@ -1326,19 +1326,23 @@ transformEUC(MBCSData *mbcsData) { /* careful: 2-byte and 4-byte codes are stored in platform endianness! */ /* test if all first bytes are in {0, 0x8e, 0x8f} */ - p=mbcsData->fromUBytes; - if(!U_IS_BIG_ENDIAN && oldLength==4) { - p+=3; + p8=mbcsData->fromUBytes; + +#if !U_IS_BIG_ENDIAN + if(oldLength==4) { + p8+=3; } +#endif + for(i=0; ifromUBytes; + p8=mbcsData->fromUBytes; /* modify outputType and adjust stage3Top */ mbcsData->header.flags=MBCS_OUTPUT_3_EUC+oldLength-3; @@ -1352,42 +1356,43 @@ transformEUC(MBCSData *mbcsData) { * This also must reverse the byte order if the platform is little-endian! */ if(oldLength==3) { - q=p; + uint16_t *q=(uint16_t *)p8; for(i=0; i>16); - *q++=(uint8_t)(value>>8); - *q++=(uint8_t)value; + (*q++)=(uint8_t)(value>>16); + (*q++)=(uint8_t)(value>>8); + (*q++)=(uint8_t)value; } else if(value<=0x8effffff) { /* code set 2 */ - *q++=(uint8_t)((value>>16)&0x7f); - *q++=(uint8_t)(value>>8); - *q++=(uint8_t)value; + (*q++)=(uint8_t)((value>>16)&0x7f); + (*q++)=(uint8_t)(value>>8); + (*q++)=(uint8_t)value; } else /* first byte is 0x8f */ { /* code set 3 */ - *q++=(uint8_t)(value>>16); - *q++=(uint8_t)((value>>8)&0x7f); - *q++=(uint8_t)value; + (*q++)=(uint8_t)(value>>16); + (*q++)=(uint8_t)((value>>8)&0x7f); + (*q++)=(uint8_t)value; } } }