fix for bug 157993 - combine all unicode converters into a single library, and share GetMaxLength() implementation between all converters that can support it.

r=ftang, sr=blizzard
This commit is contained in:
alecf%netscape.com 2002-08-12 19:16:16 +00:00
Родитель c5507153ab
Коммит a2acf86c80
354 изменённых файлов: 8007 добавлений и 3405 удалений

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

@ -1748,13 +1748,6 @@ sub BuildInternationalProjects()
BuildOneProject(":mozilla:intl:chardet:macbuild:chardet.xml", "chardet$D.$S", 1, $main::ALIAS_SYM_FILES, 1);
BuildOneProject(":mozilla:intl:uconv:macbuild:uconv.xml", "uconv$D.$S", 1, $main::ALIAS_SYM_FILES, 1);
BuildOneProject(":mozilla:intl:uconv:macbuild:ucvlatin.xml", "ucvlatin$D.$S", 1, $main::ALIAS_SYM_FILES, 1);
BuildOneProject(":mozilla:intl:uconv:macbuild:ucvja.xml", "ucvja$D.$S", 1, $main::ALIAS_SYM_FILES, 1);
BuildOneProject(":mozilla:intl:uconv:macbuild:ucvtw.xml", "ucvtw$D.$S", 1, $main::ALIAS_SYM_FILES, 1);
BuildOneProject(":mozilla:intl:uconv:macbuild:ucvtw2.xml", "ucvtw2$D.$S", 1, $main::ALIAS_SYM_FILES, 1);
BuildOneProject(":mozilla:intl:uconv:macbuild:ucvcn.xml", "ucvcn$D.$S", 1, $main::ALIAS_SYM_FILES, 1);
BuildOneProject(":mozilla:intl:uconv:macbuild:ucvko.xml", "ucvko$D.$S", 1, $main::ALIAS_SYM_FILES, 1);
BuildOneProject(":mozilla:intl:uconv:macbuild:ucvibm.xml", "ucvibm$D.$S", 1, $main::ALIAS_SYM_FILES, 1);
if ($main::options{mathml})
{
BuildOneProject(":mozilla:intl:uconv:macbuild:ucvmath.xml", "ucvmath$D.$S", 1, $main::ALIAS_SYM_FILES, 1);

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

@ -209,19 +209,10 @@ Components:uconv.xpt
Components:lwbrk.shlb
Components:nslocale.shlb
Components:nslocale.xpt
Components:ucvlatin.shlb
Components:chardet.shlb
Components:chardet.xpt
Components:Universalchardet.shlb
; optional - on english only systems
; Components:ucvja.shlb for japanese
; Components:ucvko.shlb for korean
; Components:ucvcn.shlb for simplified chinese
; Components:ucvtw.shlb for traditional chinese
; Components:ucvtw2.shlb for traditional chinese
; Components:ucvibm.shlb for ibm
res:language.properties
res:langGroups.properties

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

@ -209,19 +209,10 @@ Components:uconv.xpt
Components:lwbrkDebug.shlb
Components:nslocaleDebug.shlb
Components:nslocale.xpt
Components:ucvlatinDebug.shlb
Components:chardetDebug.shlb
Components:chardet.xpt
Components:UniversalchardetDebug.shlb
; optional - on english only systems
; Components:ucvjaDebug.shlb for japanese
; Components:ucvkoDebug.shlb for korean
; Components:ucvcnDebug.shlb for simplified chinese
; Components:ucvtwDebug.shlb for traditional chinese
; Components:ucvtw2Debug.shlb for traditional chinese
; Components:ucvibmDebug.shlb for ibm
res:language.properties
res:langGroups.properties

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

@ -198,17 +198,8 @@ components/libuconv.dylib
components/uconv.xpt
components/liblwbrk.dylib
components/libnslocale.dylib
components/libucvlatin.dylib
components/unicharutil.xpt
components/libchardet.dylib
; optional - on english only systems
; components/libucvja.dylib for japanese
; components/libucvko.dylib for korean
; components/libucvcn.dylib for simplified chinese
; components/libucvtw.dylib for traditional chinese
; components/libucvtw2.dylib for traditional chinese
; components/libucvibm.dylib for ibm
res/language.properties
res/langGroups.properties

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

@ -141,16 +141,8 @@ components/libuconv.so
components/uconv.xpt
components/liblwbrk.so
components/libnslocale.so
components/libucvlatin.so
components/unicharutil.xpt
components/libchardet.so
; optional - on english only systems
; components/libucvja.so for japanese
; components/libucvko.so for korean
; components/libucvcn.so for simplified chinese
; components/libucvtw.so for traditional chinese
; components/libucvtw2.so for traditional chinese
; components/libucvibm.so for ibm
; required i18n libs
components/libstrres.so

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

@ -149,16 +149,8 @@ components\uconv.dll
components\uconv.xpt
components\lwbrk.dll
components\nslocale.dll
components\ucvlatin.dll
components\unicharutil.xpt
components\chardet.dll
; optional - on english only systems
; components\ucvja.dll for japanese
; components\ucvko.dll for korean
; components\ucvcn.dll for simplified chinese
; components\ucvtw.dll for traditional chinese
; components\ucvtw2.dll for traditional chinese
; components\ucvibm.dll for ibm
; required i18n libs
components\strres.dll

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

@ -38,7 +38,7 @@ VPATH = @srcdir@
include $(DEPTH)/config/autoconf.mk
DIRS = idl public src ucvja ucvcn ucvlatin ucvtw ucvtw2 ucvko ucvibm
DIRS = idl public util ucvja ucvcn ucvlatin ucvtw ucvtw2 ucvko ucvibm src
ifdef MOZ_MATHML
DIRS += ucvmath

Разница между файлами не показана из-за своего большого размера Загрузить разницу

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

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

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

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

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

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

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

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

@ -67,7 +67,6 @@ CPPSRCS = \
nsUnicodeToCP1252.cpp \
nsUnicodeToMacRoman.cpp \
nsUnicodeToUTF8.cpp \
nsUCvMinSupport.cpp \
nsScriptableUConv.cpp \
nsConverterInputStream.cpp \
$(NULL)
@ -120,6 +119,28 @@ ifneq (,$(filter cocoa mac, $(MOZ_WIDGET_TOOLKIT)))
EXTRA_DSO_LDOPTS += $(TK_LIBS)
endif
LOCAL_INCLUDES = -I$(srcdir)/../util \
-I$(srcdir)/../ucvlatin \
-I$(srcdir)/../ucvibm \
-I$(srcdir)/../ucvja \
-I$(srcdir)/../ucvtw2 \
-I$(srcdir)/../ucvtw \
-I$(srcdir)/../ucvko \
-I$(srcdir)/../ucvcn \
$(NULL)
SHARED_LIBRARY_LIBS = \
$(DIST)/lib/$(LIB_PREFIX)ucvutil_s.$(LIB_SUFFIX) \
$(DIST)/lib/$(LIB_PREFIX)ucvlatin_s.$(LIB_SUFFIX) \
$(DIST)/lib/$(LIB_PREFIX)ucvibm_s.$(LIB_SUFFIX) \
$(DIST)/lib/$(LIB_PREFIX)ucvutil_s.$(LIB_SUFFIX) \
$(DIST)/lib/$(LIB_PREFIX)ucvja_s.$(LIB_SUFFIX) \
$(DIST)/lib/$(LIB_PREFIX)ucvtw2_s.$(LIB_SUFFIX) \
$(DIST)/lib/$(LIB_PREFIX)ucvtw_s.$(LIB_SUFFIX) \
$(DIST)/lib/$(LIB_PREFIX)ucvko_s.$(LIB_SUFFIX) \
$(DIST)/lib/$(LIB_PREFIX)ucvcn_s.$(LIB_SUFFIX) \
$(NULL)
include $(topsrcdir)/config/rules.mk
# Reserved name __STDC__ cannot be defined as a macro name on AIX or OpenVMS.

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

@ -36,7 +36,7 @@
*
* ***** END LICENSE BLOCK ***** */
#include "nsUCvMinSupport.h"
#include "nsUCSupport.h"
#include "nsCP1252ToUnicode.h"
//----------------------------------------------------------------------

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

@ -36,7 +36,7 @@
*
* ***** END LICENSE BLOCK ***** */
#include "nsUCvMinSupport.h"
#include "nsUCSupport.h"
#include "nsISO88591ToUnicode.h"
//----------------------------------------------------------------------

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

@ -36,7 +36,7 @@
*
* ***** END LICENSE BLOCK ***** */
#include "nsUCvMinSupport.h"
#include "nsUCSupport.h"
#include "nsMacRomanToUnicode.h"
//----------------------------------------------------------------------
@ -56,18 +56,7 @@ static const PRInt16 g_MacRomanShiftTable[] = {
nsMacRomanToUnicode::nsMacRomanToUnicode()
: nsTableDecoderSupport((uShiftTable*) &g_MacRomanShiftTable,
(uMappingTable*) &g_MacRomanMappingTable)
(uMappingTable*) &g_MacRomanMappingTable, 1)
{
}
//----------------------------------------------------------------------
// Subclassing of nsTableDecoderSupport class [implementation]
NS_IMETHODIMP nsMacRomanToUnicode::GetMaxLength(const char * aSrc,
PRInt32 aSrcLength,
PRInt32 * aDestLength)
{
// we are a single byte to Unicode converter, so...
*aDestLength = aSrcLength;
return NS_OK_UDEC_EXACTLENGTH;
}

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

@ -69,11 +69,6 @@ public:
protected:
//--------------------------------------------------------------------
// Subclassing of nsDecoderSupport class [declaration]
NS_IMETHOD GetMaxLength(const char * aSrc, PRInt32 aSrcLength,
PRInt32 * aDestLength);
};
#endif /* nsMacRomanToUnicode_h___ */

