mirror of
https://gitlab.freedesktop.org/uchardet/uchardet.git
synced 2025-12-23 20:24:45 +08:00
src: build new charset prober for Johab Korean.
CMake build was not completed and enum state nsSMState disappeared in commit 53f7ad0. Also fixing a few coding style bugs. See discussion in MR !1.
This commit is contained in:
parent
417013219c
commit
b1f6c88792
@ -45,6 +45,7 @@ set(
|
|||||||
nsEscCharsetProber.cpp
|
nsEscCharsetProber.cpp
|
||||||
nsEscSM.cpp
|
nsEscSM.cpp
|
||||||
nsGB2312Prober.cpp
|
nsGB2312Prober.cpp
|
||||||
|
nsJohabProber.cpp
|
||||||
nsMBCSGroupProber.cpp
|
nsMBCSGroupProber.cpp
|
||||||
nsMBCSSM.cpp
|
nsMBCSSM.cpp
|
||||||
nsSBCSGroupProber.cpp
|
nsSBCSGroupProber.cpp
|
||||||
|
|||||||
@ -164,7 +164,7 @@ class JohabDistributionAnalysis : public CharDistributionAnalysis
|
|||||||
public:
|
public:
|
||||||
JohabDistributionAnalysis();
|
JohabDistributionAnalysis();
|
||||||
protected:
|
protected:
|
||||||
//for Johab encoding, we are interested
|
//for Johab encoding, we are interested
|
||||||
// first byte range: 0x88 -- 0xd3
|
// first byte range: 0x88 -- 0xd3
|
||||||
// second byte range: 0x41 -- 0xfe
|
// second byte range: 0x41 -- 0xfe
|
||||||
//no validation needed here. State machine has done that
|
//no validation needed here. State machine has done that
|
||||||
|
|||||||
@ -56,7 +56,7 @@ static const PRUint8 JohabJong[32] = {
|
|||||||
0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b, 0xff, 0xff,
|
0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b, 0xff, 0xff,
|
||||||
};
|
};
|
||||||
|
|
||||||
//Johab to EUC-KR Order
|
//Johab to EUC-KR Order
|
||||||
static const PRInt16 JohabToEUCKROrder[] =
|
static const PRInt16 JohabToEUCKROrder[] =
|
||||||
{
|
{
|
||||||
0, 1, -1, -1, 2, -1, -1, 3, 4, 5, 6, -1, -1, -1, -1, -1,
|
0, 1, -1, -1, 2, -1, -1, 3, 4, 5, 6, -1, -1, -1, -1, -1,
|
||||||
|
|||||||
@ -39,7 +39,7 @@
|
|||||||
|
|
||||||
void nsJohabProber::Reset(void)
|
void nsJohabProber::Reset(void)
|
||||||
{
|
{
|
||||||
mCodingSM->Reset();
|
mCodingSM->Reset();
|
||||||
mState = eDetecting;
|
mState = eDetecting;
|
||||||
mDistributionAnalyser.Reset(mIsPreferredLanguage);
|
mDistributionAnalyser.Reset(mIsPreferredLanguage);
|
||||||
//mContextAnalyser.Reset();
|
//mContextAnalyser.Reset();
|
||||||
@ -47,7 +47,7 @@ void nsJohabProber::Reset(void)
|
|||||||
|
|
||||||
nsProbingState nsJohabProber::HandleData(const char* aBuf, PRUint32 aLen)
|
nsProbingState nsJohabProber::HandleData(const char* aBuf, PRUint32 aLen)
|
||||||
{
|
{
|
||||||
nsSMState codingState;
|
PRUint32 codingState;
|
||||||
|
|
||||||
for (PRUint32 i = 0; i < aLen; i++)
|
for (PRUint32 i = 0; i < aLen; i++)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -59,7 +59,7 @@ public:
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
void GetDistribution(PRUint32 aCharLen, const char* aStr);
|
void GetDistribution(PRUint32 aCharLen, const char* aStr);
|
||||||
|
|
||||||
nsCodingStateMachine* mCodingSM;
|
nsCodingStateMachine* mCodingSM;
|
||||||
nsProbingState mState;
|
nsProbingState mState;
|
||||||
|
|
||||||
|
|||||||
@ -74,7 +74,8 @@ nsMBCSGroupProber::nsMBCSGroupProber(PRUint32 aLanguageFilter)
|
|||||||
}
|
}
|
||||||
if (aLanguageFilter & NS_FILTER_CHINESE_SIMPLIFIED)
|
if (aLanguageFilter & NS_FILTER_CHINESE_SIMPLIFIED)
|
||||||
mProbers[3] = new nsGB18030Prober(aLanguageFilter == NS_FILTER_CHINESE_SIMPLIFIED);
|
mProbers[3] = new nsGB18030Prober(aLanguageFilter == NS_FILTER_CHINESE_SIMPLIFIED);
|
||||||
if (aLanguageFilter & NS_FILTER_KOREAN) {
|
if (aLanguageFilter & NS_FILTER_KOREAN)
|
||||||
|
{
|
||||||
mProbers[4] = new nsEUCKRProber(aLanguageFilter == NS_FILTER_KOREAN);
|
mProbers[4] = new nsEUCKRProber(aLanguageFilter == NS_FILTER_KOREAN);
|
||||||
mProbers[7] = new nsJohabProber(aLanguageFilter == NS_FILTER_KOREAN);
|
mProbers[7] = new nsJohabProber(aLanguageFilter == NS_FILTER_KOREAN);
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user