зеркало из https://github.com/mozilla/pjs.git
Make frequence tables in universal charset decoder const to move them into the
readonly segment. Bug 201361, patch by ataylor@its.to (Andrew Taylor), r=smontagu, sr=alecf
This commit is contained in:
Родитель
211b62b274
Коммит
a611a692bc
|
@ -59,7 +59,7 @@
|
|||
//Char to FreqOrder table ,
|
||||
#define BIG5_TABLE_SIZE 5376
|
||||
|
||||
static PRInt16 Big5CharToFreqOrder[] =
|
||||
static const PRInt16 Big5CharToFreqOrder[] =
|
||||
{
|
||||
1,1801,1506, 255,1431, 198, 9, 82, 6,5008, 177, 202,3681,1256,2821, 110, // 16
|
||||
3814, 33,3274, 261, 76, 44,2114, 16,2946,2187,1176, 659,3971, 26,3451,2653, // 32
|
||||
|
|
|
@ -106,7 +106,7 @@ protected:
|
|||
PRUint32 mTotalChars;
|
||||
|
||||
//Mapping table to get frequency order from char order (get from GetOrder())
|
||||
PRInt16 *mCharToFreqOrder;
|
||||
const PRInt16 *mCharToFreqOrder;
|
||||
|
||||
//Size of above table
|
||||
PRUint32 mTableSize;
|
||||
|
|
|
@ -56,7 +56,7 @@
|
|||
#define EUCKR_TABLE_SIZE 2352
|
||||
|
||||
//Char to FreqOrder table ,
|
||||
static PRInt16 EUCKRCharToFreqOrder[] =
|
||||
static const PRInt16 EUCKRCharToFreqOrder[] =
|
||||
{
|
||||
13, 130, 120,1396, 481,1719,1720, 328, 609, 212,1721, 707, 400, 299,1722, 87,
|
||||
1397,1723, 104, 536,1117,1203,1724,1267, 685,1268, 508,1725,1726,1727,1728,1398,
|
||||
|
|
|
@ -60,7 +60,7 @@
|
|||
//Char to FreqOrder table ,
|
||||
#define EUCTW_TABLE_SIZE 8102
|
||||
|
||||
static PRInt16 EUCTWCharToFreqOrder[] =
|
||||
static const PRInt16 EUCTWCharToFreqOrder[] =
|
||||
{
|
||||
1,1800,1506, 255,1431, 198, 9, 82, 6,7310, 177, 202,3615,1256,2808, 110, // 2742
|
||||
3735, 33,3241, 261, 76, 44,2113, 16,2931,2184,1176, 659,3868, 26,3404,2643, // 2758
|
||||
|
|
|
@ -56,7 +56,7 @@
|
|||
|
||||
#define GB2312_TABLE_SIZE 3760
|
||||
|
||||
static PRInt16 GB2312CharToFreqOrder[] =
|
||||
static const PRInt16 GB2312CharToFreqOrder[] =
|
||||
{
|
||||
1671, 749,1443,2364,3924,3807,2330,3921,1704,3463,2691,1511,1515, 572,3191,2205,
|
||||
2361, 224,2558, 479,1711, 963,3162, 440,4060,1905,2966,2947,3580,2647,3961,3842,
|
||||
|
|
|
@ -60,7 +60,7 @@
|
|||
//Char to FreqOrder table ,
|
||||
#define JIS_TABLE_SIZE 4368
|
||||
|
||||
static PRInt16 JISCharToFreqOrder[] =
|
||||
static const PRInt16 JISCharToFreqOrder[] =
|
||||
{
|
||||
40, 1, 6, 182, 152, 180, 295,2127, 285, 381,3295,4304,3068,4606,3165,3510, // 16
|
||||
3511,1822,2785,4607,1193,2226,5070,4608, 171,2996,1247, 18, 179,5071, 856,1661, // 32
|
||||
|
|
|
@ -54,7 +54,7 @@ typedef struct
|
|||
nsPkgInt classTable;
|
||||
PRUint32 classFactor;
|
||||
nsPkgInt stateTable;
|
||||
PRUint32* charLenTable;
|
||||
const PRUint32* charLenTable;
|
||||
const char* name;
|
||||
} SMModel;
|
||||
|
||||
|
|
|
@ -82,7 +82,7 @@ PCK4BITS( 4,eError, 4, 4, 4,eError, 4,eError),//20-27
|
|||
PCK4BITS( 4,eItsMe,eStart,eStart,eStart,eStart,eStart,eStart) //28-2f
|
||||
};
|
||||
|
||||
static PRUint32 HZCharLenTable[] = {0, 0, 0, 0, 0, 0};
|
||||
static const PRUint32 HZCharLenTable[] = {0, 0, 0, 0, 0, 0};
|
||||
|
||||
SMModel HZSMModel = {
|
||||
{eIdxSft4bits, eSftMsk4bits, eBitSft4bits, eUnitMsk4bits, HZ_cls },
|
||||
|
@ -140,7 +140,7 @@ PCK4BITS(eError,eError,eError,eItsMe,eError,eError,eError,eError),//30-37
|
|||
PCK4BITS(eError,eError,eError,eError,eError,eItsMe,eError,eStart) //38-3f
|
||||
};
|
||||
|
||||
static PRUint32 ISO2022CNCharLenTable[] = {0, 0, 0, 0, 0, 0, 0, 0, 0};
|
||||
static const PRUint32 ISO2022CNCharLenTable[] = {0, 0, 0, 0, 0, 0, 0, 0, 0};
|
||||
|
||||
SMModel ISO2022CNSMModel = {
|
||||
{eIdxSft4bits, eSftMsk4bits, eBitSft4bits, eUnitMsk4bits, ISO2022CN_cls },
|
||||
|
@ -195,7 +195,7 @@ PCK4BITS(eError,eError,eError,eError,eItsMe,eError,eItsMe,eError),//20-27
|
|||
PCK4BITS(eError,eError,eError,eError,eItsMe,eItsMe,eError,eError) //28-2f
|
||||
};
|
||||
|
||||
static PRUint32 ISO2022JPCharLenTable[] = {0, 0, 0, 0, 0, 0, 0, 0};
|
||||
static const PRUint32 ISO2022JPCharLenTable[] = {0, 0, 0, 0, 0, 0, 0, 0};
|
||||
|
||||
SMModel ISO2022JPSMModel = {
|
||||
{eIdxSft4bits, eSftMsk4bits, eBitSft4bits, eUnitMsk4bits, ISO2022JP_cls },
|
||||
|
@ -249,7 +249,7 @@ PCK4BITS(eError,eError,eError,eError, 5,eError,eError,eError),//18-1f
|
|||
PCK4BITS(eError,eError,eError,eItsMe,eStart,eStart,eStart,eStart) //20-27
|
||||
};
|
||||
|
||||
static PRUint32 ISO2022KRCharLenTable[] = {0, 0, 0, 0, 0, 0};
|
||||
static const PRUint32 ISO2022KRCharLenTable[] = {0, 0, 0, 0, 0, 0};
|
||||
|
||||
SMModel ISO2022KRSMModel = {
|
||||
{eIdxSft4bits, eSftMsk4bits, eBitSft4bits, eUnitMsk4bits, ISO2022KR_cls },
|
||||
|
|
|
@ -88,7 +88,7 @@ PCK4BITS(eError,eError,eItsMe,eItsMe,eItsMe,eItsMe,eItsMe,eError),//08-0f
|
|||
PCK4BITS(eError,eStart,eStart,eStart,eStart,eStart,eStart,eStart) //10-17
|
||||
};
|
||||
|
||||
static PRUint32 Big5CharLenTable[] = {0, 1, 1, 2, 0};
|
||||
static const PRUint32 Big5CharLenTable[] = {0, 1, 1, 2, 0};
|
||||
|
||||
SMModel Big5SMModel = {
|
||||
{eIdxSft4bits, eSftMsk4bits, eBitSft4bits, eUnitMsk4bits, BIG5_cls },
|
||||
|
@ -143,7 +143,7 @@ PCK4BITS(eError,eError,eStart,eError,eError,eError, 3,eError),//18-1f
|
|||
PCK4BITS( 3,eError,eError,eError,eStart,eStart,eStart,eStart) //20-27
|
||||
};
|
||||
|
||||
static PRUint32 EUCJPCharLenTable[] = {2, 2, 2, 3, 1, 0};
|
||||
static const PRUint32 EUCJPCharLenTable[] = {2, 2, 2, 3, 1, 0};
|
||||
|
||||
SMModel EUCJPSMModel = {
|
||||
{eIdxSft4bits, eSftMsk4bits, eBitSft4bits, eUnitMsk4bits, EUCJP_cls },
|
||||
|
@ -195,7 +195,7 @@ PCK4BITS(eError,eStart, 3,eError,eError,eError,eError,eError),//00-07
|
|||
PCK4BITS(eItsMe,eItsMe,eItsMe,eItsMe,eError,eError,eStart,eStart) //08-0f
|
||||
};
|
||||
|
||||
static PRUint32 EUCKRCharLenTable[] = {0, 1, 2, 0};
|
||||
static const PRUint32 EUCKRCharLenTable[] = {0, 1, 2, 0};
|
||||
|
||||
SMModel EUCKRSMModel = {
|
||||
{eIdxSft4bits, eSftMsk4bits, eBitSft4bits, eUnitMsk4bits, EUCKR_cls },
|
||||
|
@ -251,7 +251,7 @@ PCK4BITS( 5,eError,eError,eError,eStart,eError,eStart,eStart),//20-27
|
|||
PCK4BITS(eStart,eError,eStart,eStart,eStart,eStart,eStart,eStart) //28-2f
|
||||
};
|
||||
|
||||
static PRUint32 EUCTWCharLenTable[] = {0, 0, 1, 2, 2, 2, 3};
|
||||
static const PRUint32 EUCTWCharLenTable[] = {0, 0, 1, 2, 2, 2, 3};
|
||||
|
||||
SMModel EUCTWSMModel = {
|
||||
{eIdxSft4bits, eSftMsk4bits, eBitSft4bits, eUnitMsk4bits, EUCTW_cls },
|
||||
|
@ -304,7 +304,7 @@ PCK4BITS(eError,eStart, 3,eError,eError,eError,eError,eError),//00-07
|
|||
PCK4BITS(eItsMe,eItsMe,eItsMe,eItsMe,eError,eError,eStart,eStart) //08-0f
|
||||
};
|
||||
|
||||
static PRUint32 GB2312CharLenTable[] = {0, 1, 2, 0};
|
||||
static const PRUint32 GB2312CharLenTable[] = {0, 1, 2, 0};
|
||||
|
||||
SMModel GB2312SMModel = {
|
||||
{eIdxSft4bits, eSftMsk4bits, eBitSft4bits, eUnitMsk4bits, GB2312_cls },
|
||||
|
@ -367,7 +367,7 @@ PCK4BITS(eError,eError,eStart,eStart,eStart,eStart,eStart,eStart) //28-2f
|
|||
// it is used for frequency analysis only, and we are validing
|
||||
// each code range there as well. So it is safe to set it to be
|
||||
// 2 here.
|
||||
static PRUint32 GB18030CharLenTable[] = {0, 1, 1, 1, 1, 1, 2};
|
||||
static const PRUint32 GB18030CharLenTable[] = {0, 1, 1, 1, 1, 1, 2};
|
||||
|
||||
SMModel GB18030SMModel = {
|
||||
{eIdxSft4bits, eSftMsk4bits, eBitSft4bits, eUnitMsk4bits, GB18030_cls },
|
||||
|
@ -424,7 +424,7 @@ PCK4BITS(eError,eError,eError,eError,eItsMe,eItsMe,eItsMe,eItsMe),//08-0f
|
|||
PCK4BITS(eItsMe,eItsMe,eError,eError,eStart,eStart,eStart,eStart) //10-17
|
||||
};
|
||||
|
||||
static PRUint32 SJISCharLenTable[] = {0, 1, 1, 2, 0, 0};
|
||||
static const PRUint32 SJISCharLenTable[] = {0, 1, 1, 2, 0, 0};
|
||||
|
||||
SMModel SJISSMModel = {
|
||||
{eIdxSft4bits, eSftMsk4bits, eBitSft4bits, eUnitMsk4bits, SJIS_cls },
|
||||
|
@ -481,7 +481,7 @@ PCK4BITS( 5, 8, 6, 6,eError, 6, 6, 6),//28-2f
|
|||
PCK4BITS( 6, 6, 6, 6,eError,eError,eStart,eStart) //30-37
|
||||
};
|
||||
|
||||
static PRUint32 UCS2BECharLenTable[] = {2, 2, 2, 0, 2, 2};
|
||||
static const PRUint32 UCS2BECharLenTable[] = {2, 2, 2, 0, 2, 2};
|
||||
|
||||
SMModel UCS2BESMModel = {
|
||||
{eIdxSft4bits, eSftMsk4bits, eBitSft4bits, eUnitMsk4bits, UCS2BE_cls },
|
||||
|
@ -537,7 +537,7 @@ PCK4BITS( 5, 5, 5,eError,eError,eError, 5, 5),//28-2f
|
|||
PCK4BITS( 5, 5, 5,eError, 5,eError,eStart,eStart) //30-37
|
||||
};
|
||||
|
||||
static PRUint32 UCS2LECharLenTable[] = {2, 2, 2, 2, 2, 2};
|
||||
static const PRUint32 UCS2LECharLenTable[] = {2, 2, 2, 2, 2, 2};
|
||||
|
||||
SMModel UCS2LESMModel = {
|
||||
{eIdxSft4bits, eSftMsk4bits, eBitSft4bits, eUnitMsk4bits, UCS2LE_cls },
|
||||
|
@ -614,7 +614,7 @@ PCK4BITS(eError,eError,eStart,eStart,eStart,eStart,eError,eError),//c0-c7
|
|||
PCK4BITS(eError,eError,eError,eError,eError,eError,eError,eError) //c8-cf
|
||||
};
|
||||
|
||||
static PRUint32 UTF8CharLenTable[] = {0, 1, 0, 0, 0, 0, 2, 3,
|
||||
static const PRUint32 UTF8CharLenTable[] = {0, 1, 0, 0, 0, 0, 2, 3,
|
||||
3, 3, 4, 4, 5, 5, 6, 6 };
|
||||
|
||||
SMModel UTF8SMModel = {
|
||||
|
|
Загрузка…
Ссылка в новой задаче