ICU-5314 Clean up UTF-16, UTF-32 detectors, UTF-16 test.

X-SVN-Rev: 20035
This commit is contained in:
Eric Mader 2006-08-11 18:55:15 +00:00
parent 818fa504fd
commit c292eb5da0
2 changed files with 4 additions and 2 deletions

View file

@ -32,7 +32,7 @@ int32_t CharsetRecog_UTF_16_BE::match(InputText* textIn)
{
const uint8_t *input = textIn->fRawInput;
if ((input[0] & 0xFF) == 0xFE && (input[1] & 0xFF) == 0xFF) {
if (input[0] == 0xFE && input[1] == 0xFF) {
return 100;
}
@ -76,7 +76,7 @@ int32_t CharsetRecog_UTF_32::match(InputText* textIn)
bool hasBOM = FALSE;
int32_t confidence = 0;
if (input[0] == 0x00 && input[1] == 0x00 && input[2] == 0xFE && input[3] == 0xFF) {
if (getChar(input, 0) == 0x0000FEFFUL) {
hasBOM = TRUE;
}

View file

@ -321,6 +321,7 @@ void CharsetDetectionTest::UTF16Test()
if (strcmp(name, "UTF-16BE") != 0) {
errln("Encoding detection failure for UTF-16BE: got %s", name);
goto try_le; // no point in looking at confidence if we got the wrong character set.
}
if (conf != 100) {
@ -342,6 +343,7 @@ try_le:
if (strcmp(name, "UTF-16LE") != 0) {
errln("Enconding detection failure for UTF-16LE: got %s", name);
goto bail; // no point in looking at confidence if we got the wrong character set.
}
if (conf != 100) {