Разница между файлами не показана из-за своего большого размера Загрузить разницу

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

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

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

@ -36,7 +36,7 @@
*
* ***** END LICENSE BLOCK ***** */
#include "nsUCvMinSupport.h"
#include "nsUCSupport.h"
#include "nsUTF8ToUnicode.h"
NS_IMETHODIMP NS_NewUTF8ToUnicode(nsISupports* aOuter,

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

@ -36,7 +36,7 @@
*
* ***** END LICENSE BLOCK ***** */
#include "nsUCvMinSupport.h"
#include "nsUCSupport.h"
#include "nsUnicodeToCP1252.h"
//----------------------------------------------------------------------
@ -56,17 +56,7 @@ static const PRInt16 g_ufShiftTable[] = {
nsUnicodeToCP1252::nsUnicodeToCP1252()
: nsTableEncoderSupport((uShiftTable*) &g_ufShiftTable,
(uMappingTable*) &g_ufMappingTable)
(uMappingTable*) &g_ufMappingTable, 1)
{
}
//----------------------------------------------------------------------
// Subclassing of nsTableEncoderSupport class [implementation]
NS_IMETHODIMP nsUnicodeToCP1252::GetMaxLength(const PRUnichar * aSrc,
PRInt32 aSrcLength,
PRInt32 * aDestLength)
{
*aDestLength = aSrcLength;
return NS_OK_UENC_EXACTLENGTH;
}

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

@ -67,13 +67,6 @@ public:
*/
nsUnicodeToCP1252();
protected:
//--------------------------------------------------------------------
// Subclassing of nsEncoderSupport class [declaration]
NS_IMETHOD GetMaxLength(const PRUnichar * aSrc, PRInt32 aSrcLength,
PRInt32 * aDestLength);
};
#endif /* nsUnicodeToCP1252_h___ */

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

@ -36,7 +36,7 @@
*
* ***** END LICENSE BLOCK ***** */
#include "nsUCvMinSupport.h"
#include "nsUCSupport.h"
#include "nsUnicodeToISO88591.h"
//----------------------------------------------------------------------
@ -56,18 +56,7 @@ static const PRInt16 g_ufShiftTable[] = {
nsUnicodeToISO88591::nsUnicodeToISO88591()
: nsTableEncoderSupport((uShiftTable*) &g_ufShiftTable,
(uMappingTable*) &g_ufMappingTable)
(uMappingTable*) &g_ufMappingTable, 1)
{
}
//----------------------------------------------------------------------
// Subclassing of nsTableEncoderSupport class [implementation]
NS_IMETHODIMP nsUnicodeToISO88591::GetMaxLength(const PRUnichar * aSrc,
PRInt32 aSrcLength,
PRInt32 * aDestLength)
{
*aDestLength = aSrcLength;
return NS_OK_UENC_EXACTLENGTH;
}

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

@ -67,13 +67,5 @@ public:
*/
nsUnicodeToISO88591();
protected:
//--------------------------------------------------------------------
// Subclassing of nsEncoderSupport class [declaration]
NS_IMETHOD GetMaxLength(const PRUnichar * aSrc, PRInt32 aSrcLength,
PRInt32 * aDestLength);
};
#endif /* nsUnicodeToISO88591_h___ */

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

@ -36,7 +36,7 @@
*
* ***** END LICENSE BLOCK ***** */
#include "nsUCvMinSupport.h"
#include "nsUCSupport.h"
#include "nsUnicodeToMacRoman.h"
//----------------------------------------------------------------------
@ -56,17 +56,7 @@ static const PRInt16 g_MacRomanShiftTable[] = {
nsUnicodeToMacRoman::nsUnicodeToMacRoman()
: nsTableEncoderSupport((uShiftTable*) &g_MacRomanShiftTable,
(uMappingTable*) &g_MacRomanMappingTable)
(uMappingTable*) &g_MacRomanMappingTable, 1)
{
}
//----------------------------------------------------------------------
// Subclassing of nsTableEncoderSupport class [implementation]
NS_IMETHODIMP nsUnicodeToMacRoman::GetMaxLength(const PRUnichar * aSrc,
PRInt32 aSrcLength,
PRInt32 * aDestLength)
{
*aDestLength = aSrcLength;
return NS_OK_UENC_EXACTLENGTH;
}

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

@ -64,13 +64,6 @@ public:
*/
nsUnicodeToMacRoman();
protected:
//--------------------------------------------------------------------
// Subclassing of nsEncoderSupport class [declaration]
NS_IMETHOD GetMaxLength(const PRUnichar * aSrc, PRInt32 aSrcLength,
PRInt32 * aDestLength);
};
#endif /* nsUnicodeToMacRoman_h___ */

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

@ -38,7 +38,7 @@
//----------------------------------------------------------------------
// Global functions and data [declaration]
#include "nsUCvMinSupport.h"
#include "nsUCSupport.h"
#include "nsUnicodeToUTF8.h"
#include <string.h>

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

@ -50,6 +50,7 @@ include $(topsrcdir)/config/rules.mk
INCLUDES += \
-I$(srcdir)/../ucvlatin \
-I$(srcdir)/../ucvja \
-I$(srcdir)/../util \
$(NULL)
LIBS += \

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

@ -39,6 +39,7 @@
#include "nsIServiceManager.h"
#include "nsICharsetConverterManager.h"
#include "nsICharsetConverterManager2.h"
#include "nsUCSupport.h"
#include "nsString.h"
//----------------------------------------------------------------------------
@ -211,8 +212,18 @@ nsresult nsTestUConv::TestEncoders()
mLog.AddTrace(trace);
nsresult res = NS_OK;
// XXX write me
nsCOMPtr<nsICharsetConverterManager2> ccMan =
do_GetService(kCharsetConverterManagerCID, &res);
if (NS_FAILED(res)) return res;
nsCOMPtr<nsISupportsArray> encoders;
res = ccMan->GetEncoderList(getter_AddRefs(encoders));
if (NS_FAILED(res)) return res;
PRUint32 encoderCount;
encoders->Count(&encoderCount);
printf("There are %d encoders\n", encoderCount);
mLog.DelTrace(trace);
return res;
}
@ -385,6 +396,9 @@ nsresult nsTestUConv::DisplayCharsets()
printf("***** Character Sets [%d] *****\n", count);
PRUint32 encCount = 0, decCount = 0;
PRUint32 basicEncCount = 0, basicDecCount = 0;
for (PRUint32 i = 0; i < count; i++) {
nsCOMPtr<nsIAtom> cs;
nsAutoString str;
@ -408,20 +422,47 @@ nsresult nsTestUConv::DisplayCharsets()
printf("%s", buff.get());
PrintSpaces(24 - buff.Length()); // align to hard coded column number
res = ccMan->GetCharsetTitle2(cs, &str);
if (NS_FAILED(res)) str.SetLength(0);
NS_LossyConvertUCS2toASCII buff2(str);
nsCOMPtr<nsIUnicodeDecoder> dec = NULL;
res = ccMan->GetUnicodeDecoder(cs, getter_AddRefs(dec));
if (NS_FAILED(res)) printf (" ");
else printf("D");
else {
printf("D");
decCount++;
}
#ifdef NS_DEBUG
// show the "basic" decoder classes
if (dec) {
nsCOMPtr<nsIBasicDecoder> isBasic = do_QueryInterface(dec);
if (isBasic) {
basicDecCount++;
printf("b");
}
else printf(" ");
}
else printf(" ");
#endif
nsCOMPtr<nsIUnicodeEncoder> enc = NULL;
res = ccMan->GetUnicodeEncoder(cs, getter_AddRefs(enc));
if (NS_FAILED(res)) printf (" ");
else printf("E");
else {
printf("E");
encCount++;
}
#ifdef NS_DEBUG
if (enc) {
nsCOMPtr<nsIBasicEncoder> isBasic = do_QueryInterface(enc);
if (isBasic) {
basicEncCount++;
printf("b");
}
else printf(" ");
}
else printf(" ");
#endif
printf(" ");
prop.Assign(NS_LITERAL_STRING(".notForBrowser"));
@ -444,9 +485,18 @@ nsresult nsTestUConv::DisplayCharsets()
if ((enc != NULL) && (NS_FAILED(res))) printf ("E");
else printf("X");
printf(" \"%s\"\n", buff2);
printf("(%3d, %3d) ", encCount, decCount);
res = ccMan->GetCharsetTitle2(cs, &str);
if (NS_FAILED(res)) str.SetLength(0);
NS_LossyConvertUCS2toASCII buff2(str);
printf(" \"%s\"\n", buff2.get());
}
printf("%u of %u decoders are basic (%d%%)\n",
basicDecCount, decCount, (basicDecCount * 100) / decCount);
printf("%u of %u encoders are basic (%d%%)\n",
basicEncCount, encCount, (basicEncCount * 100) / encCount);
mLog.DelTrace(trace);
return NS_OK;
}

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

@ -27,9 +27,8 @@ VPATH = @srcdir@
include $(DEPTH)/config/autoconf.mk
MODULE = ucvcn
LIBRARY_NAME = ucvcn
EXPORT_LIBRARY = 1
IS_COMPONENT = 1
LIBRARY_NAME = ucvcn_s
FORCE_STATIC_LIB=1
MODULE_NAME = nsUCvCnModule
REQUIRES = xpcom \
string \
@ -50,17 +49,17 @@ CPPSRCS = \
nsUnicodeToHZ.cpp \
nsCP936ToUnicode.cpp \
nsUnicodeToCP936.cpp \
nsUCvCnSupport.cpp \
nsUCvCnModule.cpp \
nsGBKConvUtil.cpp \
$(NULL)
EXPORTS = nsUCvCnCID.h
EXTRA_DSO_LDOPTS += $(MOZ_COMPONENT_LIBS)
LOCAL_INCLUDES = -I$(srcdir)/../util
include $(topsrcdir)/config/rules.mk
DEFINES += -D_IMPL_NS_INTL
ifeq ($(OS_ARCH),WINNT)
DEFINES += -DWIN32_LEAN_AND_MEAN
endif

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

@ -38,7 +38,7 @@
#ifndef nsCP936ToUnicode_h___
#define nsCP936ToUnicode_h___
#include "nsUCvCnSupport.h"
#include "nsUCSupport.h"
//----------------------------------------------------------------------
// Class nsCP936ToUnicode [declaration]

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

@ -39,7 +39,7 @@
#ifndef nsGB2312ToUnicodeV2_h___
#define nsGB2312ToUnicodeV2_h___
#include "nsUCvCnSupport.h"
#include "nsUCSupport.h"
#include "gbku.h"
#include "nsGBKToUnicode.h"
//----------------------------------------------------------------------

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

@ -62,12 +62,6 @@ public:
virtual ~nsGBKUnique2BytesToUnicode()
{ };
protected:
NS_IMETHOD GetMaxLength(const char* aSrc, PRInt32 aSrcLength,
PRInt32 * aDestLength)
{
*aDestLength = aSrcLength;
return NS_OK;
};
};
static PRUint16 g_utGBKUnique2Bytes[] = {
@ -75,7 +69,7 @@ static PRUint16 g_utGBKUnique2Bytes[] = {
};
nsGBKUnique2BytesToUnicode::nsGBKUnique2BytesToUnicode()
: nsTableDecoderSupport((uShiftTable*) &g_2BytesShiftTable,
(uMappingTable*) &g_utGBKUnique2Bytes)
(uMappingTable*) &g_utGBKUnique2Bytes, 1)
{
}
@ -89,12 +83,6 @@ public:
virtual ~nsGB18030Unique2BytesToUnicode()
{ };
protected:
NS_IMETHOD GetMaxLength(const char* aSrc, PRInt32 aSrcLength,
PRInt32 * aDestLength)
{
*aDestLength = aSrcLength;
return NS_OK;
};
};
static PRUint16 g_utGB18030Unique2Bytes[] = {
@ -102,7 +90,7 @@ static PRUint16 g_utGB18030Unique2Bytes[] = {
};
nsGB18030Unique2BytesToUnicode::nsGB18030Unique2BytesToUnicode()
: nsTableDecoderSupport((uShiftTable*) &g_2BytesShiftTable,
(uMappingTable*) &g_utGB18030Unique2Bytes)
(uMappingTable*) &g_utGB18030Unique2Bytes, 1)
{
}
@ -120,12 +108,6 @@ public:
virtual ~nsGB18030Unique4BytesToUnicode()
{ };
protected:
NS_IMETHOD GetMaxLength(const char* aSrc, PRInt32 aSrcLength,
PRInt32 * aDestLength)
{
*aDestLength = aSrcLength;
return NS_OK;
};
};
static PRUint16 g_utGB18030Unique4Bytes[] = {
@ -133,7 +115,7 @@ static PRUint16 g_utGB18030Unique4Bytes[] = {
};
nsGB18030Unique4BytesToUnicode::nsGB18030Unique4BytesToUnicode()
: nsTableDecoderSupport((uShiftTable*) &g_GB18030_4BytesShiftTable,
(uMappingTable*) &g_utGB18030Unique4Bytes)
(uMappingTable*) &g_utGB18030Unique4Bytes, 1)
{
}
@ -144,14 +126,6 @@ nsGB18030Unique4BytesToUnicode::nsGB18030Unique4BytesToUnicode()
//----------------------------------------------------------------------
// Subclassing of nsTablesDecoderSupport class [implementation]
NS_IMETHODIMP nsGBKToUnicode::GetMaxLength(const char * aSrc,
PRInt32 aSrcLength,
PRInt32 * aDestLength)
{
*aDestLength = aSrcLength;
return NS_OK;
}
#define LEGAL_GBK_MULTIBYTE_FIRST_BYTE(c) \
(UINT8_IN_RANGE(0x81, (c), 0xFE))
#define FIRST_BYTE_IS_SURROGATE(c) \

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

@ -40,7 +40,7 @@
#include "nsCOMPtr.h"
#include "nsIUnicodeDecoder.h"
#include "nsUCvCnSupport.h"
#include "nsUCSupport.h"
#include "gbku.h"
//----------------------------------------------------------------------
@ -60,7 +60,7 @@ public:
/**
* Class constructor.
*/
nsGBKToUnicode()
nsGBKToUnicode() : nsBufferDecoderSupport(1)
{
mExtensionDecoder = nsnull;
m4BytesDecoder = nsnull;
@ -72,9 +72,6 @@ protected:
// Subclassing of nsDecoderSupport class [declaration]
NS_IMETHOD ConvertNoBuff(const char* aSrc, PRInt32 * aSrcLength, PRUnichar *aDest, PRInt32 * aDestLength);
NS_IMETHOD GetMaxLength(const char * aSrc, PRInt32 aSrcLength,
PRInt32 * aDestLength);
protected:
nsGBKConvUtil mUtil;
nsCOMPtr<nsIUnicodeDecoder> mExtensionDecoder;

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

@ -69,13 +69,6 @@
//----------------------------------------------------------------------
// Subclassing of nsTablesDecoderSupport class [implementation]
NS_IMETHODIMP nsHZToUnicode::GetMaxLength(const char * aSrc,
PRInt32 aSrcLength,
PRInt32 * aDestLength)
{
*aDestLength = aSrcLength;
return NS_OK;
}
#define HZ_STATE_GB 1
#define HZ_STATE_ASCII 2
#define HZ_STATE_TILD 3
@ -84,7 +77,7 @@ NS_IMETHODIMP nsHZToUnicode::GetMaxLength(const char * aSrc,
#define HZLEAD3 '}'
#define HZLEAD4 '\n'
nsHZToUnicode::nsHZToUnicode()
nsHZToUnicode::nsHZToUnicode() : nsBufferDecoderSupport(1)
{
mHZState = HZ_STATE_ASCII; // per HZ spec, default to ASCII state
}

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

@ -39,7 +39,7 @@
#ifndef nsHZToUnicode_h___
#define nsHZToUnicode_h___
#include "nsUCvCnSupport.h"
#include "nsUCSupport.h"
#include "gbku.h"
//----------------------------------------------------------------------
@ -67,8 +67,6 @@ protected:
// Subclassing of nsDecoderSupport class [declaration]
NS_IMETHOD ConvertNoBuff(const char* aSrc, PRInt32 * aSrcLength,
PRUnichar *aDest, PRInt32 * aDestLength);
NS_IMETHOD GetMaxLength(const char * aSrc, PRInt32 aSrcLength,
PRInt32 * aDestLength);
nsGBKConvUtil mUtil;
private:

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

@ -41,5 +41,4 @@
#include "prtypes.h"
#define g_AsciiMapping ucvcn_g_AsciiMapping
#endif /* nsUCvCnDll_h___ */

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

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

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

@ -39,7 +39,7 @@
#ifndef nsUnicodeToCP936_h___
#define nsUnicodeToCP936_h___
#include "nsUCvCnSupport.h"
#include "nsUCSupport.h"
//----------------------------------------------------------------------
// Class nsUnicodeToCP936 [declaration]

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

@ -46,7 +46,8 @@
//----------------------------------------------------------------------
// Class nsUnicodeToGB2312GL [implementation]
nsUnicodeToGB2312GL::nsUnicodeToGB2312GL()
nsUnicodeToGB2312GL::nsUnicodeToGB2312GL() :
nsEncoderSupport(2)
{
mUtil.InitToGBKTable();
}
@ -95,14 +96,6 @@ NS_IMETHODIMP nsUnicodeToGB2312GL::ConvertNoBuff(const PRUnichar * aSrc,
//----------------------------------------------------------------------
// Subclassing of nsTableEncoderSupport class [implementation]
NS_IMETHODIMP nsUnicodeToGB2312GL::GetMaxLength(const PRUnichar * aSrc,
PRInt32 aSrcLength,
PRInt32 * aDestLength)
{
*aDestLength = 2 * aSrcLength;
return NS_OK;
}
NS_IMETHODIMP nsUnicodeToGB2312GL::FillInfo(PRUint32 *aInfo)
{
mUtil.FillGB2312Info(aInfo);

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

@ -40,7 +40,7 @@
#ifndef nsUnicodeToGB2312GL_h___
#define nsUnicodeToGB2312GL_h___
#include "nsUCvCnSupport.h"
#include "nsUCSupport.h"
#include "gbku.h"
//----------------------------------------------------------------------
// Class nsUnicodeToGB2312GL [declaration]
@ -70,9 +70,6 @@ protected:
//--------------------------------------------------------------------
// Subclassing of nsEncoderSupport class [declaration]
NS_IMETHOD GetMaxLength(const PRUnichar * aSrc, PRInt32 aSrcLength,
PRInt32 * aDestLength);
NS_IMETHOD ConvertNoBuffNoErr(const PRUnichar * aSrc, PRInt32 * aSrcLength,
char * aDest, PRInt32 * aDestLength)
{

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

@ -44,7 +44,8 @@
//----------------------------------------------------------------------
// Class nsUnicodeToGB2312V2 [implementation]
nsUnicodeToGB2312V2::nsUnicodeToGB2312V2()
nsUnicodeToGB2312V2::nsUnicodeToGB2312V2() :
nsEncoderSupport(2)
{
mUtil.InitToGBKTable();
}
@ -103,14 +104,6 @@ NS_IMETHODIMP nsUnicodeToGB2312V2::ConvertNoBuff(const PRUnichar * aSrc,
//----------------------------------------------------------------------
// Subclassing of nsTableEncoderSupport class [implementation]
NS_IMETHODIMP nsUnicodeToGB2312V2::GetMaxLength(const PRUnichar * aSrc,
PRInt32 aSrcLength,
PRInt32 * aDestLength)
{
*aDestLength = 2 * aSrcLength;
return NS_OK;
}
NS_IMETHODIMP nsUnicodeToGB2312V2::FillInfo(PRUint32 *aInfo)
{
mUtil.FillGB2312Info(aInfo);

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

@ -39,7 +39,7 @@
#ifndef nsUnicodeToGB2312V2_h___
#define nsUnicodeToGB2312V2_h___
#include "nsUCvCnSupport.h"
#include "nsUCSupport.h"
#include "gbku.h"
//----------------------------------------------------------------------
@ -70,9 +70,6 @@ protected:
//--------------------------------------------------------------------
// Subclassing of nsEncoderSupport class [declaration]
NS_IMETHOD GetMaxLength(const PRUnichar * aSrc, PRInt32 aSrcLength,
PRInt32 * aDestLength);
NS_IMETHOD ConvertNoBuffNoErr(const PRUnichar * aSrc, PRInt32 * aSrcLength,
char * aDest, PRInt32 * aDestLength)
{

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

@ -78,15 +78,8 @@ class nsUnicodeToGB18030Uniq2Bytes : public nsTableEncoderSupport
public:
nsUnicodeToGB18030Uniq2Bytes()
: nsTableEncoderSupport((uShiftTable*) &g_2BytesShiftTable,
(uMappingTable*) &g_uf_gb18030_2bytes) {};
(uMappingTable*) &g_uf_gb18030_2bytes, 2) {};
protected:
NS_IMETHOD GetMaxLength(const PRUnichar * aSrc,
PRInt32 aSrcLength,
PRInt32 * aDestLength)
{
*aDestLength = 2 * aSrcLength;
return NS_OK;
};
};
//-----------------------------------------------------------------------
// Private class used by nsUnicodeToGB18030
@ -100,15 +93,8 @@ class nsUnicodeTo4BytesGB18030 : public nsTableEncoderSupport
public:
nsUnicodeTo4BytesGB18030()
: nsTableEncoderSupport( (uShiftTable*) &g_4BytesGB18030ShiftTable,
(uMappingTable*) &g_uf_gb18030_4bytes) {};
(uMappingTable*) &g_uf_gb18030_4bytes, 4) {};
protected:
NS_IMETHOD GetMaxLength(const PRUnichar * aSrc,
PRInt32 aSrcLength,
PRInt32 * aDestLength)
{
*aDestLength = 4 * aSrcLength;
return NS_OK_UDEC_EXACTLENGTH;
};
};
//-----------------------------------------------------------------------
// Private class used by nsUnicodeToGBK
@ -122,15 +108,8 @@ class nsUnicodeToGBKUniq2Bytes : public nsTableEncoderSupport
public:
nsUnicodeToGBKUniq2Bytes()
: nsTableEncoderSupport( (uShiftTable*) &g_2BytesShiftTable,
(uMappingTable*) &g_uf_gbk_2bytes) {};
(uMappingTable*) &g_uf_gbk_2bytes, 2) {};
protected:
NS_IMETHOD GetMaxLength(const PRUnichar * aSrc,
PRInt32 aSrcLength,
PRInt32 * aDestLength)
{
*aDestLength = 2 * aSrcLength;
return NS_OK_UDEC_EXACTLENGTH;
};
};
//-----------------------------------------------------------------------
// nsUnicodeToGB18030
@ -143,13 +122,7 @@ void nsUnicodeToGB18030::Create4BytesEncoder()
{
m4BytesEncoder = new nsUnicodeTo4BytesGB18030();
}
NS_IMETHODIMP nsUnicodeToGB18030::GetMaxLength(const PRUnichar * aSrc,
PRInt32 aSrcLength,
PRInt32 * aDestLength)
{
*aDestLength = 4 * aSrcLength;
return NS_OK;
}
PRBool nsUnicodeToGB18030::EncodeSurrogate(
PRUnichar aSurrogateHigh,
PRUnichar aSurrogateLow,
@ -205,19 +178,11 @@ NS_IMETHODIMP nsUnicodeToGB18030Font0::FillInfo(PRUint32 *aInfo)
//-----------------------------------------------------------------------
nsUnicodeToGB18030Font1::nsUnicodeToGB18030Font1()
: nsTableEncoderSupport( (uShiftTable*) &g_2BytesShiftTable,
(uMappingTable*) &g_uf_gb18030_4bytes)
(uMappingTable*) &g_uf_gb18030_4bytes, 4)
{
}
NS_IMETHODIMP nsUnicodeToGB18030Font1::GetMaxLength(const PRUnichar * aSrc,
PRInt32 aSrcLength,
PRInt32 * aDestLength)
{
*aDestLength = 4 * aSrcLength;
return NS_OK_UDEC_EXACTLENGTH; // font encoding is exactly 4 bytes
}
NS_IMETHODIMP nsUnicodeToGB18030Font1::FillInfo(PRUint32 *aInfo)
{
nsresult res = nsTableEncoderSupport::FillInfo(aInfo);
@ -357,7 +322,8 @@ NS_IMETHODIMP nsUnicodeToGB18030Font1::FillInfo(PRUint32 *aInfo)
//----------------------------------------------------------------------
// Class nsUnicodeToGBK [implementation]
nsUnicodeToGBK::nsUnicodeToGBK()
nsUnicodeToGBK::nsUnicodeToGBK(PRUint32 aMaxLength) :
nsEncoderSupport(aMaxLength)
{
mExtensionEncoder = nsnull;
m4BytesEncoder = nsnull;
@ -562,15 +528,6 @@ NS_IMETHODIMP nsUnicodeToGBK::ConvertNoBuff(
//----------------------------------------------------------------------
// Subclassing of nsTableEncoderSupport class [implementation]
NS_IMETHODIMP nsUnicodeToGBK::GetMaxLength(const PRUnichar * aSrc,
PRInt32 aSrcLength,
PRInt32 * aDestLength)
{
*aDestLength = 2 * aSrcLength;
return NS_OK;
}
NS_IMETHODIMP nsUnicodeToGBK::FillInfo(PRUint32 *aInfo)
{
mUtil.FillInfo(aInfo, 0x81, 0xFE, 0x40, 0xFE);

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

@ -47,7 +47,7 @@
#ifndef nsUnicodeToGBK_h___
#define nsUnicodeToGBK_h___
#include "nsUCvCnSupport.h"
#include "nsUCSupport.h"
#include "nsCOMPtr.h"
#include "nsIUnicodeEncoder.h"
#include "gbku.h"
@ -61,7 +61,7 @@ public:
/**
* Class constructor.
*/
nsUnicodeToGBK();
nsUnicodeToGBK(PRUint32 aMaxLengthFactor = 2);
virtual ~nsUnicodeToGBK() {};
protected:
@ -73,9 +73,6 @@ protected:
char * aDest,
PRInt32 * aDestLength);
NS_IMETHOD GetMaxLength(const PRUnichar * aSrc, PRInt32 aSrcLength,
PRInt32 * aDestLength);
NS_IMETHOD ConvertNoBuffNoErr(const PRUnichar * aSrc, PRInt32 * aSrcLength,
char * aDest, PRInt32 * aDestLength)
{
@ -100,11 +97,9 @@ protected:
class nsUnicodeToGB18030: public nsUnicodeToGBK
{
public:
nsUnicodeToGB18030() {};
nsUnicodeToGB18030() : nsUnicodeToGBK(4) {};
virtual ~nsUnicodeToGB18030() {};
protected:
NS_IMETHOD GetMaxLength(const PRUnichar * aSrc, PRInt32 aSrcLength,
PRInt32 * aDestLength);
virtual void CreateExtensionEncoder();
virtual void Create4BytesEncoder();
virtual PRBool EncodeSurrogate(PRUnichar aSurrogateHigh, PRUnichar aSurrogateLow, char* aDest);
@ -127,9 +122,6 @@ public:
nsUnicodeToGB18030Font1();
virtual ~nsUnicodeToGB18030Font1() {};
protected:
NS_IMETHOD GetMaxLength(const PRUnichar * aSrc,
PRInt32 aSrcLength,
PRInt32 * aDestLength);
NS_IMETHOD FillInfo(PRUint32 *aInfo);
};

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

@ -58,7 +58,7 @@
#define HZLEAD2 '{'
#define HZLEAD3 '}'
#define UNICODE_TILD 0x007E
nsUnicodeToHZ::nsUnicodeToHZ()
nsUnicodeToHZ::nsUnicodeToHZ() : nsEncoderSupport(6)
{
mUtil.InitToGBKTable();
mHZState = HZ_STATE_ASCII; // per HZ spec, default to HZ mode
@ -142,12 +142,3 @@ NS_IMETHODIMP nsUnicodeToHZ::FillInfo(PRUint32 *aInfo)
SET_REPRESENTABLE(aInfo, u);
return NS_OK;
}
//----------------------------------------------------------------------
// Subclassing of nsTableEncoderSupport class [implementation]
NS_IMETHODIMP nsUnicodeToHZ::GetMaxLength(const PRUnichar * aSrc,
PRInt32 aSrcLength,
PRInt32 * aDestLength)
{
*aDestLength = 6 * aSrcLength;
return NS_OK;
}

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

@ -47,7 +47,7 @@
#ifndef nsUnicodeToHZ_h___
#define nsUnicodeToHZ_h___
#include "nsUCvCnSupport.h"
#include "nsUCSupport.h"
#include "gbku.h"
//----------------------------------------------------------------------
// Class nsUnicodeToHZ [declaration]
@ -78,9 +78,6 @@ protected:
return NS_OK;
}; // just make it not abstract;
NS_IMETHOD GetMaxLength(const PRUnichar * aSrc, PRInt32 aSrcLength,
PRInt32 * aDestLength);
PRUint16 mHZState;
protected:
nsGBKConvUtil mUtil;

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

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

@ -38,9 +38,8 @@ VPATH = @srcdir@
include $(DEPTH)/config/autoconf.mk
MODULE = ucvibm
LIBRARY_NAME = ucvibm
EXPORT_LIBRARY = 1
IS_COMPONENT = 1
LIBRARY_NAME = ucvibm_s
FORCE_STATIC_LIB = 1
MODULE_NAME = nsUCvIBMModule
REQUIRES = xpcom \
string \
@ -62,13 +61,11 @@ CPPSRCS = \
nsUnicodeToCP862.cpp \
nsUnicodeToCP864.cpp \
nsUnicodeToCP864i.cpp \
nsUCvIBMSupport.cpp \
nsUCvIBMModule.cpp \
$(NULL)
EXPORTS = nsUCvIBMCID.h
EXTRA_DSO_LDOPTS += $(MOZ_COMPONENT_LIBS)
LOCAL_INCLUDES = -I$(srcdir)/../util
ifeq ($(MOZ_WIDGET_TOOLKIT),os2)
ifeq ($(MOZ_OS2_TOOLS),VACPP)
@ -80,6 +77,7 @@ endif
include $(topsrcdir)/config/rules.mk
DEFINES += -D_IMPL_NS_INTL
ifeq ($(OS_ARCH),WINNT)
DEFINES += -DWIN32_LEAN_AND_MEAN
endif

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

@ -36,7 +36,7 @@
#ifndef nsCP850ToUnicode_h___
#define nsCP850ToUnicode_h___
#include "nsUCvIBMSupport.h"
#include "nsUCSupport.h"
//----------------------------------------------------------------------
// Class nsCP850ToUnicode [declaration]

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

@ -36,7 +36,7 @@
#ifndef nsCP852ToUnicode_h___
#define nsCP852ToUnicode_h___
#include "nsUCvIBMSupport.h"
#include "nsUCSupport.h"
//----------------------------------------------------------------------
// Class nsCP852ToUnicode [declaration]

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

@ -36,7 +36,7 @@
#ifndef nsCP855ToUnicode_h___
#define nsCP855ToUnicode_h___
#include "nsUCvIBMSupport.h"
#include "nsUCSupport.h"
//----------------------------------------------------------------------
// Class nsCP855ToUnicode [declaration]

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

@ -36,7 +36,7 @@
#ifndef nsCP857ToUnicode_h___
#define nsCP857ToUnicode_h___
#include "nsUCvIBMSupport.h"
#include "nsUCSupport.h"
//----------------------------------------------------------------------
// Class nsCP857ToUnicode [declaration]

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

@ -36,7 +36,7 @@
#ifndef nsCP862ToUnicode_h___
#define nsCP862ToUnicode_h___
#include "nsUCvIBMSupport.h"
#include "nsUCSupport.h"
//----------------------------------------------------------------------
// Class nsCP862ToUnicode [declaration]

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

@ -36,7 +36,7 @@
#ifndef nsCP864ToUnicode_h___
#define nsCP864ToUnicode_h___
#include "nsUCvIBMSupport.h"
#include "nsUCSupport.h"
//----------------------------------------------------------------------
// Class nsCP864ToUnicode [declaration]

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

@ -74,7 +74,7 @@
#include "nsUCvIBMSupport.h"
#include "nsUCSupport.h"

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

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

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

@ -52,17 +52,7 @@ static const PRInt16 g_ufShiftTable[] = {
nsUnicodeToCP850::nsUnicodeToCP850()
: nsTableEncoderSupport((uShiftTable*) &g_ufShiftTable,
(uMappingTable*) &g_ufMappingTable)
(uMappingTable*) &g_ufMappingTable, 1)
{
}
//----------------------------------------------------------------------
// Subclassing of nsTableEncoderSupport class [implementation]
NS_IMETHODIMP nsUnicodeToCP850::GetMaxLength(const PRUnichar * aSrc,
PRInt32 aSrcLength,
PRInt32 * aDestLength)
{
*aDestLength = aSrcLength;
return NS_OK_UENC_EXACTLENGTH;
}

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

@ -36,7 +36,7 @@
#ifndef nsUnicodeToCP850_h___
#define nsUnicodeToCP850_h___
#include "nsUCvIBMSupport.h"
#include "nsUCSupport.h"
//----------------------------------------------------------------------
// Class nsUnicodeToCP850 [declaration]
@ -52,14 +52,6 @@ public:
* Class constructor.
*/
nsUnicodeToCP850();
protected:
//--------------------------------------------------------------------
// Subclassing of nsEncoderSupport class [declaration]
NS_IMETHOD GetMaxLength(const PRUnichar * aSrc, PRInt32 aSrcLength,
PRInt32 * aDestLength);
};
#endif /* nsUnicodeToCP850_h___ */

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

@ -52,17 +52,7 @@ static const PRInt16 g_ufShiftTable[] = {
nsUnicodeToCP852::nsUnicodeToCP852()
: nsTableEncoderSupport((uShiftTable*) &g_ufShiftTable,
(uMappingTable*) &g_ufMappingTable)
(uMappingTable*) &g_ufMappingTable, 1)
{
}
//----------------------------------------------------------------------
// Subclassing of nsTableEncoderSupport class [implementation]
NS_IMETHODIMP nsUnicodeToCP852::GetMaxLength(const PRUnichar * aSrc,
PRInt32 aSrcLength,
PRInt32 * aDestLength)
{
*aDestLength = aSrcLength;
return NS_OK_UENC_EXACTLENGTH;
}

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

@ -36,7 +36,7 @@
#ifndef nsUnicodeToCP852_h___
#define nsUnicodeToCP852_h___
#include "nsUCvIBMSupport.h"
#include "nsUCSupport.h"
//----------------------------------------------------------------------
// Class nsUnicodeToCP852 [declaration]
@ -53,13 +53,6 @@ public:
*/
nsUnicodeToCP852();
protected:
//--------------------------------------------------------------------
// Subclassing of nsEncoderSupport class [declaration]
NS_IMETHOD GetMaxLength(const PRUnichar * aSrc, PRInt32 aSrcLength,
PRInt32 * aDestLength);
};
#endif /* nsUnicodeToCP852_h___ */

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

@ -52,17 +52,7 @@ static const PRInt16 g_ufShiftTable[] = {
nsUnicodeToCP855::nsUnicodeToCP855()
: nsTableEncoderSupport((uShiftTable*) &g_ufShiftTable,
(uMappingTable*) &g_ufMappingTable)
(uMappingTable*) &g_ufMappingTable, 1)
{
}
//----------------------------------------------------------------------
// Subclassing of nsTableEncoderSupport class [implementation]
NS_IMETHODIMP nsUnicodeToCP855::GetMaxLength(const PRUnichar * aSrc,
PRInt32 aSrcLength,
PRInt32 * aDestLength)
{
*aDestLength = aSrcLength;
return NS_OK_UENC_EXACTLENGTH;
}

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

@ -36,7 +36,7 @@
#ifndef nsUnicodeToCP855_h___
#define nsUnicodeToCP855_h___
#include "nsUCvIBMSupport.h"
#include "nsUCSupport.h"
//----------------------------------------------------------------------
// Class nsUnicodeToCP855 [declaration]
@ -53,13 +53,6 @@ public:
*/
nsUnicodeToCP855();
protected:
//--------------------------------------------------------------------
// Subclassing of nsEncoderSupport class [declaration]
NS_IMETHOD GetMaxLength(const PRUnichar * aSrc, PRInt32 aSrcLength,
PRInt32 * aDestLength);
};
#endif /* nsUnicodeToCP855_h___ */

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

@ -52,17 +52,7 @@ static const PRInt16 g_ufShiftTable[] = {
nsUnicodeToCP857::nsUnicodeToCP857()
: nsTableEncoderSupport((uShiftTable*) &g_ufShiftTable,
(uMappingTable*) &g_ufMappingTable)
(uMappingTable*) &g_ufMappingTable, 1)
{
}
//----------------------------------------------------------------------
// Subclassing of nsTableEncoderSupport class [implementation]
NS_IMETHODIMP nsUnicodeToCP857::GetMaxLength(const PRUnichar * aSrc,
PRInt32 aSrcLength,
PRInt32 * aDestLength)
{
*aDestLength = aSrcLength;
return NS_OK_UENC_EXACTLENGTH;
}

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

@ -36,7 +36,7 @@
#ifndef nsUnicodeToCP857_h___
#define nsUnicodeToCP857_h___
#include "nsUCvIBMSupport.h"
#include "nsUCSupport.h"
//----------------------------------------------------------------------
// Class nsUnicodeToCP857 [declaration]
@ -53,13 +53,6 @@ public:
*/
nsUnicodeToCP857();
protected:
//--------------------------------------------------------------------
// Subclassing of nsEncoderSupport class [declaration]
NS_IMETHOD GetMaxLength(const PRUnichar * aSrc, PRInt32 aSrcLength,
PRInt32 * aDestLength);
};
#endif /* nsUnicodeToCP857_h___ */

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

@ -52,17 +52,7 @@ static const PRInt16 g_ufShiftTable[] = {
nsUnicodeToCP862::nsUnicodeToCP862()
: nsTableEncoderSupport((uShiftTable*) &g_ufShiftTable,
(uMappingTable*) &g_ufMappingTable)
(uMappingTable*) &g_ufMappingTable, 1)
{
}
//----------------------------------------------------------------------
// Subclassing of nsTableEncoderSupport class [implementation]
NS_IMETHODIMP nsUnicodeToCP862::GetMaxLength(const PRUnichar * aSrc,
PRInt32 aSrcLength,
PRInt32 * aDestLength)
{
*aDestLength = aSrcLength;
return NS_OK_UENC_EXACTLENGTH;
}

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

@ -36,7 +36,7 @@
#ifndef nsUnicodeToCP862_h___
#define nsUnicodeToCP862_h___
#include "nsUCvIBMSupport.h"
#include "nsUCSupport.h"
//----------------------------------------------------------------------
// Class nsUnicodeToCP862 [declaration]
@ -53,13 +53,6 @@ public:
*/
nsUnicodeToCP862();
protected:
//--------------------------------------------------------------------
// Subclassing of nsEncoderSupport class [declaration]
NS_IMETHOD GetMaxLength(const PRUnichar * aSrc, PRInt32 aSrcLength,
PRInt32 * aDestLength);
};
#endif /* nsUnicodeToCP862_h___ */

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

