зеркало из https://github.com/mozilla/gecko-dev.git
Changed from char types to PRUint8.
This commit is contained in:
Родитель
866a639772
Коммит
5d6d24cce9
|
@ -1,3 +1,17 @@
|
|||
/*
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Intel Corporation.
|
||||
*/
|
||||
// =======================================================================
|
||||
// Original Author: Yueheng Xu
|
||||
// email: yueheng.xu@intel.com
|
||||
|
@ -6,8 +20,13 @@
|
|||
// Last Update: September 7, 1999
|
||||
// Revision History:
|
||||
// 09/07/1999 - initial version.
|
||||
// =======================================================================
|
||||
// This table maps the GBK code to its unicode.
|
||||
// 09/28/1999 - changed leftbyte and rightbyte from char to unsigned char
|
||||
// in struct DByte
|
||||
// 04/10/1999 - changed leftbyte. rightbyte to PRUint8 in struct DByte;
|
||||
// added table UnicodeToGBKTable[0x5200]
|
||||
//
|
||||
// ======================================================================================
|
||||
// Table GBKToUnicode[] maps the GBK code to its unicode.
|
||||
// The mapping data of this GBK table is obtained from
|
||||
// ftp://ftp.unicode.org/Public/MAPPINGS/VENDORS/MICSFT/WINDOWS/CP936.TXT
|
||||
// Frank Tang of Netscape wrote the original perl tool to re-align the
|
||||
|
@ -19,6 +38,12 @@
|
|||
// [0x40, 0xfe] for the right byte. Those invalid chars whose right byte
|
||||
// is 0x7f will be mapped to undefined unicode 0xFFFF.
|
||||
//
|
||||
//
|
||||
// Table UnicodeToGBK[] maps the unicode to GBK code. To reduce memory usage, we
|
||||
// only do Unicode to GBK table mapping for unicode between 0x4E00 and 0xA000;
|
||||
// Others let converter to do search from table GBKToUnicode[]. If we want further
|
||||
// trade memory for performance, we can let more unicode to do table mapping to get
|
||||
// its GBK instead of searching table GBKToUnicode[].
|
||||
|
||||
#ifdef _GBKU_TABLE_
|
||||
|
||||
|
@ -27,12 +52,18 @@
|
|||
|
||||
typedef struct
|
||||
{
|
||||
char leftbyte;
|
||||
char rightbyte;
|
||||
|
||||
PRUint8 leftbyte;
|
||||
PRUint8 rightbyte;
|
||||
|
||||
} DByte;
|
||||
extern PRUnichar GBKToUnicodeTable[MAX_GBK_LENGTH];
|
||||
|
||||
#ifdef _UNICODE_TO_GBK_ENCODER_
|
||||
DByte UnicodeToGBKTable[0x5200];
|
||||
#else
|
||||
extern DByte UnicodeToGBKTable[0x5200]; // 0xA000 - 0x4E00 = 0x5200
|
||||
#endif
|
||||
|
||||
#else
|
||||
|
||||
|
@ -42,10 +73,10 @@ extern PRUnichar GBKToUnicodeTable[MAX_GBK_LENGTH];
|
|||
#define GB_UNDEFINED 0xFFFF
|
||||
#define MAX_GBK_LENGTH 24066 /* (0xfe-0x80)*(0xfe-0x3f) */
|
||||
|
||||
typedef struct
|
||||
{
|
||||
char leftbyte;
|
||||
char rightbyte;
|
||||
typedef struct
|
||||
{
|
||||
PRUint8 leftbyte;
|
||||
PRUint8 rightbyte;
|
||||
|
||||
} DByte;
|
||||
|
||||
|
@ -57,6 +88,12 @@ PRUnichar GBKToUnicodeTable[MAX_GBK_LENGTH] =
|
|||
};
|
||||
|
||||
|
||||
#ifdef _UNICODE_TO_GBK_ENCODER_
|
||||
DByte UnicodeToGBKTable[0x5200];
|
||||
#else
|
||||
extern DByte UnicodeToGBKTable[0x5200]; // 0xA000 - 0x4E00 = 0x5200
|
||||
#endif
|
||||
|
||||
|
||||
#endif /* ifdef _GBKU_TABLE_ */
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче