View Issue Details

IDProjectCategoryView StatusLast Update
0002519Far Manager_Commonpublic2014-06-15 09:25
ReporterSEt Assigned ToDrKnS  
PrioritynormalSeverityfeatureReproducibilityN/A
Status closedResolutionfixed 
Product Version3.0 
Fixed in Version3.0 
Summary0002519: const для неизменных глобальных данных
DescriptionПредлагаю расставлять const для неизменяемых глобальных данных. Это переводит их из секции .data в секцию .rdata, несколько уменьшает потребление памяти при нескольких запущенных процессах, позволяет оптимизатору выкидывать их при линковке при неиспользовании, да и вообще правильно.

Данный diff в основном затрагивает UCD таблицы.
TagsNo tags attached.
Build3845

Activities

SEt

2013-10-31 10:44

reporter  

const.diff (29,145 bytes)   
Index: UCD/JpCntx.cpp
===================================================================
--- UCD/JpCntx.cpp	(revision 11159)
+++ UCD/JpCntx.cpp	(working copy)
@@ -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,},
Index: UCD/JpCntx.h
===================================================================
--- UCD/JpCntx.h	(revision 11159)
+++ UCD/JpCntx.h	(working copy)
@@ -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
 {
Index: UCD/LangBulgarianModel.cpp
===================================================================
--- UCD/LangBulgarianModel.cpp	(revision 11159)
+++ UCD/LangBulgarianModel.cpp	(working copy)
@@ -48,7 +48,7 @@
 //this talbe is modified base on win1251BulgarianCharToOrderMap, so 
 //only number <64 is sure valid
 
-unsigned char Latin5_BulgarianCharToOrderMap[] =
+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 @@
  62,242,243,244, 58,245, 98,246,247,248,249,250,251, 91,252,253,  //f0
 };
 
-unsigned char win1251BulgarianCharToOrderMap[] =
+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 @@
 //first 1024 sequences:3.0618%
 //rest  sequences:     0.2992%
 //negative sequences:  0.0020% 
-char BulgarianLangModel[] = 
+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 @@
 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 @@
   "ISO-8859-5"
 };
 
-SequenceModel Win1251BulgarianModel = 
+const SequenceModel Win1251BulgarianModel = 
 {
   win1251BulgarianCharToOrderMap,
   BulgarianLangModel,
Index: UCD/LangCyrillicModel.cpp
===================================================================
--- UCD/LangCyrillicModel.cpp	(revision 11159)
+++ UCD/LangCyrillicModel.cpp	(working copy)
@@ -41,7 +41,7 @@
 
 //KOI8-R language model
 //Character Mapping Table:
-unsigned char KOI8R_CharToOrderMap[] =
+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 @@
  35, 43, 45, 32, 40, 52, 56, 33, 61, 62, 51, 57, 47, 63, 50, 70,  //f0
 };
 
-unsigned char win1251_CharToOrderMap[] =
+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 @@
   9,  7,  6, 14, 39, 26, 28, 22, 25, 29, 54, 18, 17, 30, 27, 16,
 };
 
-unsigned char latin5_CharToOrderMap[] =
+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 @@
 239, 68,240,241,242,243,244,245,246,247,248,249,250,251,252,255,
 };
 
-unsigned char macCyrillic_CharToOrderMap[] =
+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 @@
   9,  7,  6, 14, 39, 26, 28, 22, 25, 29, 54, 18, 17, 30, 27,255,
 };
 
-unsigned char IBM855_CharToOrderMap[] =
+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 @@
 250, 18, 62, 20, 51, 25, 57, 30, 47, 29, 63, 22, 50,251,252,255,
 };
 
-unsigned char IBM866_CharToOrderMap[] =
+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 @@
 //first 1024 sequences: 2.3389%
 //rest  sequences:      0.1237%
 //negative sequences:   0.0009% 
-char RussianLangModel[] = 
+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 @@
 };
 
 
-SequenceModel Koi8rModel = 
+const SequenceModel Koi8rModel = 
 {
   KOI8R_CharToOrderMap,
   RussianLangModel,
@@ -309,7 +309,7 @@
   "KOI8-R"
 };
 
-SequenceModel Win1251Model = 
+const SequenceModel Win1251Model = 
 {
   win1251_CharToOrderMap,
   RussianLangModel,
@@ -318,7 +318,7 @@
   "windows-1251"
 };
 
