ICU-5768 Fixed the while loop for the BOM detection. Also, fixed the getChar in UTF32BE so that it will give a BE character instead of LE.

X-SVN-Rev: 21914
This commit is contained in:
Michael Ow 2007-07-05 21:40:11 +00:00
parent a0daf6de27
commit ac1ccad107
2 changed files with 2 additions and 2 deletions

View File

@ -53,7 +53,7 @@ class CharsetUTF32 extends CharsetICU {
offsetDelta=0;
int pos = source.position();
if(isFirstBuffer && toULength<SIGNATURE_LENGTH){
while(pos < source.limit() && pos < toULength) {
while(pos < source.limit() && pos < SIGNATURE_LENGTH) {
toUBytesArray[toULength++] = source.get(pos++);
}
if(toULength==SIGNATURE_LENGTH){

View File

@ -30,7 +30,7 @@ class CharsetUTF32BE extends CharsetUTF32 {
protected int getChar(byte[] bytes, int length){
int i=0, ch=0;
while (i<length){
ch |= (bytes[i] & UConverterConstants.UNSIGNED_BYTE_MASK) << (i * 8);
ch |= (bytes[i] & UConverterConstants.UNSIGNED_BYTE_MASK) << ((3-i) * 8);
i++;
}
return ch;