fix 74941. clean up massy code in the header and cpp files

This commit is contained in:
ftang%netscape.com 2001-04-11 23:52:46 +00:00
Родитель c68bc0e2b0
Коммит 9f53bb536b
16 изменённых файлов: 24 добавлений и 139 удалений

Просмотреть файл

@ -53,59 +53,20 @@
// 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_
#ifndef _GBKU_H__
#define _GBKU_H__
#define GB_UNDEFINED 0xFFFF
#define MAX_GBK_LENGTH 24066 /* (0xfe-0x80)*(0xfe-0x3f) */
typedef struct
{
PRUint8 leftbyte;
PRUint8 rightbyte;
} DByte;
extern PRUnichar GBKToUnicodeTable[MAX_GBK_LENGTH];
extern DByte UnicodeToGBKTable[0x5200]; // 0xA000 - 0x4E00 = 0x5200
extern PRBool gUnicodeToGBKTableInitialized;
#ifdef _UNICODE_TO_GBK_ENCODER_
DByte UnicodeToGBKTable[0x5200];
PRUint16 gUnicodeToGBKTableInitialized = PR_FALSE; // default to not initialized yet
#else
extern DByte UnicodeToGBKTable[0x5200]; // 0xA000 - 0x4E00 = 0x5200
extern PRUint16 gUnicodeToGBKTableInitialized;
#endif
#else
#define _GBKU_TABLE_
#define GB_UNDEFINED 0xFFFF
#define MAX_GBK_LENGTH 24066 /* (0xfe-0x80)*(0xfe-0x3f) */
typedef struct
{
PRUint8 leftbyte;
PRUint8 rightbyte;
} DByte;
PRUnichar GBKToUnicodeTable[MAX_GBK_LENGTH] =
{
#include "cp936map.h"
};
#ifdef _UNICODE_TO_GBK_ENCODER_
DByte UnicodeToGBKTable[0x5200];
PRUint16 gUnicodeToGBKTableInitialized = PR_FALSE; // default to not initialized yet
#else
extern DByte UnicodeToGBKTable[0x5200]; // 0xA000 - 0x4E00 = 0x5200
extern PRUint16 gUnicodeToGBKTableInitialized;
#endif
#endif /* ifdef _GBKU_TABLE_ */
#endif /* _GBKU_H__ */

Просмотреть файл

@ -38,8 +38,6 @@
#include "nsGB2312ToUnicodeV2.h"
#include "nsUCvCnDll.h"
#define _GBKU_TABLE_ // to use a shared GBKU table
#include "gbku.h"
//----------------------------------------------------------------------

Просмотреть файл

@ -24,7 +24,7 @@
#define nsGB2312ToUnicodeV2_h___
#include "nsUCvCnSupport.h"
#include "gbku.h"
//----------------------------------------------------------------------
// Class nsGB2312ToUnicodeV2 [declaration]
@ -56,15 +56,6 @@ protected:
NS_IMETHOD GetMaxLength(const char * aSrc, PRInt32 aSrcLength,
PRInt32 * aDestLength);
private:
typedef struct
{
char leftbyte;
char rightbyte;
} DByte;
};

Просмотреть файл

@ -56,15 +56,6 @@ protected:
PRInt32 * aDestLength);
private:
typedef struct
{
char leftbyte;
char rightbyte;
} DByte;
};
#endif /* nsGBK2312ToUnicode_h___ */

Просмотреть файл

@ -48,8 +48,6 @@
#include "nsUCvCnDll.h"
#include "nsHZToUnicode.h"
#define _GBKU_TABLE_ // to use a shared GBKU table
#include "gbku.h"
//----------------------------------------------------------------------

Просмотреть файл

@ -24,6 +24,7 @@
#define nsHZToUnicode_h___
#include "nsUCvCnSupport.h"
#include "gbku.h"
//----------------------------------------------------------------------
// Class nsHZToUnicode [declaration]
@ -57,13 +58,6 @@ protected:
PRInt32 * aDestLength);
private:
typedef struct
{
PRUint8 leftbyte;
PRUint8 rightbyte;
} DByte;
void HZToUnicode(DByte *pGBCode, PRUnichar * pUnicode);
void GBToUnicode(DByte *pGBCode, PRUnichar * pUnicode);

Просмотреть файл

@ -46,6 +46,7 @@
#include "nsGB2312ToUnicodeV2.h"
#include "nsUnicodeToGB2312V2.h"
#include "nsUnicodeToGB2312GL.h"
#include "gbku.h"
//----------------------------------------------------------------------------
// Global functions and data [declaration]
@ -58,6 +59,18 @@ static NS_DEFINE_CID(kComponentManagerCID, NS_COMPONENTMANAGER_CID);
PRInt32 g_InstanceCount = 0;
PRInt32 g_LockCount = 0;
//----------------------------------------------------------------------------
// shared data defined in gbku.h
PRUnichar GBKToUnicodeTable[MAX_GBK_LENGTH] =
{
#include "cp936map.h"
};
DByte UnicodeToGBKTable[0x5200]; // 0xA000 - 0x4E00 = 0x5200
PRBool gUnicodeToGBKTableInitialized = PR_FALSE;
//----------------------------------------------------------------------------
NS_IMPL_NSUCONVERTERREGSELF