-SequenceModel Latin5Model = 
+const SequenceModel Latin5Model = 
 {
   latin5_CharToOrderMap,
   RussianLangModel,
@@ -327,7 +327,7 @@
   "ISO-8859-5"
 };
 
-SequenceModel MacCyrillicModel = 
+const SequenceModel MacCyrillicModel = 
 {
   macCyrillic_CharToOrderMap,
   RussianLangModel,
@@ -336,7 +336,7 @@
   "x-mac-cyrillic"
 };
 
-SequenceModel Ibm866Model = 
+const SequenceModel Ibm866Model = 
 {
   IBM866_CharToOrderMap,
   RussianLangModel,
@@ -345,7 +345,7 @@
   "IBM866"
 };
 
-SequenceModel Ibm855Model = 
+const SequenceModel Ibm855Model = 
 {
   IBM855_CharToOrderMap,
   RussianLangModel,
Index: UCD/LangGreekModel.cpp
===================================================================
--- UCD/LangGreekModel.cpp	(revision 11159)
+++ UCD/LangGreekModel.cpp	(working copy)
@@ -45,7 +45,7 @@
 *****************************************************************/
 
 //Character Mapping Table:
-unsigned char Latin7_CharToOrderMap[] =
+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 win1253_CharToOrderMap[] =
+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 @@
 //first 1024 sequences:1.7001%
 //rest  sequences:     0.0359%
 //negative sequences:  0.0148% 
-char GreekLangModel[] = 
+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 @@
 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 @@
   "ISO-8859-7"
 };
 
-SequenceModel Win1253Model = 
+const SequenceModel Win1253Model = 
 {
   win1253_CharToOrderMap,
   GreekLangModel,
Index: UCD/LangHebrewModel.cpp
===================================================================
--- UCD/LangHebrewModel.cpp	(revision 11159)
+++ UCD/LangHebrewModel.cpp	(working copy)
@@ -19,8 +19,8 @@
  * Portions created by the Initial Developer are Copyright (C) 2005
  * the Initial Developer. All Rights Reserved.
  *
- * Contributor(s):
- *          Shoshannah Forbes <xslf@xslf.com>
+ * Contributor(s):
+ *          Shoshannah Forbes <xslf@xslf.com>
  *          Shy Shalom <shooshX@gmail.com>
  *
  * Alternatively, the contents of this file may be used under the terms of
@@ -50,7 +50,7 @@
 
 //Windows-1255 language model
 //Character Mapping Table:
-unsigned char win1255_CharToOrderMap[] =
+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 @@
 //first 1024 sequences: 1.5981%
 //rest  sequences:      0.087%
 //negative sequences:   0.0015% 
-char HebrewLangModel[] = 
+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 @@
 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,
Index: UCD/LangHungarianModel.cpp
===================================================================
--- UCD/LangHungarianModel.cpp	(revision 11159)
+++ UCD/LangHungarianModel.cpp	(working copy)
@@ -45,7 +45,7 @@
 *****************************************************************/
 
 //Character Mapping Table:
-unsigned char Latin2_HungarianCharToOrderMap[] =
+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 @@
 245,246,247, 25, 73, 42, 24,248,249,250, 31, 56, 29,251,252,253,
 };
 
-unsigned char win1250HungarianCharToOrderMap[] =
+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 @@
 //first 1024 sequences:5.2623%
 //rest  sequences:     0.8894%
 //negative sequences:  0.0009% 
-char HungarianLangModel[] = 
+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 @@
 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 @@
   "ISO-8859-2"
 };
 
-SequenceModel Win1250HungarianModel = 
+const SequenceModel Win1250HungarianModel = 
 {
   win1250HungarianCharToOrderMap,
   HungarianLangModel,
Index: UCD/LangThaiModel.cpp
===================================================================
--- UCD/LangThaiModel.cpp	(revision 11159)
+++ UCD/LangThaiModel.cpp	(working copy)
@@ -49,7 +49,7 @@
 //The following result for thai was collected from a limited sample (1M). 
 
 //Character Mapping Table:
-unsigned char TIS620CharToOrderMap[] =
+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 @@
 //first 1024 sequences:7.3177%
 //rest  sequences:     1.0230%
 //negative sequences:  0.0436% 
-char ThaiLangModel[] = 
+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 @@
 };
 
 