@ -52,17 +52,7 @@ static const PRInt16 g_ufShiftTable[] = {
nsUnicodeToCP864::nsUnicodeToCP864()
: nsTableEncoderSupport((uShiftTable*) &g_ufShiftTable,
(uMappingTable*) &g_ufMappingTable)
(uMappingTable*) &g_ufMappingTable, 1)
{
}
//----------------------------------------------------------------------
// Subclassing of nsTableEncoderSupport class [implementation]
NS_IMETHODIMP nsUnicodeToCP864::GetMaxLength(const PRUnichar * aSrc,
PRInt32 aSrcLength,
PRInt32 * aDestLength)
{
*aDestLength = aSrcLength;
return NS_OK_UENC_EXACTLENGTH;
}

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

@ -36,7 +36,7 @@
#ifndef nsUnicodeToCP864_h___
#define nsUnicodeToCP864_h___
#include "nsUCvIBMSupport.h"
#include "nsUCSupport.h"
//----------------------------------------------------------------------
// Class nsUnicodeToCP864 [declaration]
@ -53,13 +53,6 @@ public:
*/
nsUnicodeToCP864();
protected:
//--------------------------------------------------------------------
// Subclassing of nsEncoderSupport class [declaration]
NS_IMETHOD GetMaxLength(const PRUnichar * aSrc, PRInt32 aSrcLength,
PRInt32 * aDestLength);
};
#endif /* nsUnicodeToCP864_h___ */

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