Просмотреть файл

@ -24,16 +24,11 @@
#include "nsUnicodeToGB2312GL.h"
#include "nsUCvCnDll.h"
#define _GBKU_TABLE_ // use a shared table
#include "gbku.h"
//----------------------------------------------------------------------
// Class nsUnicodeToGB2312GL [implementation]
#define TRUE 1
#define FALSE 0
nsUnicodeToGB2312GL::nsUnicodeToGB2312GL()
{
PRUint8 left, right;
@ -71,7 +66,6 @@ NS_IMETHODIMP nsUnicodeToGB2312GL::ConvertNoBuff(const PRUnichar * aSrc,
PRInt32 i=0;
PRInt32 iSrcLength = 0;
DByte *pDestDBCode;
DByte *pSrcDBCode;
PRInt32 iDestLength = 0;
PRUnichar unicode;
PRUint8 left, right;

Просмотреть файл

@ -25,7 +25,7 @@
#define nsUnicodeToGB2312GL_h___
#include "nsUCvCnSupport.h"
#include "gbku.h"
//----------------------------------------------------------------------
// Class nsUnicodeToGB2312GL [declaration]
@ -65,15 +65,6 @@ protected:
NS_IMETHOD FillInfo(PRUint32 *aInfo);
private:
typedef struct
{
char leftbyte;
char rightbyte;
} DByte;
};

Просмотреть файл

@ -23,16 +23,10 @@
#include "nsUnicodeToGB2312V2.h"
#include "nsUCvCnDll.h"
#define _GBKU_TABLE_ // use a shared table
#include "gbku.h"
//----------------------------------------------------------------------
// Class nsUnicodeToGB2312V2 [implementation]
#define TRUE 1
#define FALSE 0
nsUnicodeToGB2312V2::nsUnicodeToGB2312V2()
{
PRUint8 left, right;
@ -70,7 +64,6 @@ NS_IMETHODIMP nsUnicodeToGB2312V2::ConvertNoBuff(const PRUnichar * aSrc,
PRInt32 i=0;
PRInt32 iSrcLength = 0;
DByte *pDestDBCode;
DByte *pSrcDBCode;
PRInt32 iDestLength = 0;
PRUnichar unicode;
PRUint8 left, right;

Просмотреть файл

@ -64,15 +64,6 @@ protected:
NS_IMETHOD FillInfo(PRUint32 *aInfo);
private:
typedef struct
{
char leftbyte;
char rightbyte;
} DByte;
};
#endif /* nsUnicodeToGB2312V2_h___ */

Просмотреть файл

@ -32,17 +32,11 @@
#include "nsUnicodeToGBK.h"
#include "nsUCvCnDll.h"
#define _UNICODE_TO_GBK_ENCODER_ // this is the place we allocate memory for UnicodeToGBKTable[0xFFFF]
#define _GBKU_TABLE_ // to use a shared GBKU table
#include "gbku.h"
//----------------------------------------------------------------------
// Class nsUnicodeToGBK [implementation]
#define TRUE 1
#define FALSE 0
nsUnicodeToGBK::nsUnicodeToGBK()
{
PRUint8 left, right;
@ -82,7 +76,6 @@ NS_IMETHODIMP nsUnicodeToGBK::ConvertNoBuff(const PRUnichar * aSrc,
PRInt32 i=0;
PRInt32 iSrcLength = 0;
DByte *pDestDBCode;
DByte *pSrcDBCode;
PRInt32 iDestLength = 0;
PRUnichar unicode;
PRUint8 left, right;

Просмотреть файл

@ -32,7 +32,7 @@
#define nsUnicodeToGBK_h___
#include "nsUCvCnSupport.h"
#include "gbku.h"
//----------------------------------------------------------------------
// Class nsUnicodeToGBK [declaration]
@ -65,15 +65,6 @@ protected:
NS_IMETHOD FillInfo(PRUint32 *aInfo);
private:
typedef struct
{
char leftbyte;
char rightbyte;
} DByte;
};
#endif /* nsUnicodeToGBK_h___ */

Просмотреть файл

@ -42,11 +42,6 @@ class nsUnicodeToGBKNoAscii: public nsUnicodeToGBK
NS_IMETHOD FillInfo(PRUint32 *aInfo);
protected:
private:
};
#endif /* nsUnicodeToGBKNoAscii_h___ */

Просмотреть файл

@ -36,8 +36,6 @@
#include "nsUnicodeToHZ.h"
#include "nsUCvCnDll.h"
#define _GBKU_TABLE_ // to use a shared GBKU table
#include "gbku.h"
//----------------------------------------------------------------------

Просмотреть файл

@ -32,7 +32,7 @@
#define nsUnicodeToHZ_h___
#include "nsUCvCnSupport.h"
#include "gbku.h"
//----------------------------------------------------------------------
// Class nsUnicodeToHZ [declaration]
@ -66,13 +66,6 @@ protected:
PRInt32 * aDestLength);
private:
typedef struct
{
PRUint8 leftbyte;
PRUint8 rightbyte;
} DByte;
void UnicodeToHZ(PRUnichar SrcUnicode, DByte *pGBCode);
void UnicodeToGBK(PRUnichar SrcUnicode, DByte *pGBCode);