-SequenceModel TIS620ThaiModel = 
+const SequenceModel TIS620ThaiModel = 
 {
   TIS620CharToOrderMap,
   ThaiLangModel,
Index: UCD/nsCodingStateMachine.h
===================================================================
--- UCD/nsCodingStateMachine.h	(revision 11159)
+++ UCD/nsCodingStateMachine.h	(working copy)
@@ -59,7 +59,7 @@
 
 class nsCodingStateMachine {
 public:
-  nsCodingStateMachine(SMModel* sm){
+  nsCodingStateMachine(const SMModel* sm){
           mCurrentState = eStart;
           mModel = sm;
         }
@@ -86,23 +86,23 @@
   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 SMModel UCS2BESMModel;
+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 const SMModel UCS2BESMModel;
 
 
-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__ */
 
Index: UCD/nsEscSM.cpp
===================================================================
--- UCD/nsEscSM.cpp	(revision 11159)
+++ UCD/nsEscSM.cpp	(working copy)
@@ -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 @@
 };
 
 
-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 @@
 
 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 @@
 };
 
 
-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 @@
 };
 
 
-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 @@
 
 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 @@
   "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 @@
 };
 
 
-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 @@
 
 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 @@
   "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 @@
 };
 
 
-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 @@
 
 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 },
Index: UCD/nsMBCSSM.cpp
===================================================================
--- UCD/nsMBCSSM.cpp	(revision 11159)
+++ UCD/nsMBCSSM.cpp	(working copy)
@@ -44,7 +44,7 @@
 
 // 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 @@
 };
 
 
-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 @@
 
 static const PRUint32 Big5CharLenTable[] = {0, 1, 1, 2, 0};
 
-SMModel Big5SMModel = {
+const SMModel Big5SMModel = {
   {eIdxSft4bits, eSftMsk4bits, eBitSft4bits, eUnitMsk4bits, BIG5_cls },
     5,
   {eIdxSft4bits, eSftMsk4bits, eBitSft4bits, eUnitMsk4bits, BIG5_st },
@@ -97,7 +97,7 @@
   "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 @@
 };
 
 
-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 @@
 
 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 @@
   "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,7 +189,7 @@
 };
 
 
-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 
 };
@@ -196,7 +196,7 @@
 
 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 @@
   "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 @@
 };
 
 
-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 @@
 
 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 @@
 
 // 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 @@
 };
 
 
-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 @@
 // 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 @@
 
 // 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 @@
 };
 
 
-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 @@
 
 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 @@
 };
 
 
