/*
**********************************************************************
- * Copyright (C) 2005-2006, International Business Machines
+ * Copyright (C) 2005-2011, International Business Machines
* Corporation and others. All Rights Reserved.
**********************************************************************
*/
if(text[i] == 0x1B) {
escN = 0;
while(escN < escapeSequences_length) {
- int32_t seq_length = uprv_strlen((const char *) escapeSequences[escN]);
const uint8_t *seq = escapeSequences[escN];
+ int32_t seq_length = (int32_t)uprv_strlen((const char *) seq);
- j = 1;
- while(j < seq_length) {
- if(seq[j] != text[i+j]) {
- goto checkEscapes;
+ if (textLen-i >= seq_length) {
+ j = 1;
+ while(j < seq_length) {
+ if(seq[j] != text[i+j]) {
+ goto checkEscapes;
+ }
+
+ j += 1;
}
- j += 1;
+ hits += 1;
+ i += seq_length-1;
+ goto scanInput;
}
-
- hits += 1;
- i += seq_length-1;
- goto scanInput;
+ // else we ran out of string to compare this time.
checkEscapes:
escN += 1;
}
{0x1b, 0x4f, 0x00, 0x00, 0x00}, // SS3
};
+CharsetRecog_2022JP::~CharsetRecog_2022JP() {}
+
const char *CharsetRecog_2022JP::getName() const
{
return "ISO-2022-JP";
return match_2022(textIn->fInputBytes, textIn->fInputLen, escapeSequences_2022JP, ARRAY_SIZE(escapeSequences_2022JP));
}
+CharsetRecog_2022KR::~CharsetRecog_2022KR() {}
+
const char *CharsetRecog_2022KR::getName() const
{
return "ISO-2022-KR";
return match_2022(textIn->fInputBytes, textIn->fInputLen, escapeSequences_2022KR, ARRAY_SIZE(escapeSequences_2022KR));
}
+CharsetRecog_2022CN::~CharsetRecog_2022CN() {}
+
const char *CharsetRecog_2022CN::getName() const
{
return "ISO-2022-CN";