ICU-6143 Fix spacing issues to improve readability.
X-SVN-Rev: 23751
This commit is contained in:
parent
727a414363
commit
ed1c32ed62
@ -4921,7 +4921,8 @@ class CharsetMBCS extends CharsetICU {
|
||||
case UCNV_SET_FILTER_DBCS_ONLY:
|
||||
/* Ignore single bytes results (<0x100). */
|
||||
do {
|
||||
if(((st3&1) != 0 || useFallBack) && (UConverterConstants.UNSIGNED_SHORT_MASK & (ByteBuffer.wrap(bytes).getChar(stage3))) >= 0x100){
|
||||
if(((st3&1) != 0 || useFallBack) &&
|
||||
(UConverterConstants.UNSIGNED_SHORT_MASK & (ByteBuffer.wrap(bytes).getChar(stage3))) >= 0x100){
|
||||
setFillIn.add(c);
|
||||
}
|
||||
st3>>=1;
|
||||
@ -4931,8 +4932,8 @@ class CharsetMBCS extends CharsetICU {
|
||||
case UCNV_SET_FILTER_2022_CN :
|
||||
/* only add code points that map to CNS 11643 planes 1&2 for non-EXT ISO-2202-CN. */
|
||||
do {
|
||||
if(((st3&1) != 0 || useFallBack) && ((value= (UConverterConstants.UNSIGNED_BYTE_MASK & (ByteBuffer.wrap(bytes).get(stage3))))==0x81
|
||||
|| value==0x82) ){
|
||||
if(((st3&1) != 0 || useFallBack) &&
|
||||
((value= (UConverterConstants.UNSIGNED_BYTE_MASK & (ByteBuffer.wrap(bytes).get(stage3))))==0x81 || value==0x82) ){
|
||||
setFillIn.add(c);
|
||||
}
|
||||
st3>>=1;
|
||||
@ -4953,8 +4954,9 @@ class CharsetMBCS extends CharsetICU {
|
||||
case UCNV_SET_FILTER_GR94DBCS:
|
||||
/* only add code points that maps to ISO 2022 GR 94 DBCS codes*/
|
||||
do {
|
||||
if(((st3&1) != 0 || useFallBack) && (UConverterConstants.UNSIGNED_SHORT_MASK & ((value=(UConverterConstants.UNSIGNED_SHORT_MASK & (ByteBuffer.wrap(bytes).getChar(stage3))))- 0xa1a1))<=(0xfefe - 0xa1a1) &&
|
||||
( UConverterConstants.UNSIGNED_BYTE_MASK & (value - 0xa1)) <= (0xfe - 0xa1)){
|
||||
if(((st3&1) != 0 || useFallBack) &&
|
||||
(UConverterConstants.UNSIGNED_SHORT_MASK & ((value=(UConverterConstants.UNSIGNED_SHORT_MASK & (ByteBuffer.wrap(bytes).getChar(stage3))))- 0xa1a1))<=(0xfefe - 0xa1a1) &&
|
||||
(UConverterConstants.UNSIGNED_BYTE_MASK & (value - 0xa1)) <= (0xfe - 0xa1)){
|
||||
setFillIn.add(c);
|
||||
}
|
||||
st3>>=1;
|
||||
@ -4964,7 +4966,8 @@ class CharsetMBCS extends CharsetICU {
|
||||
case UCNV_SET_FILTER_HZ:
|
||||
/*Only add code points that are suitable for HZ DBCS*/
|
||||
do {
|
||||
if( ((st3&1) != 0 || useFallBack) && (UConverterConstants.UNSIGNED_SHORT_MASK & ((value=(UConverterConstants.UNSIGNED_SHORT_MASK & (ByteBuffer.wrap(bytes).getChar(stage3))))-0xa1a1))<=(0xfdfe - 0xa1a1) &&
|
||||
if( ((st3&1) != 0 || useFallBack) &&
|
||||
(UConverterConstants.UNSIGNED_SHORT_MASK & ((value=(UConverterConstants.UNSIGNED_SHORT_MASK & (ByteBuffer.wrap(bytes).getChar(stage3))))-0xa1a1))<=(0xfdfe - 0xa1a1) &&
|
||||
(UConverterConstants.UNSIGNED_BYTE_MASK & (value - 0xa1)) <= (0xfe - 0xa1)){
|
||||
setFillIn.add(c);
|
||||
}
|
||||
@ -5080,43 +5083,43 @@ class CharsetMBCS extends CharsetICU {
|
||||
length = 0;
|
||||
UTF16.append(s, length, c);
|
||||
extGetUnicodeSetString(cx,setFillIn,useFallback,minLength,c,s,length,(int)FROM_U_GET_PARTIAL_INDEX(value));
|
||||
} else if ((useFallback ? (value&FROM_U_RESERVED_MASK)==0
|
||||
:((value&(FROM_U_ROUNDTRIP_FLAG|FROM_U_RESERVED_MASK))==
|
||||
FROM_U_ROUNDTRIP_FLAG)) && FROM_U_GET_LENGTH(value)>=minLength){
|
||||
switch(filter) {
|
||||
case UCNV_SET_FILTER_2022_CN:
|
||||
if(!(FROM_U_GET_LENGTH(value)==3 && FROM_U_GET_DATA(value)<=0x82ffff)){
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
case UCNV_SET_FILTER_SJIS:
|
||||
if(!(FROM_U_GET_LENGTH(value)==2 && (value=FROM_U_GET_DATA(value))>=0x8140 && value<=0xeffc)){
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
case UCNV_SET_FILTER_GR94DBCS:
|
||||
if(!(FROM_U_GET_LENGTH(value)==2 && (UConverterConstants.UNSIGNED_SHORT_MASK & ((value=FROM_U_GET_DATA(value)) - 0xa1a1))<=(0xfefe - 0xa1a1)
|
||||
&& (UConverterConstants.UNSIGNED_BYTE_MASK & (value - 0xa1))<= (0xfe - 0xa1))){
|
||||
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
case UCNV_SET_FILTER_HZ:
|
||||
if(!(FROM_U_GET_LENGTH(value)==2 && (UConverterConstants.UNSIGNED_SHORT_MASK & ((value=FROM_U_GET_DATA(value)) - 0xa1a1))<=(0xfdfe - 0xa1a1)
|
||||
&& (UConverterConstants.UNSIGNED_BYTE_MASK & (value - 0xa1))<= (0xfe - 0xa1))){
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
/*
|
||||
* UCNV_SET_FILTER_NONE,
|
||||
* or UCNV_SET_FILTER_DBCS_ONLY which is handled via minLength
|
||||
*/
|
||||
break;
|
||||
}
|
||||
setFillIn.add(c);
|
||||
|
||||
}
|
||||
} else if ((useFallback ? (value&FROM_U_RESERVED_MASK)==0 :((value&(FROM_U_ROUNDTRIP_FLAG|FROM_U_RESERVED_MASK))== FROM_U_ROUNDTRIP_FLAG)) &&
|
||||
FROM_U_GET_LENGTH(value)>=minLength){
|
||||
|
||||
switch(filter) {
|
||||
case UCNV_SET_FILTER_2022_CN:
|
||||
if(!(FROM_U_GET_LENGTH(value)==3 && FROM_U_GET_DATA(value)<=0x82ffff)){
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
case UCNV_SET_FILTER_SJIS:
|
||||
if(!(FROM_U_GET_LENGTH(value)==2 && (value=FROM_U_GET_DATA(value))>=0x8140 && value<=0xeffc)){
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
case UCNV_SET_FILTER_GR94DBCS:
|
||||
if(!(FROM_U_GET_LENGTH(value)==2 && (UConverterConstants.UNSIGNED_SHORT_MASK & ((value=FROM_U_GET_DATA(value)) - 0xa1a1))<=(0xfefe - 0xa1a1)
|
||||
&& (UConverterConstants.UNSIGNED_BYTE_MASK & (value - 0xa1))<= (0xfe - 0xa1))){
|
||||
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
case UCNV_SET_FILTER_HZ:
|
||||
if(!(FROM_U_GET_LENGTH(value)==2 && (UConverterConstants.UNSIGNED_SHORT_MASK & ((value=FROM_U_GET_DATA(value)) - 0xa1a1))<=(0xfdfe - 0xa1a1)
|
||||
&& (UConverterConstants.UNSIGNED_BYTE_MASK & (value - 0xa1))<= (0xfe - 0xa1))){
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
/*
|
||||
* UCNV_SET_FILTER_NONE,
|
||||
* or UCNV_SET_FILTER_DBCS_ONLY which is handled via minLength
|
||||
*/
|
||||
break;
|
||||
}
|
||||
setFillIn.add(c);
|
||||
|
||||
}
|
||||
}while((++c&0xf) != 0);
|
||||
|
||||
} else {
|
||||
@ -5130,9 +5133,8 @@ class CharsetMBCS extends CharsetICU {
|
||||
}
|
||||
|
||||
void MBCSGetUnicodeSetForUnicode(UConverterSharedData data, UnicodeSet setFillIn, int which){
|
||||
MBCSGetFilteredUnicodeSetForUnicode(data, setFillIn, which, this.sharedData.mbcs.outputType==MBCS_OUTPUT_DBCS_ONLY ?
|
||||
UCNV_SET_FILTER_DBCS_ONLY :
|
||||
UCNV_SET_FILTER_NONE );
|
||||
MBCSGetFilteredUnicodeSetForUnicode(data, setFillIn, which,
|
||||
this.sharedData.mbcs.outputType==MBCS_OUTPUT_DBCS_ONLY ? UCNV_SET_FILTER_DBCS_ONLY : UCNV_SET_FILTER_NONE );
|
||||
}
|
||||
|
||||
void getUnicodeSetImpl( UnicodeSet setFillIn, int which){
|
||||
|
@ -841,7 +841,7 @@ public class TestConversion extends ModuleTest {
|
||||
*/
|
||||
|
||||
|
||||
// retrieve test case data
|
||||
// retrieve test case data
|
||||
ConversionCase cc = new ConversionCase();
|
||||
CharsetProviderICU provider = new CharsetProviderICU();
|
||||
CharsetICU charset ;
|
||||
@ -859,23 +859,20 @@ public class TestConversion extends ModuleTest {
|
||||
|
||||
|
||||
int which = 1; // only checking for ROUNDTRIP_SET
|
||||
try{
|
||||
try{
|
||||
// if cc.charset starts with '*', obtain it from com/ibm/icu/dev/data/testdata
|
||||
charset = (cc.charset != null && cc.charset.length() > 0 && cc.charset.charAt(0) == '*')
|
||||
? (CharsetICU) provider.charsetForName(cc.charset.substring(1), "../dev/data/testdata")
|
||||
: (CharsetICU) provider.charsetForName(cc.charset);
|
||||
|
||||
|
||||
|
||||
|
||||
//checking for converter that are not supported at this point
|
||||
try{
|
||||
if(charset.name()=="BOCU-1" ||charset.name()== "SCSU"|| charset.name()=="lmbcs1" || charset.name()== "lmbcs2"
|
||||
|
||||
|| charset.name()== "lmbcs3" || charset.name()== "lmbcs4" || charset.name()=="lmbcs5" || charset.name()=="lmbcs6" ||
|
||||
charset.name()== "lmbcs8" || charset.name()=="lmbcs11" || charset.name()=="lmbcs16" || charset.name()=="lmbcs17" || charset.name()=="lmbcs18"
|
||||
|| charset.name()=="lmbcs19"){
|
||||
logln("Converter not supported at this point :" +charset.displayName());
|
||||
if(charset.name()=="BOCU-1" ||charset.name()== "SCSU"|| charset.name()=="lmbcs1" || charset.name()== "lmbcs2" ||
|
||||
charset.name()== "lmbcs3" || charset.name()== "lmbcs4" || charset.name()=="lmbcs5" || charset.name()=="lmbcs6" ||
|
||||
charset.name()== "lmbcs8" || charset.name()=="lmbcs11" || charset.name()=="lmbcs16" || charset.name()=="lmbcs17" ||
|
||||
charset.name()=="lmbcs18"|| charset.name()=="lmbcs19"){
|
||||
|
||||
logln("Converter not supported at this point :" +charset.displayName());
|
||||
}
|
||||
|
||||
}catch(Exception e){
|
||||
@ -904,7 +901,6 @@ public class TestConversion extends ModuleTest {
|
||||
|
||||
//are the items that must not be in unicodeset but are?
|
||||
|
||||
|
||||
(diffset=mapnotset).retainAll(unicodeset);
|
||||
|
||||
if(!diffset.isEmpty()){
|
||||
@ -915,18 +911,14 @@ public class TestConversion extends ModuleTest {
|
||||
logln("contains unexpected items - conversion/getUnicodeSet test case "+cc.charset);
|
||||
logln(s.toString());
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
logln("getUnicodeSet returned an error code");
|
||||
logln("ErrorCode expected is: " + cc.outErrorCode);
|
||||
logln("Error Result is: " + e.toString());
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* This follows ucnv.c method ucnv_detectUnicodeSignature() to detect the
|
||||
* start of the stream for example U+FEFF (the Unicode BOM/signature
|
||||
|
Loading…
Reference in New Issue
Block a user