From d566c2f4983d10b701bec6b4a7f1216d680a3e12 Mon Sep 17 00:00:00 2001 From: Michael Ow Date: Wed, 3 Mar 2010 18:09:22 +0000 Subject: [PATCH] ICU-7138 Fix casting and update docs in ucmfiles.mk. X-SVN-Rev: 27768 --- icu4c/source/common/ucnvmbcs.c | 33 ++++++++++++++------------ icu4c/source/data/mappings/ucmfiles.mk | 8 +++++-- 2 files changed, 24 insertions(+), 17 deletions(-) diff --git a/icu4c/source/common/ucnvmbcs.c b/icu4c/source/common/ucnvmbcs.c index 25927a268c0..cf269adf9da 100644 --- a/icu4c/source/common/ucnvmbcs.c +++ b/icu4c/source/common/ucnvmbcs.c @@ -1794,11 +1794,14 @@ ucnv_MBCSOpen(UConverter *cnv, /* set a flag for GB 18030 mode, which changes the callback behavior */ cnv->options|=_MBCS_OPTION_GB18030; } - } else if(uprv_strstr(pArgs->name, "KEIS")!=NULL) { + } else if((uprv_strstr(pArgs->name, "KEIS")!=NULL) || (uprv_strstr(pArgs->name, "keis")!=NULL)) { + /* set a flag for KEIS converter, which changes the SI/SO character sequence */ cnv->options|=_MBCS_OPTION_KEIS; - } else if(uprv_strstr(pArgs->name, "JEF")!=NULL) { + } else if((uprv_strstr(pArgs->name, "JEF")!=NULL) || (uprv_strstr(pArgs->name, "jef")!=NULL)) { + /* set a flag for JEF converter, which changes the SI/SO character sequence */ cnv->options|=_MBCS_OPTION_JEF; - } else if(uprv_strstr(pArgs->name, "JIPS")!=NULL) { + } else if((uprv_strstr(pArgs->name, "JIPS")!=NULL) || (uprv_strstr(pArgs->name, "jips")!=NULL)) { + /* set a flag for JIPS converter, which changes the SI/SO character sequence */ cnv->options|=_MBCS_OPTION_JIPS; } @@ -4101,11 +4104,11 @@ ucnv_MBCSFromUnicodeWithOffsets(UConverterFromUnicodeArgs *pArgs, } else { /* change from double-byte mode to single-byte */ if (si_value_length == 1) { - value|=si_value[0]<<8; + value|=(uint32_t)si_value[0]<<8; length = 2; } else if (si_value_length == 2) { - value|=si_value[1]<<8; - value|=si_value[0]<<16; + value|=(uint32_t)si_value[1]<<8; + value|=(uint32_t)si_value[0]<<16; length = 3; } prevLength=1; @@ -4116,11 +4119,11 @@ ucnv_MBCSFromUnicodeWithOffsets(UConverterFromUnicodeArgs *pArgs, } else { /* change from single-byte mode to double-byte */ if (so_value_length == 1) { - value|=so_value[0]<<16; + value|=(uint32_t)so_value[0]<<16; length = 3; } else if (so_value_length == 2) { - value|=so_value[1]<<16; - value|=so_value[0]<<24; + value|=(uint32_t)so_value[1]<<16; + value|=(uint32_t)so_value[0]<<24; length = 4; } prevLength=2; @@ -4333,11 +4336,11 @@ getTrail: } else { /* change from double-byte mode to single-byte */ if (si_value_length == 1) { - value|=si_value[0]<<8; + value|=(uint32_t)si_value[0]<<8; length = 2; } else if (si_value_length == 2) { - value|=si_value[1]<<8; - value|=si_value[0]<<16; + value|=(uint32_t)si_value[1]<<8; + value|=(uint32_t)si_value[0]<<16; length = 3; } prevLength=1; @@ -4348,11 +4351,11 @@ getTrail: } else { /* change from single-byte mode to double-byte */ if (so_value_length == 1) { - value|=so_value[0]<<16; + value|=(uint32_t)so_value[0]<<16; length = 3; } else if (so_value_length == 2) { - value|=so_value[1]<<16; - value|=so_value[0]<<24; + value|=(uint32_t)so_value[1]<<16; + value|=(uint32_t)so_value[0]<<24; length = 4; } prevLength=2; diff --git a/icu4c/source/data/mappings/ucmfiles.mk b/icu4c/source/data/mappings/ucmfiles.mk index 8e5454399ba..1f4492f17a4 100644 --- a/icu4c/source/data/mappings/ucmfiles.mk +++ b/icu4c/source/data/mappings/ucmfiles.mk @@ -16,9 +16,13 @@ # _____________________________________________________ # | UCM_SOURCE_LOCAL = myconverter.ucm ... # -# * To add EBCDIC coverters that use different SI/SO characters: +# * To add EBCDIC converters that uses different SI/SO characters: +# Note: ICU is updated to handle three EBCDIC converters (JIPS, KEIS, and JEF) which uses +# different SI/SO characters than the "standard" ones: 0xf/0xe. +# This behaviour is done in the mbcs converter code and is turned on if for that converter +# if the name contains either JIPS, KEIS, or JEF. (e.g. my_KEIS_converter.ucm) # _____________________________________________________ -# | UCM_SOURCE_EBCDIC_IGNORE_SISO_LOCAL = my_keis_converter.ucm +# | UCM_SOURCE_EBCDIC_IGNORE_SISO_LOCAL = my_KEIS_converter.ucm # # * To REPLACE the default list and only build with a few # converters: