diff --git a/intl/chardet/src/nsPSMDetectors.cpp b/intl/chardet/src/nsPSMDetectors.cpp index e1aac77acec..1c2b2b878ab 100644 --- a/intl/chardet/src/nsPSMDetectors.cpp +++ b/intl/chardet/src/nsPSMDetectors.cpp @@ -153,6 +153,10 @@ void nsPSMDetector::DataEnd() { } //---------------------------------------------------------- + +// #define ftang_TRACE_STATE +// #define TRACE_VERIFIER nsCP1252Verifier + PRBool nsPSMDetector::HandleData(const char* aBuf, PRUint32 aLen) { PRUint32 i,j; @@ -162,6 +166,12 @@ PRBool nsPSMDetector::HandleData(const char* aBuf, PRUint32 aLen) char b = aBuf[i]; for(j = 0; j < mItems; ) { +#ifdef ftang_TRACE_STATE + if( mVerifier[mItemIdx[j]] == & TRACE_VERIFIER ) + { + printf("%d = %d\n", i + mDbgLen, mState[j]); + } +#endif #ifdef DETECTOR_DEBUG mDbgTest++; #endif @@ -231,63 +241,62 @@ PRBool nsPSMDetector::HandleData(const char* aBuf, PRUint32 aLen) #define ZHTW_DETECTOR_NUM_VERIFIERS 7 static nsVerifier *gZhTwVerifierSet[ZHTW_DETECTOR_NUM_VERIFIERS] = { - &nsCP1252Verifier, &nsUTF8Verifier, &nsBIG5Verifier, &nsISO2022CNVerifier, &nsEUCTWVerifier, + &nsCP1252Verifier, &nsUCS2BEVerifier, &nsUCS2LEVerifier }; //========================================================== #define KO_DETECTOR_NUM_VERIFIERS 6 static nsVerifier *gKoVerifierSet[KO_DETECTOR_NUM_VERIFIERS] = { - &nsCP1252Verifier, &nsUTF8Verifier, &nsEUCKRVerifier, &nsISO2022KRVerifier, + &nsCP1252Verifier, &nsUCS2BEVerifier, &nsUCS2LEVerifier }; //========================================================== #define ZHCN_DETECTOR_NUM_VERIFIERS 7 static nsVerifier *gZhCnVerifierSet[ZHCN_DETECTOR_NUM_VERIFIERS] = { - &nsCP1252Verifier, &nsUTF8Verifier, &nsGB2312Verifier, &nsISO2022CNVerifier, &nsHZVerifier, + &nsCP1252Verifier, &nsUCS2BEVerifier, &nsUCS2LEVerifier }; //========================================================== #define JA_DETECTOR_NUM_VERIFIERS 7 static nsVerifier *gJaVerifierSet[JA_DETECTOR_NUM_VERIFIERS] = { - &nsCP1252Verifier, &nsUTF8Verifier, &nsSJISVerifier, &nsEUCJPVerifier, &nsISO2022JPVerifier, + &nsCP1252Verifier, &nsUCS2BEVerifier, &nsUCS2LEVerifier }; //========================================================== #define ZH_DETECTOR_NUM_VERIFIERS 9 static nsVerifier *gZhVerifierSet[ZH_DETECTOR_NUM_VERIFIERS] = { - &nsCP1252Verifier, &nsUTF8Verifier, &nsGB2312Verifier, &nsBIG5Verifier, &nsISO2022CNVerifier, &nsHZVerifier, &nsEUCTWVerifier, + &nsCP1252Verifier, &nsUCS2BEVerifier, &nsUCS2LEVerifier }; //========================================================== #define CJK_DETECTOR_NUM_VERIFIERS 14 static nsVerifier *gCJKVerifierSet[CJK_DETECTOR_NUM_VERIFIERS] = { - &nsCP1252Verifier, &nsUTF8Verifier, &nsSJISVerifier, &nsEUCJPVerifier, @@ -299,6 +308,7 @@ static nsVerifier *gCJKVerifierSet[CJK_DETECTOR_NUM_VERIFIERS] = { &nsGB2312Verifier, &nsISO2022CNVerifier, &nsHZVerifier, + &nsCP1252Verifier, &nsUCS2BEVerifier, &nsUCS2LEVerifier }; @@ -489,17 +499,17 @@ NS_IMETHODIMP nsXPCOMDetectorFactory::CreateInstance( } else if (mCID.Equals(kCJKPSMDetectorCID)) { inst1 = new nsXPCOMDetector(CJK_DETECTOR_NUM_VERIFIERS, gCJKVerifierSet); } else if (mCID.Equals(kJAStringPSMDetectorCID)) { - inst2 = new nsXPCOMStringDetector(JA_DETECTOR_NUM_VERIFIERS - 2, gJaVerifierSet); + inst2 = new nsXPCOMStringDetector(JA_DETECTOR_NUM_VERIFIERS - 3, gJaVerifierSet); } else if (mCID.Equals(kKOStringPSMDetectorCID)) { - inst2 = new nsXPCOMStringDetector(KO_DETECTOR_NUM_VERIFIERS - 2, gKoVerifierSet); + inst2 = new nsXPCOMStringDetector(KO_DETECTOR_NUM_VERIFIERS - 3, gKoVerifierSet); } else if (mCID.Equals(kZHCNStringPSMDetectorCID)) { - inst2 = new nsXPCOMStringDetector(ZHCN_DETECTOR_NUM_VERIFIERS - 2, gZhCnVerifierSet); + inst2 = new nsXPCOMStringDetector(ZHCN_DETECTOR_NUM_VERIFIERS - 3, gZhCnVerifierSet); } else if (mCID.Equals(kZHTWStringPSMDetectorCID)) { - inst2 = new nsXPCOMStringDetector(ZHTW_DETECTOR_NUM_VERIFIERS - 2, gZhTwVerifierSet); + inst2 = new nsXPCOMStringDetector(ZHTW_DETECTOR_NUM_VERIFIERS - 3, gZhTwVerifierSet); } else if (mCID.Equals(kZHStringPSMDetectorCID)) { - inst2 = new nsXPCOMStringDetector(ZH_DETECTOR_NUM_VERIFIERS - 2, gZhVerifierSet); + inst2 = new nsXPCOMStringDetector(ZH_DETECTOR_NUM_VERIFIERS - 3, gZhVerifierSet); } else if (mCID.Equals(kCJKStringPSMDetectorCID)) { - inst2 = new nsXPCOMStringDetector(CJK_DETECTOR_NUM_VERIFIERS - 2, gCJKVerifierSet); + inst2 = new nsXPCOMStringDetector(CJK_DETECTOR_NUM_VERIFIERS - 3, gCJKVerifierSet); } if((NULL == inst1) && (NULL == inst2)) { return NS_ERROR_OUT_OF_MEMORY;