зеркало из https://github.com/mozilla/gecko-dev.git
Make data tables in extensions/universalchardet const. Bug 482227, r=smontagu
This commit is contained in:
Родитель
aa115c2799
Коммит
00b0b9ec63
|
@ -39,7 +39,7 @@
|
|||
#include "JpCntx.h"
|
||||
|
||||
//This is hiragana 2-char sequence table, the number in each cell represents its frequency category
|
||||
char jp2CharContext[83][83] =
|
||||
const char jp2CharContext[83][83] =
|
||||
{
|
||||
{ 0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,1,},
|
||||
{ 2,4,0,4,0,3,0,4,0,3,4,4,4,2,4,3,3,4,3,2,3,3,4,2,3,3,3,2,4,1,4,3,3,1,5,4,3,4,3,4,3,5,3,0,3,5,4,2,0,3,1,0,3,3,0,3,3,0,1,1,0,4,3,0,3,3,0,4,0,2,0,3,5,5,5,5,4,0,4,1,0,3,4,},
|
||||
|
@ -227,5 +227,3 @@ PRInt32 EUCJPContextAnalysis::GetOrder(const char* str, PRUint32 *charLen)
|
|||
return (unsigned char)*(str+1) - (unsigned char)0xa1;
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -46,7 +46,7 @@
|
|||
#define MAX_REL_THRESHOLD 1000
|
||||
|
||||
//hiragana frequency category table
|
||||
extern char jp2CharContext[83][83];
|
||||
extern const char jp2CharContext[83][83];
|
||||
|
||||
class JapaneseContextAnalysis
|
||||
{
|
||||
|
|
|
@ -48,7 +48,7 @@
|
|||
//this talbe is modified base on win1251BulgarianCharToOrderMap, so
|
||||
//only number <64 is sure valid
|
||||
|
||||
unsigned char Latin5_BulgarianCharToOrderMap[] =
|
||||
static const unsigned char Latin5_BulgarianCharToOrderMap[] =
|
||||
{
|
||||
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
|
||||
|
@ -68,7 +68,7 @@ unsigned char Latin5_BulgarianCharToOrderMap[] =
|
|||
62,242,243,244, 58,245, 98,246,247,248,249,250,251, 91,252,253, //f0
|
||||
};
|
||||
|
||||
unsigned char win1251BulgarianCharToOrderMap[] =
|
||||
static const unsigned char win1251BulgarianCharToOrderMap[] =
|
||||
{
|
||||
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
|
||||
|
@ -94,7 +94,7 @@ unsigned char win1251BulgarianCharToOrderMap[] =
|
|||
//first 1024 sequences:3.0618%
|
||||
//rest sequences: 0.2992%
|
||||
//negative sequences: 0.0020%
|
||||
char BulgarianLangModel[] =
|
||||
static const char BulgarianLangModel[] =
|
||||
{
|
||||
0,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,2,3,3,3,3,3,3,3,3,2,3,3,3,3,3,
|
||||
3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,0,3,3,3,2,2,3,2,2,1,2,2,
|
||||
|
@ -226,7 +226,7 @@ char BulgarianLangModel[] =
|
|||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,
|
||||
};
|
||||
|
||||
SequenceModel Latin5BulgarianModel =
|
||||
const SequenceModel Latin5BulgarianModel =
|
||||
{
|
||||
Latin5_BulgarianCharToOrderMap,
|
||||
BulgarianLangModel,
|
||||
|
@ -235,7 +235,7 @@ SequenceModel Latin5BulgarianModel =
|
|||
"ISO-8859-5"
|
||||
};
|
||||
|
||||
SequenceModel Win1251BulgarianModel =
|
||||
const SequenceModel Win1251BulgarianModel =
|
||||
{
|
||||
win1251BulgarianCharToOrderMap,
|
||||
BulgarianLangModel,
|
||||
|
|
|
@ -41,7 +41,7 @@
|
|||
|
||||
//KOI8-R language model
|
||||
//Character Mapping Table:
|
||||
unsigned char KOI8R_CharToOrderMap[] =
|
||||
static const unsigned char KOI8R_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
|
||||
|
@ -61,7 +61,7 @@ unsigned char KOI8R_CharToOrderMap[] =
|
|||
35, 43, 45, 32, 40, 52, 56, 33, 61, 62, 51, 57, 47, 63, 50, 70, //f0
|
||||
};
|
||||
|
||||
unsigned char win1251_CharToOrderMap[] =
|
||||
static const unsigned char win1251_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
|
||||
|
@ -81,7 +81,7 @@ unsigned char win1251_CharToOrderMap[] =
|
|||
9, 7, 6, 14, 39, 26, 28, 22, 25, 29, 54, 18, 17, 30, 27, 16,
|
||||
};
|
||||
|
||||
unsigned char latin5_CharToOrderMap[] =
|
||||
static const unsigned char latin5_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
|
||||
|
@ -101,7 +101,7 @@ unsigned char latin5_CharToOrderMap[] =
|
|||
239, 68,240,241,242,243,244,245,246,247,248,249,250,251,252,255,
|
||||
};
|
||||
|
||||
unsigned char macCyrillic_CharToOrderMap[] =
|
||||
static const unsigned char macCyrillic_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
|
||||
|
@ -121,7 +121,7 @@ unsigned char macCyrillic_CharToOrderMap[] =
|
|||
9, 7, 6, 14, 39, 26, 28, 22, 25, 29, 54, 18, 17, 30, 27,255,
|
||||
};
|
||||
|
||||
unsigned char IBM855_CharToOrderMap[] =
|
||||
static const unsigned char IBM855_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
|
||||
|
@ -141,7 +141,7 @@ unsigned char IBM855_CharToOrderMap[] =
|
|||
250, 18, 62, 20, 51, 25, 57, 30, 47, 29, 63, 22, 50,251,252,255,
|
||||
};
|
||||
|
||||
unsigned char IBM866_CharToOrderMap[] =
|
||||
static const unsigned char IBM866_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
|
||||
|
@ -167,7 +167,7 @@ unsigned char IBM866_CharToOrderMap[] =
|
|||
//first 1024 sequences: 2.3389%
|
||||
//rest sequences: 0.1237%
|
||||
//negative sequences: 0.0009%
|
||||
char RussianLangModel[] =
|
||||
static const char RussianLangModel[] =
|
||||
{
|
||||
0,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,1,1,3,3,3,3,1,3,3,3,2,3,2,3,3,
|
||||
3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,0,3,2,2,2,2,2,0,0,2,
|
||||
|
@ -300,7 +300,7 @@ char RussianLangModel[] =
|
|||
};
|
||||
|
||||
|
||||
SequenceModel Koi8rModel =
|
||||
const SequenceModel Koi8rModel =
|
||||
{
|
||||
KOI8R_CharToOrderMap,
|
||||
RussianLangModel,
|
||||
|
@ -309,7 +309,7 @@ SequenceModel Koi8rModel =
|
|||
"KOI8-R"
|
||||
};
|
||||
|
||||
SequenceModel Win1251Model =
|
||||
const SequenceModel Win1251Model =
|
||||
{
|
||||
win1251_CharToOrderMap,
|
||||
RussianLangModel,
|
||||
|
@ -318,7 +318,7 @@ SequenceModel Win1251Model =
|
|||
"windows-1251"
|
||||
};
|
||||
|
||||
SequenceModel Latin5Model =
|
||||
const SequenceModel Latin5Model =
|
||||
{
|
||||
latin5_CharToOrderMap,
|
||||
RussianLangModel,
|
||||
|
@ -327,7 +327,7 @@ SequenceModel Latin5Model =
|
|||
"ISO-8859-5"
|
||||
};
|
||||
|
||||
SequenceModel MacCyrillicModel =
|
||||
const SequenceModel MacCyrillicModel =
|
||||
{
|
||||
macCyrillic_CharToOrderMap,
|
||||
RussianLangModel,
|
||||
|
@ -336,7 +336,7 @@ SequenceModel MacCyrillicModel =
|
|||
"x-mac-cyrillic"
|
||||
};
|
||||
|
||||
SequenceModel Ibm866Model =
|
||||
const SequenceModel Ibm866Model =
|
||||
{
|
||||
IBM866_CharToOrderMap,
|
||||
RussianLangModel,
|
||||
|
@ -345,7 +345,7 @@ SequenceModel Ibm866Model =
|
|||
"IBM866"
|
||||
};
|
||||
|
||||
SequenceModel Ibm855Model =
|
||||
const SequenceModel Ibm855Model =
|
||||
{
|
||||
IBM855_CharToOrderMap,
|
||||
RussianLangModel,
|
||||
|
|
|
@ -45,7 +45,7 @@
|
|||
*****************************************************************/
|
||||
|
||||
//Character Mapping Table:
|
||||
unsigned char Latin7_CharToOrderMap[] =
|
||||
static const unsigned char Latin7_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
|
||||
|
@ -67,7 +67,7 @@ unsigned char Latin7_CharToOrderMap[] =
|
|||
|
||||
|
||||
|
||||
unsigned char win1253_CharToOrderMap[] =
|
||||
static const unsigned char win1253_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
|
||||
|
@ -93,7 +93,7 @@ unsigned char win1253_CharToOrderMap[] =
|
|||
//first 1024 sequences:1.7001%
|
||||
//rest sequences: 0.0359%
|
||||
//negative sequences: 0.0148%
|
||||
char GreekLangModel[] =
|
||||
static const char GreekLangModel[] =
|
||||
{
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
|
@ -225,7 +225,7 @@ char GreekLangModel[] =
|
|||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
};
|
||||
|
||||
SequenceModel Latin7Model =
|
||||
const SequenceModel Latin7Model =
|
||||
{
|
||||
Latin7_CharToOrderMap,
|
||||
GreekLangModel,
|
||||
|
@ -234,7 +234,7 @@ SequenceModel Latin7Model =
|
|||
"ISO-8859-7"
|
||||
};
|
||||
|
||||
SequenceModel Win1253Model =
|
||||
const SequenceModel Win1253Model =
|
||||
{
|
||||
win1253_CharToOrderMap,
|
||||
GreekLangModel,
|
||||
|
|
|
@ -50,7 +50,7 @@
|
|||
|
||||
//Windows-1255 language model
|
||||
//Character Mapping Table:
|
||||
unsigned char win1255_CharToOrderMap[] =
|
||||
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
|
||||
|
@ -76,7 +76,7 @@ unsigned char win1255_CharToOrderMap[] =
|
|||
//first 1024 sequences: 1.5981%
|
||||
//rest sequences: 0.087%
|
||||
//negative sequences: 0.0015%
|
||||
char HebrewLangModel[] =
|
||||
static const char HebrewLangModel[] =
|
||||
{
|
||||
0,3,3,3,3,3,3,3,3,3,3,2,3,3,3,3,3,3,3,3,3,3,3,2,3,2,1,2,0,1,0,0,
|
||||
3,0,3,1,0,0,1,3,2,0,1,1,2,0,2,2,2,1,1,1,1,2,1,1,1,2,0,0,2,2,0,1,
|
||||
|
@ -208,7 +208,7 @@ char HebrewLangModel[] =
|
|||
0,0,0,0,0,0,0,0,0,0,1,2,1,0,0,0,0,0,1,1,1,1,1,0,1,0,0,0,1,1,0,0,
|
||||
};
|
||||
|
||||
SequenceModel Win1255Model =
|
||||
const SequenceModel Win1255Model =
|
||||
{
|
||||
win1255_CharToOrderMap,
|
||||
HebrewLangModel,
|
||||
|
|
|
@ -45,7 +45,7 @@
|
|||
*****************************************************************/
|
||||
|
||||
//Character Mapping Table:
|
||||
unsigned char Latin2_HungarianCharToOrderMap[] =
|
||||
static const unsigned char Latin2_HungarianCharToOrderMap[] =
|
||||
{
|
||||
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
|
||||
|
@ -65,7 +65,7 @@ unsigned char Latin2_HungarianCharToOrderMap[] =
|
|||
245,246,247, 25, 73, 42, 24,248,249,250, 31, 56, 29,251,252,253,
|
||||
};
|
||||
|
||||
unsigned char win1250HungarianCharToOrderMap[] =
|
||||
static const unsigned char win1250HungarianCharToOrderMap[] =
|
||||
{
|
||||
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
|
||||
|
@ -91,7 +91,7 @@ unsigned char win1250HungarianCharToOrderMap[] =
|
|||
//first 1024 sequences:5.2623%
|
||||
//rest sequences: 0.8894%
|
||||
//negative sequences: 0.0009%
|
||||
char HungarianLangModel[] =
|
||||
static const char HungarianLangModel[] =
|
||||
{
|
||||
0,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,1,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,
|
||||
3,3,3,3,3,3,3,3,3,3,2,3,3,3,3,3,3,3,3,2,2,3,3,1,1,2,2,2,2,2,1,2,
|
||||
|
@ -223,7 +223,7 @@ char HungarianLangModel[] =
|
|||
0,1,1,1,1,1,1,0,1,1,0,1,0,1,0,0,1,1,0,0,1,1,0,0,0,0,0,0,0,0,0,0,
|
||||
};
|
||||
|
||||
SequenceModel Latin2HungarianModel =
|
||||
const SequenceModel Latin2HungarianModel =
|
||||
{
|
||||
Latin2_HungarianCharToOrderMap,
|
||||
HungarianLangModel,
|
||||
|
@ -232,7 +232,7 @@ SequenceModel Latin2HungarianModel =
|
|||
"ISO-8859-2"
|
||||
};
|
||||
|
||||
SequenceModel Win1250HungarianModel =
|
||||
const SequenceModel Win1250HungarianModel =
|
||||
{
|
||||
win1250HungarianCharToOrderMap,
|
||||
HungarianLangModel,
|
||||
|
|
|
@ -49,7 +49,7 @@
|
|||
//The following result for thai was collected from a limited sample (1M).
|
||||
|
||||
//Character Mapping Table:
|
||||
unsigned char TIS620CharToOrderMap[] =
|
||||
static const unsigned char TIS620CharToOrderMap[] =
|
||||
{
|
||||
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
|
||||
|
@ -78,7 +78,7 @@ unsigned char TIS620CharToOrderMap[] =
|
|||
//first 1024 sequences:7.3177%
|
||||
//rest sequences: 1.0230%
|
||||
//negative sequences: 0.0436%
|
||||
char ThaiLangModel[] =
|
||||
static const char ThaiLangModel[] =
|
||||
{
|
||||
0,1,3,3,3,3,0,0,3,3,0,3,3,0,3,3,3,3,3,3,3,3,0,0,3,3,3,0,3,3,3,3,
|
||||
0,3,3,0,0,0,1,3,0,3,3,2,3,3,0,1,2,3,3,3,3,0,2,0,2,0,0,3,2,1,2,2,
|
||||
|
@ -211,7 +211,7 @@ char ThaiLangModel[] =
|
|||
};
|
||||
|
||||
|
||||
SequenceModel TIS620ThaiModel =
|
||||
const SequenceModel TIS620ThaiModel =
|
||||
{
|
||||
TIS620CharToOrderMap,
|
||||
ThaiLangModel,
|
||||
|
|
|
@ -59,10 +59,7 @@ typedef struct
|
|||
|
||||
class nsCodingStateMachine {
|
||||
public:
|
||||
nsCodingStateMachine(SMModel* sm){
|
||||
mCurrentState = eStart;
|
||||
mModel = sm;
|
||||
}
|
||||
nsCodingStateMachine(const SMModel* sm) : mModel(sm) { mCurrentState = eStart; }
|
||||
nsSMState NextState(char c){
|
||||
//for each byte we get its class , if it is first byte, we also get byte length
|
||||
PRUint32 byteCls = GETCLASS(c);
|
||||
|
@ -86,22 +83,22 @@ protected:
|
|||
PRUint32 mCurrentCharLen;
|
||||
PRUint32 mCurrentBytePos;
|
||||
|
||||
SMModel *mModel;
|
||||
const SMModel *mModel;
|
||||
};
|
||||
|
||||
extern SMModel UTF8SMModel;
|
||||
extern SMModel Big5SMModel;
|
||||
extern SMModel EUCJPSMModel;
|
||||
extern SMModel EUCKRSMModel;
|
||||
extern SMModel EUCTWSMModel;
|
||||
extern SMModel GB18030SMModel;
|
||||
extern SMModel SJISSMModel;
|
||||
extern const SMModel UTF8SMModel;
|
||||
extern const SMModel Big5SMModel;
|
||||
extern const SMModel EUCJPSMModel;
|
||||
extern const SMModel EUCKRSMModel;
|
||||
extern const SMModel EUCTWSMModel;
|
||||
extern const SMModel GB18030SMModel;
|
||||
extern const SMModel SJISSMModel;
|
||||
|
||||
|
||||
extern SMModel HZSMModel;
|
||||
extern SMModel ISO2022CNSMModel;
|
||||
extern SMModel ISO2022JPSMModel;
|
||||
extern SMModel ISO2022KRSMModel;
|
||||
extern const SMModel HZSMModel;
|
||||
extern const SMModel ISO2022CNSMModel;
|
||||
extern const SMModel ISO2022JPSMModel;
|
||||
extern const SMModel ISO2022KRSMModel;
|
||||
|
||||
#endif /* nsCodingStateMachine_h__ */
|
||||
|
||||
|
|
|
@ -36,7 +36,7 @@
|
|||
* ***** END LICENSE BLOCK ***** */
|
||||
#include "nsCodingStateMachine.h"
|
||||
|
||||
static PRUint32 HZ_cls[ 256 / 8 ] = {
|
||||
static const PRUint32 HZ_cls[ 256 / 8 ] = {
|
||||
PCK4BITS(1,0,0,0,0,0,0,0), // 00 - 07
|
||||
PCK4BITS(0,0,0,0,0,0,0,0), // 08 - 0f
|
||||
PCK4BITS(0,0,0,0,0,0,0,0), // 10 - 17
|
||||
|
@ -72,7 +72,7 @@ PCK4BITS(1,1,1,1,1,1,1,1) // f8 - ff
|
|||
};
|
||||
|
||||
|
||||
static PRUint32 HZ_st [ 6] = {
|
||||
static const PRUint32 HZ_st [ 6] = {
|
||||
PCK4BITS(eStart,eError, 3,eStart,eStart,eStart,eError,eError),//00-07
|
||||
PCK4BITS(eError,eError,eError,eError,eItsMe,eItsMe,eItsMe,eItsMe),//08-0f
|
||||
PCK4BITS(eItsMe,eItsMe,eError,eError,eStart,eStart, 4,eError),//10-17
|
||||
|
@ -83,7 +83,7 @@ PCK4BITS( 4,eItsMe,eStart,eStart,eStart,eStart,eStart,eStart) //28-2f
|
|||
|
||||
static const PRUint32 HZCharLenTable[] = {0, 0, 0, 0, 0, 0};
|
||||
|
||||
SMModel HZSMModel = {
|
||||
const SMModel HZSMModel = {
|
||||
{eIdxSft4bits, eSftMsk4bits, eBitSft4bits, eUnitMsk4bits, HZ_cls },
|
||||
6,
|
||||
{eIdxSft4bits, eSftMsk4bits, eBitSft4bits, eUnitMsk4bits, HZ_st },
|
||||
|
@ -92,7 +92,7 @@ SMModel HZSMModel = {
|
|||
};
|
||||
|
||||
|
||||
static PRUint32 ISO2022CN_cls [ 256 / 8 ] = {
|
||||
static const PRUint32 ISO2022CN_cls [ 256 / 8 ] = {
|
||||
PCK4BITS(2,0,0,0,0,0,0,0), // 00 - 07
|
||||
PCK4BITS(0,0,0,0,0,0,0,0), // 08 - 0f
|
||||
PCK4BITS(0,0,0,0,0,0,0,0), // 10 - 17
|
||||
|
@ -128,7 +128,7 @@ PCK4BITS(2,2,2,2,2,2,2,2) // f8 - ff
|
|||
};
|
||||
|
||||
|
||||
static PRUint32 ISO2022CN_st [ 8] = {
|
||||
static const PRUint32 ISO2022CN_st [ 8] = {
|
||||
PCK4BITS(eStart, 3,eError,eStart,eStart,eStart,eStart,eStart),//00-07
|
||||
PCK4BITS(eStart,eError,eError,eError,eError,eError,eError,eError),//08-0f
|
||||
PCK4BITS(eError,eError,eItsMe,eItsMe,eItsMe,eItsMe,eItsMe,eItsMe),//10-17
|
||||
|
@ -141,7 +141,7 @@ PCK4BITS(eError,eError,eError,eError,eError,eItsMe,eError,eStart) //38-3f
|
|||
|
||||
static const PRUint32 ISO2022CNCharLenTable[] = {0, 0, 0, 0, 0, 0, 0, 0, 0};
|
||||
|
||||
SMModel ISO2022CNSMModel = {
|
||||
const SMModel ISO2022CNSMModel = {
|
||||
{eIdxSft4bits, eSftMsk4bits, eBitSft4bits, eUnitMsk4bits, ISO2022CN_cls },
|
||||
9,
|
||||
{eIdxSft4bits, eSftMsk4bits, eBitSft4bits, eUnitMsk4bits, ISO2022CN_st },
|
||||
|
@ -149,7 +149,7 @@ SMModel ISO2022CNSMModel = {
|
|||
"ISO-2022-CN",
|
||||
};
|
||||
|
||||
static PRUint32 ISO2022JP_cls [ 256 / 8 ] = {
|
||||
static const PRUint32 ISO2022JP_cls [ 256 / 8 ] = {
|
||||
PCK4BITS(2,0,0,0,0,0,0,0), // 00 - 07
|
||||
PCK4BITS(0,0,0,0,0,0,2,2), // 08 - 0f
|
||||
PCK4BITS(0,0,0,0,0,0,0,0), // 10 - 17
|
||||
|
@ -185,7 +185,7 @@ PCK4BITS(2,2,2,2,2,2,2,2) // f8 - ff
|
|||
};
|
||||
|
||||
|
||||
static PRUint32 ISO2022JP_st [ 9] = {
|
||||
static const PRUint32 ISO2022JP_st [ 9] = {
|
||||
PCK4BITS(eStart, 3,eError,eStart,eStart,eStart,eStart,eStart),//00-07
|
||||
PCK4BITS(eStart,eStart,eError,eError,eError,eError,eError,eError),//08-0f
|
||||
PCK4BITS(eError,eError,eError,eError,eItsMe,eItsMe,eItsMe,eItsMe),//10-17
|
||||
|
@ -199,7 +199,7 @@ PCK4BITS(eError,eError,eError,eError,eItsMe,eError,eStart,eStart) //40-47
|
|||
|
||||
static const PRUint32 ISO2022JPCharLenTable[] = {0, 0, 0, 0, 0, 0, 0, 0};
|
||||
|
||||
SMModel ISO2022JPSMModel = {
|
||||
const SMModel ISO2022JPSMModel = {
|
||||
{eIdxSft4bits, eSftMsk4bits, eBitSft4bits, eUnitMsk4bits, ISO2022JP_cls },
|
||||
10,
|
||||
{eIdxSft4bits, eSftMsk4bits, eBitSft4bits, eUnitMsk4bits, ISO2022JP_st },
|
||||
|
@ -207,7 +207,7 @@ SMModel ISO2022JPSMModel = {
|
|||
"ISO-2022-JP",
|
||||
};
|
||||
|
||||
static PRUint32 ISO2022KR_cls [ 256 / 8 ] = {
|
||||
static const PRUint32 ISO2022KR_cls [ 256 / 8 ] = {
|
||||
PCK4BITS(2,0,0,0,0,0,0,0), // 00 - 07
|
||||
PCK4BITS(0,0,0,0,0,0,0,0), // 08 - 0f
|
||||
PCK4BITS(0,0,0,0,0,0,0,0), // 10 - 17
|
||||
|
@ -243,7 +243,7 @@ PCK4BITS(2,2,2,2,2,2,2,2) // f8 - ff
|
|||
};
|
||||
|
||||
|
||||
static PRUint32 ISO2022KR_st [ 5] = {
|
||||
static const PRUint32 ISO2022KR_st [ 5] = {
|
||||
PCK4BITS(eStart, 3,eError,eStart,eStart,eStart,eError,eError),//00-07
|
||||
PCK4BITS(eError,eError,eError,eError,eItsMe,eItsMe,eItsMe,eItsMe),//08-0f
|
||||
PCK4BITS(eItsMe,eItsMe,eError,eError,eError, 4,eError,eError),//10-17
|
||||
|
@ -253,7 +253,7 @@ PCK4BITS(eError,eError,eError,eItsMe,eStart,eStart,eStart,eStart) //20-27
|
|||
|
||||
static const PRUint32 ISO2022KRCharLenTable[] = {0, 0, 0, 0, 0, 0};
|
||||
|
||||
SMModel ISO2022KRSMModel = {
|
||||
const SMModel ISO2022KRSMModel = {
|
||||
{eIdxSft4bits, eSftMsk4bits, eBitSft4bits, eUnitMsk4bits, ISO2022KR_cls },
|
||||
6,
|
||||
{eIdxSft4bits, eSftMsk4bits, eBitSft4bits, eUnitMsk4bits, ISO2022KR_st },
|
||||
|
|
|
@ -50,7 +50,7 @@
|
|||
#define ASO 7 // accent small other
|
||||
#define CLASS_NUM 8 // total classes
|
||||
|
||||
static unsigned char Latin1_CharToClass[] =
|
||||
static const unsigned char Latin1_CharToClass[] =
|
||||
{
|
||||
OTH, OTH, OTH, OTH, OTH, OTH, OTH, OTH, // 00 - 07
|
||||
OTH, OTH, OTH, OTH, OTH, OTH, OTH, OTH, // 08 - 0F
|
||||
|
@ -92,7 +92,7 @@ static unsigned char Latin1_CharToClass[] =
|
|||
2 : normal
|
||||
3 : very likely
|
||||
*/
|
||||
static unsigned char Latin1ClassModel[] =
|
||||
static const unsigned char Latin1ClassModel[] =
|
||||
{
|
||||
/* UDF OTH ASC ASS ACV ACO ASV ASO */
|
||||
/*UDF*/ 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
|
|
|
@ -44,7 +44,7 @@ Modification from frank tang's original work:
|
|||
|
||||
// BIG5
|
||||
|
||||
static PRUint32 BIG5_cls [ 256 / 8 ] = {
|
||||
static const PRUint32 BIG5_cls [ 256 / 8 ] = {
|
||||
//PCK4BITS(0,1,1,1,1,1,1,1), // 00 - 07
|
||||
PCK4BITS(1,1,1,1,1,1,1,1), // 00 - 07 //allow 0x00 as legal value
|
||||
PCK4BITS(1,1,1,1,1,1,0,0), // 08 - 0f
|
||||
|
@ -81,7 +81,7 @@ PCK4BITS(3,3,3,3,3,3,3,0) // f8 - ff
|
|||
};
|
||||
|
||||
|
||||
static PRUint32 BIG5_st [ 3] = {
|
||||
static const PRUint32 BIG5_st [ 3] = {
|
||||
PCK4BITS(eError,eStart,eStart, 3,eError,eError,eError,eError),//00-07
|
||||
PCK4BITS(eError,eError,eItsMe,eItsMe,eItsMe,eItsMe,eItsMe,eError),//08-0f
|
||||
PCK4BITS(eError,eStart,eStart,eStart,eStart,eStart,eStart,eStart) //10-17
|
||||
|
@ -89,7 +89,7 @@ PCK4BITS(eError,eStart,eStart,eStart,eStart,eStart,eStart,eStart) //10-17
|
|||
|
||||
static const PRUint32 Big5CharLenTable[] = {0, 1, 1, 2, 0};
|
||||
|
||||
SMModel Big5SMModel = {
|
||||
SMModel const Big5SMModel = {
|
||||
{eIdxSft4bits, eSftMsk4bits, eBitSft4bits, eUnitMsk4bits, BIG5_cls },
|
||||
5,
|
||||
{eIdxSft4bits, eSftMsk4bits, eBitSft4bits, eUnitMsk4bits, BIG5_st },
|
||||
|
@ -97,7 +97,7 @@ SMModel Big5SMModel = {
|
|||
"Big5",
|
||||
};
|
||||
|
||||
static PRUint32 EUCJP_cls [ 256 / 8 ] = {
|
||||
static const PRUint32 EUCJP_cls [ 256 / 8 ] = {
|
||||
//PCK4BITS(5,4,4,4,4,4,4,4), // 00 - 07
|
||||
PCK4BITS(4,4,4,4,4,4,4,4), // 00 - 07
|
||||
PCK4BITS(4,4,4,4,4,4,5,5), // 08 - 0f
|
||||
|
@ -134,7 +134,7 @@ PCK4BITS(0,0,0,0,0,0,0,5) // f8 - ff
|
|||
};
|
||||
|
||||
|
||||
static PRUint32 EUCJP_st [ 5] = {
|
||||
static const PRUint32 EUCJP_st [ 5] = {
|
||||
PCK4BITS( 3, 4, 3, 5,eStart,eError,eError,eError),//00-07
|
||||
PCK4BITS(eError,eError,eError,eError,eItsMe,eItsMe,eItsMe,eItsMe),//08-0f
|
||||
PCK4BITS(eItsMe,eItsMe,eStart,eError,eStart,eError,eError,eError),//10-17
|
||||
|
@ -144,7 +144,7 @@ PCK4BITS( 3,eError,eError,eError,eStart,eStart,eStart,eStart) //20-27
|
|||
|
||||
static const PRUint32 EUCJPCharLenTable[] = {2, 2, 2, 3, 1, 0};
|
||||
|
||||
SMModel EUCJPSMModel = {
|
||||
const SMModel EUCJPSMModel = {
|
||||
{eIdxSft4bits, eSftMsk4bits, eBitSft4bits, eUnitMsk4bits, EUCJP_cls },
|
||||
6,
|
||||
{eIdxSft4bits, eSftMsk4bits, eBitSft4bits, eUnitMsk4bits, EUCJP_st },
|
||||
|
@ -152,7 +152,7 @@ SMModel EUCJPSMModel = {
|
|||
"EUC-JP",
|
||||
};
|
||||
|
||||
static PRUint32 EUCKR_cls [ 256 / 8 ] = {
|
||||
static const PRUint32 EUCKR_cls [ 256 / 8 ] = {
|
||||
//PCK4BITS(0,1,1,1,1,1,1,1), // 00 - 07
|
||||
PCK4BITS(1,1,1,1,1,1,1,1), // 00 - 07
|
||||
PCK4BITS(1,1,1,1,1,1,0,0), // 08 - 0f
|
||||
|
@ -189,14 +189,14 @@ PCK4BITS(2,2,2,2,2,2,2,0) // f8 - ff
|
|||
};
|
||||
|
||||
|
||||
static PRUint32 EUCKR_st [ 2] = {
|
||||
static const PRUint32 EUCKR_st [ 2] = {
|
||||
PCK4BITS(eError,eStart, 3,eError,eError,eError,eError,eError),//00-07
|
||||
PCK4BITS(eItsMe,eItsMe,eItsMe,eItsMe,eError,eError,eStart,eStart) //08-0f
|
||||
};
|
||||
|
||||
static const PRUint32 EUCKRCharLenTable[] = {0, 1, 2, 0};
|
||||
|
||||
SMModel EUCKRSMModel = {
|
||||
const SMModel EUCKRSMModel = {
|
||||
{eIdxSft4bits, eSftMsk4bits, eBitSft4bits, eUnitMsk4bits, EUCKR_cls },
|
||||
4,
|
||||
{eIdxSft4bits, eSftMsk4bits, eBitSft4bits, eUnitMsk4bits, EUCKR_st },
|
||||
|
@ -204,7 +204,7 @@ SMModel EUCKRSMModel = {
|
|||
"EUC-KR",
|
||||
};
|
||||
|
||||
static PRUint32 EUCTW_cls [ 256 / 8 ] = {
|
||||
static const PRUint32 EUCTW_cls [ 256 / 8 ] = {
|
||||
//PCK4BITS(0,2,2,2,2,2,2,2), // 00 - 07
|
||||
PCK4BITS(2,2,2,2,2,2,2,2), // 00 - 07
|
||||
PCK4BITS(2,2,2,2,2,2,0,0), // 08 - 0f
|
||||
|
@ -241,7 +241,7 @@ PCK4BITS(3,3,3,3,3,3,3,0) // f8 - ff
|
|||
};
|
||||
|
||||
|
||||
static PRUint32 EUCTW_st [ 6] = {
|
||||
static const PRUint32 EUCTW_st [ 6] = {
|
||||
PCK4BITS(eError,eError,eStart, 3, 3, 3, 4,eError),//00-07
|
||||
PCK4BITS(eError,eError,eError,eError,eError,eError,eItsMe,eItsMe),//08-0f
|
||||
PCK4BITS(eItsMe,eItsMe,eItsMe,eItsMe,eItsMe,eError,eStart,eError),//10-17
|
||||
|
@ -252,7 +252,7 @@ PCK4BITS(eStart,eError,eStart,eStart,eStart,eStart,eStart,eStart) //28-2f
|
|||
|
||||
static const PRUint32 EUCTWCharLenTable[] = {0, 0, 1, 2, 2, 2, 3};
|
||||
|
||||
SMModel EUCTWSMModel = {
|
||||
const SMModel EUCTWSMModel = {
|
||||
{eIdxSft4bits, eSftMsk4bits, eBitSft4bits, eUnitMsk4bits, EUCTW_cls },
|
||||
7,
|
||||
{eIdxSft4bits, eSftMsk4bits, eBitSft4bits, eUnitMsk4bits, EUCTW_st },
|
||||
|
@ -316,7 +316,7 @@ SMModel GB2312SMModel = {
|
|||
|
||||
// the following state machine data was created by perl script in
|
||||
// intl/chardet/tools. It should be the same as in PSM detector.
|
||||
static PRUint32 GB18030_cls [ 256 / 8 ] = {
|
||||
static const PRUint32 GB18030_cls [ 256 / 8 ] = {
|
||||
PCK4BITS(1,1,1,1,1,1,1,1), // 00 - 07
|
||||
PCK4BITS(1,1,1,1,1,1,0,0), // 08 - 0f
|
||||
PCK4BITS(1,1,1,1,1,1,1,1), // 10 - 17
|
||||
|
@ -352,7 +352,7 @@ PCK4BITS(6,6,6,6,6,6,6,0) // f8 - ff
|
|||
};
|
||||
|
||||
|
||||
static PRUint32 GB18030_st [ 6] = {
|
||||
static const PRUint32 GB18030_st [ 6] = {
|
||||
PCK4BITS(eError,eStart,eStart,eStart,eStart,eStart, 3,eError),//00-07
|
||||
PCK4BITS(eError,eError,eError,eError,eError,eError,eItsMe,eItsMe),//08-0f
|
||||
PCK4BITS(eItsMe,eItsMe,eItsMe,eItsMe,eItsMe,eError,eError,eStart),//10-17
|
||||
|
@ -368,7 +368,7 @@ PCK4BITS(eError,eError,eStart,eStart,eStart,eStart,eStart,eStart) //28-2f
|
|||
// 2 here.
|
||||
static const PRUint32 GB18030CharLenTable[] = {0, 1, 1, 1, 1, 1, 2};
|
||||
|
||||
SMModel GB18030SMModel = {
|
||||
const SMModel GB18030SMModel = {
|
||||
{eIdxSft4bits, eSftMsk4bits, eBitSft4bits, eUnitMsk4bits, GB18030_cls },
|
||||
7,
|
||||
{eIdxSft4bits, eSftMsk4bits, eBitSft4bits, eUnitMsk4bits, GB18030_st },
|
||||
|
@ -378,7 +378,7 @@ SMModel GB18030SMModel = {
|
|||
|
||||
// sjis
|
||||
|
||||
static PRUint32 SJIS_cls [ 256 / 8 ] = {
|
||||
static const PRUint32 SJIS_cls [ 256 / 8 ] = {
|
||||
//PCK4BITS(0,1,1,1,1,1,1,1), // 00 - 07
|
||||
PCK4BITS(1,1,1,1,1,1,1,1), // 00 - 07
|
||||
PCK4BITS(1,1,1,1,1,1,0,0), // 08 - 0f
|
||||
|
@ -417,7 +417,7 @@ PCK4BITS(4,4,4,4,4,0,0,0) // f8 - ff
|
|||
};
|
||||
|
||||
|
||||
static PRUint32 SJIS_st [ 3] = {
|
||||
static const PRUint32 SJIS_st [ 3] = {
|
||||
PCK4BITS(eError,eStart,eStart, 3,eError,eError,eError,eError),//00-07
|
||||
PCK4BITS(eError,eError,eError,eError,eItsMe,eItsMe,eItsMe,eItsMe),//08-0f
|
||||
PCK4BITS(eItsMe,eItsMe,eError,eError,eStart,eStart,eStart,eStart) //10-17
|
||||
|
@ -425,7 +425,7 @@ PCK4BITS(eItsMe,eItsMe,eError,eError,eStart,eStart,eStart,eStart) //10-17
|
|||
|
||||
static const PRUint32 SJISCharLenTable[] = {0, 1, 1, 2, 0, 0};
|
||||
|
||||
SMModel SJISSMModel = {
|
||||
const SMModel SJISSMModel = {
|
||||
{eIdxSft4bits, eSftMsk4bits, eBitSft4bits, eUnitMsk4bits, SJIS_cls },
|
||||
6,
|
||||
{eIdxSft4bits, eSftMsk4bits, eBitSft4bits, eUnitMsk4bits, SJIS_st },
|
||||
|
@ -434,7 +434,7 @@ SMModel SJISSMModel = {
|
|||
};
|
||||
|
||||
|
||||
static PRUint32 UTF8_cls [ 256 / 8 ] = {
|
||||
static const PRUint32 UTF8_cls [ 256 / 8 ] = {
|
||||
//PCK4BITS(0,1,1,1,1,1,1,1), // 00 - 07
|
||||
PCK4BITS(1,1,1,1,1,1,1,1), // 00 - 07 //allow 0x00 as a legal value
|
||||
PCK4BITS(1,1,1,1,1,1,0,0), // 08 - 0f
|
||||
|
@ -471,7 +471,7 @@ PCK4BITS(12,13,13,13,14,15,0,0) // f8 - ff
|
|||
};
|
||||
|
||||
|
||||
static PRUint32 UTF8_st [ 26] = {
|
||||
static const PRUint32 UTF8_st [ 26] = {
|
||||
PCK4BITS(eError,eStart,eError,eError,eError,eError, 12, 10),//00-07
|
||||
PCK4BITS( 9, 11, 8, 7, 6, 5, 4, 3),//08-0f
|
||||
PCK4BITS(eError,eError,eError,eError,eError,eError,eError,eError),//10-17
|
||||
|
@ -503,7 +503,7 @@ PCK4BITS(eError,eError,eError,eError,eError,eError,eError,eError) //c8-cf
|
|||
static const PRUint32 UTF8CharLenTable[] = {0, 1, 0, 0, 0, 0, 2, 3,
|
||||
3, 3, 4, 4, 5, 5, 6, 6 };
|
||||
|
||||
SMModel UTF8SMModel = {
|
||||
const SMModel UTF8SMModel = {
|
||||
{eIdxSft4bits, eSftMsk4bits, eBitSft4bits, eUnitMsk4bits, UTF8_cls },
|
||||
16,
|
||||
{eIdxSft4bits, eSftMsk4bits, eBitSft4bits, eUnitMsk4bits, UTF8_st },
|
||||
|
|
|
@ -68,7 +68,7 @@ typedef struct nsPkgInt {
|
|||
nsSftMsk sftmsk;
|
||||
nsBitSft bitsft;
|
||||
nsUnitMsk unitmsk;
|
||||
PRUint32 *data;
|
||||
const PRUint32* const data;
|
||||
} nsPkgInt;
|
||||
|
||||
|
||||
|
|
|
@ -51,19 +51,19 @@
|
|||
|
||||
typedef struct
|
||||
{
|
||||
unsigned char *charToOrderMap; // [256] table use to find a char's order
|
||||
char *precedenceMatrix; // [SAMPLE_SIZE][SAMPLE_SIZE]; table to find a 2-char sequence's frequency
|
||||
const unsigned char* const charToOrderMap; // [256] table use to find a char's order
|
||||
const char* const precedenceMatrix; // [SAMPLE_SIZE][SAMPLE_SIZE]; table to find a 2-char sequence's frequency
|
||||
float mTypicalPositiveRatio; // = freqSeqs / totalSeqs
|
||||
PRBool keepEnglishLetter; // says if this script contains English characters (not implemented)
|
||||
const char* charsetName;
|
||||
const char* const charsetName;
|
||||
} SequenceModel;
|
||||
|
||||
|
||||
class nsSingleByteCharSetProber : public nsCharSetProber{
|
||||
public:
|
||||
nsSingleByteCharSetProber(SequenceModel *model)
|
||||
nsSingleByteCharSetProber(const SequenceModel *model)
|
||||
:mModel(model), mReversed(PR_FALSE), mNameProber(0) { Reset(); }
|
||||
nsSingleByteCharSetProber(SequenceModel *model, PRBool reversed, nsCharSetProber* nameProber)
|
||||
nsSingleByteCharSetProber(const SequenceModel *model, PRBool reversed, nsCharSetProber* nameProber)
|
||||
:mModel(model), mReversed(reversed), mNameProber(nameProber) { Reset(); }
|
||||
|
||||
virtual const char* GetCharSetName();
|
||||
|
@ -87,7 +87,7 @@ public:
|
|||
|
||||
protected:
|
||||
nsProbingState mState;
|
||||
const SequenceModel *mModel;
|
||||
const SequenceModel* const mModel;
|
||||
const PRBool mReversed; // PR_TRUE if we need to reverse every pair in the model lookup
|
||||
|
||||
//char order of last character
|
||||
|
@ -106,19 +106,19 @@ protected:
|
|||
};
|
||||
|
||||
|
||||
extern SequenceModel Koi8rModel;
|
||||
extern SequenceModel Win1251Model;
|
||||
extern SequenceModel Latin5Model;
|
||||
extern SequenceModel MacCyrillicModel;
|
||||
extern SequenceModel Ibm866Model;
|
||||
extern SequenceModel Ibm855Model;
|
||||
extern SequenceModel Latin7Model;
|
||||
extern SequenceModel Win1253Model;
|
||||
extern SequenceModel Latin5BulgarianModel;
|
||||
extern SequenceModel Win1251BulgarianModel;
|
||||
extern SequenceModel Latin2HungarianModel;
|
||||
extern SequenceModel Win1250HungarianModel;
|
||||
extern SequenceModel Win1255Model;
|
||||
extern const SequenceModel Koi8rModel;
|
||||
extern const SequenceModel Win1251Model;
|
||||
extern const SequenceModel Latin5Model;
|
||||
extern const SequenceModel MacCyrillicModel;
|
||||
extern const SequenceModel Ibm866Model;
|
||||
extern const SequenceModel Ibm855Model;
|
||||
extern const SequenceModel Latin7Model;
|
||||
extern const SequenceModel Win1253Model;
|
||||
extern const SequenceModel Latin5BulgarianModel;
|
||||
extern const SequenceModel Win1251BulgarianModel;
|
||||
extern const SequenceModel Latin2HungarianModel;
|
||||
extern const SequenceModel Win1250HungarianModel;
|
||||
extern const SequenceModel Win1255Model;
|
||||
|
||||
#endif /* nsSingleByteCharSetProber_h__ */
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче