mirror of
https://gitlab.freedesktop.org/uchardet/uchardet.git
synced 2025-12-06 08:46:40 +08:00
Stop detection early on control characters
This commit is contained in:
parent
d082704fec
commit
5ef60164fc
@ -54,7 +54,7 @@ static const unsigned char win1255_CharToOrderMap[] =
|
||||
{
|
||||
255,255,255,255,255,255,255,255,255,255,254,255,255,254,255,255, //00
|
||||
255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, //10
|
||||
+253,253,253,253,253,253,253,253,253,253,253,253,253,253,253,253, //20
|
||||
253,253,253,253,253,253,253,253,253,253,253,253,253,253,253,253, //20
|
||||
252,252,252,252,252,252,252,252,252,252,253,253,253,253,253,253, //30
|
||||
253, 69, 91, 79, 80, 92, 89, 97, 90, 68,111,112, 82, 73, 95, 85, //40
|
||||
78,121, 86, 71, 67,102,107, 84,114,103,115,253,253,253,253,253, //50
|
||||
@ -67,7 +67,7 @@ static const unsigned char win1255_CharToOrderMap[] =
|
||||
30, 59, 41, 88, 33, 37, 36, 31, 29, 35,235, 62, 28,236,126,237,
|
||||
238, 38, 45,239,240,241,242,243,127,244,245,246,247,248,249,250,
|
||||
9, 8, 20, 16, 3, 2, 24, 14, 22, 1, 25, 15, 4, 11, 6, 23,
|
||||
12, 19, 13, 26, 18, 27, 21, 17, 7, 10, 5,251,252,128, 96,253,
|
||||
12, 19, 13, 26, 18, 27, 21, 17, 7, 10, 5,255,255,128, 96,255,
|
||||
};
|
||||
|
||||
//Model Table:
|
||||
|
||||
@ -46,6 +46,11 @@ nsProbingState nsSingleByteCharSetProber::HandleData(const char* aBuf, PRUint32
|
||||
{
|
||||
order = mModel->charToOrderMap[(unsigned char)aBuf[i]];
|
||||
|
||||
if (order == 255)
|
||||
{
|
||||
mState = eNotMe;
|
||||
break;
|
||||
}
|
||||
if (order < SYMBOL_CAT_ORDER)
|
||||
mTotalChar++;
|
||||
if (order < SAMPLE_SIZE)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user