@ -1,79 +1,41 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is Mozilla Communicator client code.
*
* The Initial Developer of the Original Code is Netscape Communications
* Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s):
* IBM Corporation
*
* This Original Code has been modified by IBM Corporation.
* Modifications made by IBM described herein are
* Copyright (c) International Business Machines
* Corporation, 1999
*
* Modifications to Mozilla code or documentation
* identified per MPL Section 3.3
*
* Date Modified by Description of modification
* 12/09/1999 IBM Corp. Support for IBM codepages - 864i
*
*/
#include "nsUnicodeToCP864i.h"
//----------------------------------------------------------------------
// Global functions and data [declaration]
static const PRUint16 g_ufMappingTable[] = {
#include "864i.uf"
@ -85,42 +47,12 @@ static const PRInt16 g_ufShiftTable[] = {
};
//----------------------------------------------------------------------
// Class nsUnicodeToCP864i [implementation]
nsUnicodeToCP864i::nsUnicodeToCP864i()
: nsTableEncoderSupport((uShiftTable*) &g_ufShiftTable,
(uMappingTable*) &g_ufMappingTable)
(uMappingTable*) &g_ufMappingTable, 1)
{
}
//----------------------------------------------------------------------
// Subclassing of nsTableEncoderSupport class [implementation]
NS_IMETHODIMP nsUnicodeToCP864i::GetMaxLength(const PRUnichar * aSrc,
PRInt32 aSrcLength,
PRInt32 * aDestLength)
{
*aDestLength = aSrcLength;
return NS_OK_UENC_EXACTLENGTH;
}

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

@ -1,130 +1,58 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is Mozilla Communicator client code.
*
* The Initial Developer of the Original Code is Netscape Communications
* Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s):
* IBM Corporation
*
* This Original Code has been modified by IBM Corporation.
* Modifications made by IBM described herein are
* Copyright (c) International Business Machines
* Corporation, 1999
*
* Modifications to Mozilla code or documentation
* identified per MPL Section 3.3
*
* Date Modified by Description of modification
* 12/09/1999 IBM Corp. Support for IBM codepages - 864i
*
*/
#ifndef nsUnicodeToCP864i_h___
#define nsUnicodeToCP864i_h___
#include "nsUCvIBMSupport.h"
#include "nsUCSupport.h"
//----------------------------------------------------------------------
// Class nsUnicodeToCP864i [declaration]
/**
* A character set converter from Unicode to CP864i.
*/
class nsUnicodeToCP864i : public nsTableEncoderSupport
{
public:
/**
* Class constructor.
*/
nsUnicodeToCP864i();
protected:
//--------------------------------------------------------------------
// Subclassing of nsEncoderSupport class [declaration]
NS_IMETHOD GetMaxLength(const PRUnichar * aSrc, PRInt32 aSrcLength,
PRInt32 * aDestLength);
};
#endif /* nsUnicodeToCP864i_h___ */

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

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