-static PRUint32 UCS2BE_cls [ 256 / 8 ] = {
+static const PRUint32 UCS2BE_cls [ 256 / 8 ] = {
 PCK4BITS(0,0,0,0,0,0,0,0),  // 00 - 07 
 PCK4BITS(0,0,1,0,0,2,0,0),  // 08 - 0f 
 PCK4BITS(0,0,0,0,0,0,0,0),  // 10 - 17 
@@ -470,7 +470,7 @@
 };
 
 
-static PRUint32 UCS2BE_st [ 7] = {
+static const PRUint32 UCS2BE_st [ 7] = {
 PCK4BITS(     5,     7,     7,eError,     4,     3,eError,eError),//00-07 
 PCK4BITS(eError,eError,eError,eError,eItsMe,eItsMe,eItsMe,eItsMe),//08-0f 
 PCK4BITS(eItsMe,eItsMe,     6,     6,     6,     6,eError,eError),//10-17 
@@ -482,7 +482,7 @@
 
 static const PRUint32 UCS2BECharLenTable[] = {2, 2, 2, 0, 2, 2};
 
-SMModel UCS2BESMModel = {
+const SMModel UCS2BESMModel = {
   {eIdxSft4bits, eSftMsk4bits, eBitSft4bits, eUnitMsk4bits, UCS2BE_cls },
    6,
   {eIdxSft4bits, eSftMsk4bits, eBitSft4bits, eUnitMsk4bits, UCS2BE_st },
@@ -490,7 +490,7 @@
   "UTF-16BE",
 };
 
-static PRUint32 UCS2LE_cls [ 256 / 8 ] = {
+static const PRUint32 UCS2LE_cls [ 256 / 8 ] = {
 PCK4BITS(0,0,0,0,0,0,0,0),  // 00 - 07 
 PCK4BITS(0,0,1,0,0,2,0,0),  // 08 - 0f 
 PCK4BITS(0,0,0,0,0,0,0,0),  // 10 - 17 
@@ -526,7 +526,7 @@
 };
 
 
-static PRUint32 UCS2LE_st [ 7] = {
+static const PRUint32 UCS2LE_st [ 7] = {
 PCK4BITS(     6,     6,     7,     6,     4,     3,eError,eError),//00-07 
 PCK4BITS(eError,eError,eError,eError,eItsMe,eItsMe,eItsMe,eItsMe),//08-0f 
 PCK4BITS(eItsMe,eItsMe,     5,     5,     5,eError,eItsMe,eError),//10-17 
@@ -538,7 +538,7 @@
 
 static const PRUint32 UCS2LECharLenTable[] = {2, 2, 2, 2, 2, 2};
 
-SMModel UCS2LESMModel = {
+const SMModel UCS2LESMModel = {
   {eIdxSft4bits, eSftMsk4bits, eBitSft4bits, eUnitMsk4bits, UCS2LE_cls },
    6,
   {eIdxSft4bits, eSftMsk4bits, eBitSft4bits, eUnitMsk4bits, UCS2LE_st },
@@ -547,7 +547,7 @@
 };
 
 
-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 
@@ -584,7 +584,7 @@
 };
 
 
-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 
@@ -616,7 +616,7 @@
 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 },
Index: UCD/nsPkgInt.h
===================================================================
--- UCD/nsPkgInt.h	(revision 11159)
+++ UCD/nsPkgInt.h	(working copy)
@@ -68,7 +68,7 @@
   nsSftMsk  sftmsk;
   nsBitSft  bitsft;
   nsUnitMsk unitmsk;
-  PRUint32  *data;
+  const PRUint32  *data;
 } nsPkgInt;
 
 
Index: UCD/nsSBCharSetProber.h
===================================================================
--- UCD/nsSBCharSetProber.h	(revision 11159)
+++ UCD/nsSBCharSetProber.h	(working copy)
@@ -51,8 +51,8 @@
 
 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 *charToOrderMap;    // [256] table use to find a char's order
+  const char *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;
@@ -61,9 +61,9 @@
 
 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();
@@ -106,19 +106,19 @@
 };
 
 
-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__ */
 
Index: plclass.cpp
===================================================================
--- plclass.cpp	(revision 11159)
+++ plclass.cpp	(working copy)
@@ -290,7 +290,7 @@
 	}
 }
 
-FarStandardFunctions NativeFSF =
+const FarStandardFunctions NativeFSF =
 {
 	sizeof(NativeFSF),
 	pluginapi::apiAtoi,
@@ -345,7 +345,7 @@
 	pluginapi::apiFormatFileSize,
 };
 
-PluginStartupInfo NativeInfo =
+const PluginStartupInfo NativeInfo =
 {
 	sizeof(NativeInfo),
 	nullptr, //ModuleName, dynamic
Index: plclass.hpp
===================================================================
--- plclass.hpp	(revision 11159)
+++ plclass.hpp	(working copy)
@@ -76,8 +76,8 @@
 };
 
 
-extern PluginStartupInfo NativeInfo;
-extern FarStandardFunctions NativeFSF;
+extern const PluginStartupInfo NativeInfo;
+extern const FarStandardFunctions NativeFSF;
 
 class GenericPluginModel
 {
const.diff (29,145 bytes)   

DrKnS

2013-10-31 10:49

administrator   bugnote:0011518

UCD-таблицы не наши, в общем случае их лучше не трогать.

DrKnS

2014-06-15 09:25

administrator   bugnote:0012508

В билдах 3845 и выше используется более актуальная версия UCD, const там уже расставлены мозиллой.

Issue History

Date Modified Username Field Change
2013-10-31 10:44 SEt New Issue
2013-10-31 10:44 SEt File Added: const.diff
2013-10-31 10:49 DrKnS Note Added: 0011518
2014-06-15 09:25 DrKnS Build => 3845
2014-06-15 09:25 DrKnS Note Added: 0012508
2014-06-15 09:25 DrKnS Status new => closed
2014-06-15 09:25 DrKnS Assigned To => DrKnS
2014-06-15 09:25 DrKnS Resolution open => fixed
2014-06-15 09:25 DrKnS Fixed in Version => 3.0