From 3996b9d648a19f6b95d363c766a0838821642aa1 Mon Sep 17 00:00:00 2001 From: Jehan Date: Sun, 14 Mar 2021 12:59:25 +0100 Subject: [PATCH] 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. --- src/CMakeLists.txt | 1 + src/CharDistribution.h | 2 +- src/JohabFreq.tab | 2 +- src/nsJohabProber.cpp | 4 ++-- src/nsJohabProber.h | 2 +- src/nsMBCSGroupProber.cpp | 3 ++- 6 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 3802ad0..f3cb919 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -46,6 +46,7 @@ set( nsEscCharsetProber.cpp nsEscSM.cpp nsGB2312Prober.cpp + nsJohabProber.cpp nsMBCSGroupProber.cpp nsMBCSSM.cpp nsSBCSGroupProber.cpp diff --git a/src/CharDistribution.h b/src/CharDistribution.h index 8bb733b..fda7d5c 100644 --- a/src/CharDistribution.h +++ b/src/CharDistribution.h @@ -164,7 +164,7 @@ class JohabDistributionAnalysis : public CharDistributionAnalysis public: JohabDistributionAnalysis(); protected: - //for Johab encoding, we are interested + //for Johab encoding, we are interested // first byte range: 0x88 -- 0xd3 // second byte range: 0x41 -- 0xfe //no validation needed here. State machine has done that diff --git a/src/JohabFreq.tab b/src/JohabFreq.tab index 05c980c..570ab2f 100644 --- a/src/JohabFreq.tab +++ b/src/JohabFreq.tab @@ -56,7 +56,7 @@ static const PRUint8 JohabJong[32] = { 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b, 0xff, 0xff, }; -//Johab to EUC-KR Order +//Johab to EUC-KR Order static const PRInt16 JohabToEUCKROrder[] = { 0, 1, -1, -1, 2, -1, -1, 3, 4, 5, 6, -1, -1, -1, -1, -1, diff --git a/src/nsJohabProber.cpp b/src/nsJohabProber.cpp index f4cca6a..379a9c3 100644 --- a/src/nsJohabProber.cpp +++ b/src/nsJohabProber.cpp @@ -39,7 +39,7 @@ void nsJohabProber::Reset(void) { - mCodingSM->Reset(); + mCodingSM->Reset(); mState = eDetecting; mDistributionAnalyser.Reset(mIsPreferredLanguage); //mContextAnalyser.Reset(); @@ -47,7 +47,7 @@ void nsJohabProber::Reset(void) nsProbingState nsJohabProber::HandleData(const char* aBuf, PRUint32 aLen) { - nsSMState codingState; + PRUint32 codingState; for (PRUint32 i = 0; i < aLen; i++) { diff --git a/src/nsJohabProber.h b/src/nsJohabProber.h index be94a13..e7bc520 100644 --- a/src/nsJohabProber.h +++ b/src/nsJohabProber.h @@ -59,7 +59,7 @@ public: protected: void GetDistribution(PRUint32 aCharLen, const char* aStr); - + nsCodingStateMachine* mCodingSM; nsProbingState mState; diff --git a/src/nsMBCSGroupProber.cpp b/src/nsMBCSGroupProber.cpp index 859b179..dfeb0a8 100644 --- a/src/nsMBCSGroupProber.cpp +++ b/src/nsMBCSGroupProber.cpp @@ -74,7 +74,8 @@ nsMBCSGroupProber::nsMBCSGroupProber(PRUint32 aLanguageFilter) } if (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[7] = new nsJohabProber(aLanguageFilter == NS_FILTER_KOREAN); }