@ -27,9 +27,10 @@ VPATH = @srcdir@
include $(DEPTH)/config/autoconf.mk
MODULE = ucvja
LIBRARY_NAME = ucvja
EXPORT_LIBRARY = 1
IS_COMPONENT = 1
LIBRARY_NAME = ucvja_s
#EXPORT_LIBRARY = 1
#IS_COMPONENT = 1
FORCE_STATIC_LIB = 1
MODULE_NAME = nsUCvJAModule
REQUIRES = xpcom \
string \
@ -41,8 +42,6 @@ CPPSRCS = \
nsUnicodeToSJIS.cpp \
nsCP932ToUnicode.cpp \
nsUnicodeToCP932.cpp \
nsUCvJaSupport.cpp \
nsUCvJaModule.cpp \
nsUnicodeToEUCJP.cpp \
nsUnicodeToISO2022JP.cpp \
nsUnicodeToJISx0201.cpp \
@ -55,6 +54,11 @@ EXPORTS = \
nsUCVJA2CID.h \
$(NULL)
#SHARED_LIBRARY_LIBS = $(DIST)/lib/$(LIB_PREFIX)ucvutil_s.$(LIB_SUFFIX)
LOCAL_INCLUDES = -I$(srcdir)/../util
EXTRA_DSO_LDOPTS += $(MOZ_COMPONENT_LIBS)
include $(topsrcdir)/config/rules.mk

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

@ -37,7 +37,7 @@
* ***** END LICENSE BLOCK ***** */
#include "nsJapaneseToUnicode.h"
#include "nsUCvJaSupport.h"
#include "nsUCSupport.h"
static const PRUint16 gJis0208map[] = {
#include "jis0208.ump"

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

@ -38,7 +38,7 @@
#ifndef nsShiftJISToUnicode_h__
#define nsShiftJISToUnicode_h__
#include "nsISupports.h"
#include "nsUCvJaSupport.h"
#include "nsUCSupport.h"
class nsShiftJISToUnicode : public nsBasicDecoderSupport

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

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

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

@ -79,28 +79,9 @@ static const PRUint16 *gMappingTables[SIZE_OF_TABLES] = {
nsUnicodeToEUCJP::nsUnicodeToEUCJP()
: nsMultiTableEncoderSupport(SIZE_OF_TABLES,
(uShiftTable**) gShiftTables,
(uMappingTable**) gMappingTables)
(uShiftTable**) gShiftTables,
(uMappingTable**) gMappingTables,
3 /* max length = src * 3 */)
{
}
nsresult nsUnicodeToEUCJP::CreateInstance(nsISupports ** aResult)
{
nsIUnicodeEncoder *p = new nsUnicodeToEUCJP();
if(p) {
*aResult = p;
return NS_OK;
}
return NS_ERROR_OUT_OF_MEMORY;
}
//----------------------------------------------------------------------
// Subclassing of nsTableEncoderSupport class [implementation]
NS_IMETHODIMP nsUnicodeToEUCJP::GetMaxLength(const PRUnichar * aSrc,
PRInt32 aSrcLength,
PRInt32 * aDestLength)
{
*aDestLength = 3*aSrcLength;
return NS_OK;
}

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

@ -39,7 +39,7 @@
#ifndef nsUnicodeToEUCJP_h___
#define nsUnicodeToEUCJP_h___
#include "nsUCvJaSupport.h"
#include "nsUCSupport.h"
//----------------------------------------------------------------------
// Class nsUnicodeToEUCJP [declaration]
@ -59,18 +59,8 @@ public:
*/
nsUnicodeToEUCJP();
/**
* Static class constructor.
*/
static nsresult CreateInstance(nsISupports **aResult);
protected:
//--------------------------------------------------------------------
// Subclassing of nsEncoderSupport class [declaration]
NS_IMETHOD GetMaxLength(const PRUnichar * aSrc, PRInt32 aSrcLength,
PRInt32 * aDestLength);
};
#endif /* nsUnicodeToEUCJP_h___ */

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

@ -87,8 +87,11 @@ static const PRInt16 * g_ufShiftTables[SIZE_OF_TABLES] = {
//----------------------------------------------------------------------
// Class nsUnicodeToISO2022JP [implementation]
// worst case max length:
// 1 2 3 4 5 6 7 8
// ESC $ B XX XX ESC ( B
nsUnicodeToISO2022JP::nsUnicodeToISO2022JP()
: nsEncoderSupport()
: nsEncoderSupport(8)
{
mHelper = NULL;
Reset();
@ -99,16 +102,6 @@ nsUnicodeToISO2022JP::~nsUnicodeToISO2022JP()
NS_IF_RELEASE(mHelper);
}
nsresult nsUnicodeToISO2022JP::CreateInstance(nsISupports ** aResult)
{
nsIUnicodeEncoder *p = new nsUnicodeToISO2022JP();
if(p) {
*aResult = p;
return NS_OK;
}
return NS_ERROR_OUT_OF_MEMORY;
}
nsresult nsUnicodeToISO2022JP::ChangeCharset(PRInt32 aCharset,
char * aDest,
PRInt32 * aDestLength)
@ -249,17 +242,6 @@ NS_IMETHODIMP nsUnicodeToISO2022JP::FinishNoBuff(char * aDest,
return NS_OK;
}
NS_IMETHODIMP nsUnicodeToISO2022JP::GetMaxLength(const PRUnichar * aSrc,
PRInt32 aSrcLength,
PRInt32 * aDestLength)
{
// worst case
// 1 2 3 4 5 6 7 8
// ESC $ B XX XX ESC ( B
*aDestLength = 8*aSrcLength;
return NS_OK;
}
NS_IMETHODIMP nsUnicodeToISO2022JP::Reset()
{
mCharset = 0;

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

@ -39,7 +39,7 @@
#ifndef nsUnicodeToISO2022JP_h___
#define nsUnicodeToISO2022JP_h___
#include "nsUCvJaSupport.h"
#include "nsUCSupport.h"
//----------------------------------------------------------------------
// Class nsUnicodeToISO2022JP [declaration]
@ -64,11 +64,6 @@ public:
*/
virtual ~nsUnicodeToISO2022JP();
/**
* Static class constructor.
*/
static nsresult CreateInstance(nsISupports **aResult);
protected:
PRInt32 mCharset; // current character set
@ -83,8 +78,6 @@ protected:
NS_IMETHOD ConvertNoBuffNoErr(const PRUnichar * aSrc, PRInt32 * aSrcLength,
char * aDest, PRInt32 * aDestLength);
NS_IMETHOD FinishNoBuff(char * aDest, PRInt32 * aDestLength);
NS_IMETHOD GetMaxLength(const PRUnichar * aSrc, PRInt32 aSrcLength,
PRInt32 * aDestLength);
NS_IMETHOD Reset();
NS_IMETHOD FillInfo(PRUint32 *aInfo);
};

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

@ -50,27 +50,7 @@ static PRInt16 g0201ShiftTable[] = {
nsUnicodeToJISx0201::nsUnicodeToJISx0201()
: nsTableEncoderSupport((uShiftTable*) g0201ShiftTable,
(uMappingTable*) g_uf0201Mapping)
(uMappingTable*) g_uf0201Mapping, 1)
{
}
nsresult nsUnicodeToJISx0201::CreateInstance(nsISupports ** aResult)
{
nsIUnicodeEncoder *p = new nsUnicodeToJISx0201();
if(p) {
*aResult = p;
return NS_OK;
}
return NS_ERROR_OUT_OF_MEMORY;
}
//----------------------------------------------------------------------
// Subclassing of nsTableEncoderSupport class [implementation]
NS_IMETHODIMP nsUnicodeToJISx0201::GetMaxLength(const PRUnichar * aSrc,
PRInt32 aSrcLength,
PRInt32 * aDestLength)
{
*aDestLength = aSrcLength;
return NS_OK_UENC_EXACTLENGTH;
}

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

@ -39,7 +39,7 @@
#ifndef nsUnicodeToJISx0201_h___
#define nsUnicodeToJISx0201_h___
#include "nsUCvJaSupport.h"
#include "nsUCSupport.h"
//----------------------------------------------------------------------
// Class nsUnicodeToJISx0201 [declaration]
@ -59,18 +59,8 @@ public:
*/
nsUnicodeToJISx0201();
/**
* Static class constructor.
*/
static nsresult CreateInstance(nsISupports **aResult);
protected:
//--------------------------------------------------------------------
// Subclassing of nsEncoderSupport class [declaration]
NS_IMETHOD GetMaxLength(const PRUnichar * aSrc, PRInt32 aSrcLength,
PRInt32 * aDestLength);
};
#endif /* nsUnicodeToJISx0201_h___ */

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

@ -51,27 +51,8 @@ static PRInt16 g0208ShiftTable[] = {
nsUnicodeToJISx0208::nsUnicodeToJISx0208()
: nsTableEncoderSupport( (uShiftTable*) g0208ShiftTable,
(uMappingTable*) g_uf0208Mapping)
(uMappingTable*) g_uf0208Mapping,
2 /* max length = src * 2 */)
{
}
nsresult nsUnicodeToJISx0208::CreateInstance(nsISupports ** aResult)
{
nsIUnicodeEncoder *p = new nsUnicodeToJISx0208();
if(p) {
*aResult = p;
return NS_OK;
}
return NS_ERROR_OUT_OF_MEMORY;
}
//----------------------------------------------------------------------
// Subclassing of nsTableEncoderSupport class [implementation]
NS_IMETHODIMP nsUnicodeToJISx0208::GetMaxLength(const PRUnichar * aSrc,
PRInt32 aSrcLength,
PRInt32 * aDestLength)
{
*aDestLength = 2*aSrcLength;
return NS_OK_UENC_EXACTLENGTH;
}

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

@ -39,7 +39,7 @@
#ifndef nsUnicodeToJISx0208_h___
#define nsUnicodeToJISx0208_h___
#include "nsUCvJaSupport.h"
#include "nsUCSupport.h"
//----------------------------------------------------------------------
// Class nsUnicodeToJISx0208 [declaration]
@ -59,18 +59,8 @@ public:
*/
nsUnicodeToJISx0208();
/**
* Static class constructor.
*/
static nsresult CreateInstance(nsISupports **aResult);
protected:
//--------------------------------------------------------------------
// Subclassing of nsEncoderSupport class [declaration]
NS_IMETHOD GetMaxLength(const PRUnichar * aSrc, PRInt32 aSrcLength,
PRInt32 * aDestLength);
};
#endif /* nsUnicodeToJISx0208_h___ */

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

@ -51,27 +51,8 @@ static PRInt16 g0212ShiftTable[] = {
nsUnicodeToJISx0212::nsUnicodeToJISx0212()
: nsTableEncoderSupport((uShiftTable*) g0212ShiftTable,
(uMappingTable*) g_uf0212Mapping)
(uMappingTable*) g_uf0212Mapping,
2 /* max len = src * 2 */)
{
}
nsresult nsUnicodeToJISx0212::CreateInstance(nsISupports ** aResult)
{
nsIUnicodeEncoder *p = new nsUnicodeToJISx0212();
if(p) {
*aResult = p;
return NS_OK;
}
return NS_ERROR_OUT_OF_MEMORY;
}
//----------------------------------------------------------------------
// Subclassing of nsTableEncoderSupport class [implementation]
NS_IMETHODIMP nsUnicodeToJISx0212::GetMaxLength(const PRUnichar * aSrc,
PRInt32 aSrcLength,
PRInt32 * aDestLength)
{
*aDestLength = 2*aSrcLength;
return NS_OK_UENC_EXACTLENGTH;
}

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

@ -39,7 +39,7 @@
#ifndef nsUnicodeToJISx0212_h___
#define nsUnicodeToJISx0212_h___
#include "nsUCvJaSupport.h"
#include "nsUCSupport.h"
//----------------------------------------------------------------------
// Class nsUnicodeToJISx0212 [declaration]
@ -59,18 +59,8 @@ public:
*/
nsUnicodeToJISx0212();
/**
* Static class constructor.
*/
static nsresult CreateInstance(nsISupports **aResult);
protected:
//--------------------------------------------------------------------
// Subclassing of nsEncoderSupport class [declaration]
NS_IMETHOD GetMaxLength(const PRUnichar * aSrc, PRInt32 aSrcLength,
PRInt32 * aDestLength);
};
#endif /* nsUnicodeToJISx0212_h___ */

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

@ -58,27 +58,8 @@ static const PRInt16 g_SJISShiftTable[] = {
nsUnicodeToSJIS::nsUnicodeToSJIS()
: nsTableEncoderSupport((uShiftTable*) &g_SJISShiftTable,
(uMappingTable*) &g_SJISMappingTable)
(uMappingTable*) &g_SJISMappingTable,
2 /* max length = src * 2 */)
{
}
nsresult nsUnicodeToSJIS::CreateInstance(nsISupports ** aResult)
{
nsIUnicodeEncoder *p = new nsUnicodeToSJIS();
if(p) {
*aResult = p;
return NS_OK;
}
return NS_ERROR_OUT_OF_MEMORY;
}
//----------------------------------------------------------------------
// Subclassing of nsTableEncoderSupport class [implementation]
NS_IMETHODIMP nsUnicodeToSJIS::GetMaxLength(const PRUnichar * aSrc,
PRInt32 aSrcLength,
PRInt32 * aDestLength)
{
*aDestLength = 2*aSrcLength;
return NS_OK;
}

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

@ -39,7 +39,7 @@
#ifndef nsUnicodeToSJIS_h___
#define nsUnicodeToSJIS_h___
#include "nsUCvJaSupport.h"
#include "nsUCSupport.h"
//----------------------------------------------------------------------
// Class nsUnicodeToSJIS [declaration]
@ -59,18 +59,8 @@ public:
*/
nsUnicodeToSJIS();
/**
* Static class constructor.
*/
static nsresult CreateInstance(nsISupports **aResult);
protected:
//--------------------------------------------------------------------
// Subclassing of nsEncoderSupport class [declaration]
NS_IMETHOD GetMaxLength(const PRUnichar * aSrc, PRInt32 aSrcLength,
PRInt32 * aDestLength);
};
#endif /* nsUnicodeToSJIS_h___ */

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

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

@ -27,9 +27,8 @@ VPATH = @srcdir@
include $(DEPTH)/config/autoconf.mk
MODULE = ucvko
LIBRARY_NAME = ucvko
EXPORT_LIBRARY = 1
IS_COMPONENT = 1
LIBRARY_NAME = ucvko_s
FORCE_STATIC_LIB=1
MODULE_NAME = nsUCvKoModule
REQUIRES = xpcom \
string \
@ -48,16 +47,15 @@ CPPSRCS = \
nsUnicodeToJohab.cpp \
nsJohabToUnicode.cpp \
nsUnicodeToJohabNoAscii.cpp \
nsUCvKOSupport.cpp \
nsUCvKoModule.cpp \
$(NULL)
EXPORTS = nsUCvKOCID.h
EXTRA_DSO_LDOPTS += $(MOZ_COMPONENT_LIBS)
LOCAL_INCLUDES = -I$(srcdir)/../util
include $(topsrcdir)/config/rules.mk
DEFINES += -D_IMPL_NS_INTL
ifeq ($(OS_ARCH),WINNT)
DEFINES += -DWIN32_LEAN_AND_MEAN
endif

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

@ -95,7 +95,7 @@ static const PRUint16 *g_CP949ShiftTableSet [] = {
};
static const PRUint16 *g_CP949MappingTableSet [] ={
g_AsciiMapping,
g_ucvko_AsciiMapping,
g_HangulNullMapping,
g_utKSC5601Mapping,
g_utCP949NoKSCHangulMapping,
@ -112,19 +112,7 @@ nsCP949ToUnicode::nsCP949ToUnicode()
: nsMultiTableDecoderSupport(sizeof(g_CP949Ranges) / sizeof(g_CP949Ranges[0]),
(uRange*) &g_CP949Ranges,
(uShiftTable**) &g_CP949ShiftTableSet,
(uMappingTable**) &g_CP949MappingTableSet)
(uMappingTable**) &g_CP949MappingTableSet, 1)
{
}
//----------------------------------------------------------------------
// Subclassing of nsTablesDecoderSupport class [implementation]
NS_IMETHODIMP nsCP949ToUnicode::GetMaxLength(const char * aSrc,
PRInt32 aSrcLength,
PRInt32 * aDestLength)
{
// we are a single byte to Unicode converter, so...
*aDestLength = aSrcLength;
return NS_OK_UDEC_EXACTLENGTH;
}

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

@ -39,7 +39,7 @@
#ifndef nsCP949ToUnicode_h___
#define nsCP949ToUnicode_h___
#include "nsUCvKOSupport.h"
#include "nsUCSupport.h"
//----------------------------------------------------------------------
// Class nsCP949ToUnicode [declaration]
@ -60,12 +60,6 @@ public:
nsCP949ToUnicode();
protected:
//--------------------------------------------------------------------
// Subclassing of nsDecoderSupport class [declaration]
NS_IMETHOD GetMaxLength(const char * aSrc, PRInt32 aSrcLength,
PRInt32 * aDestLength);
};
#endif /* nsCP949ToUnicode_h___ */

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

@ -39,7 +39,7 @@
#ifndef nsEUCKRToUnicode_h___
#define nsEUCKRToUnicode_h___
#include "nsUCvKOSupport.h"
#include "nsUCSupport.h"
#include "nsCP949ToUnicode.h"
//----------------------------------------------------------------------

Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше