From 257b693f860b633402876f8b4314894a485a23ec Mon Sep 17 00:00:00 2001 From: "ftang%netscape.com" Date: Fri, 10 Sep 1999 18:59:48 +0000 Subject: [PATCH] 1. change to UTF-16BE/LE name, 2. fix problem in nsPSMDetector 3.add addtional debugging infor to DetectCharset --- intl/chardet/src/nsPSMDetectors.cpp | 4 ++-- intl/chardet/src/nsUCS2BEVerifier.h | 2 +- intl/chardet/src/nsUCS2LEVerifier.h | 2 +- intl/chardet/tests/DetectCharset.cpp | 4 ++++ intl/chardet/tools/genucs2be.pl | 2 +- intl/chardet/tools/genucs2le.pl | 2 +- 6 files changed, 10 insertions(+), 6 deletions(-) diff --git a/intl/chardet/src/nsPSMDetectors.cpp b/intl/chardet/src/nsPSMDetectors.cpp index 3c9caffc435..5ce75bc4e8a 100644 --- a/intl/chardet/src/nsPSMDetectors.cpp +++ b/intl/chardet/src/nsPSMDetectors.cpp @@ -187,8 +187,8 @@ PRBool nsPSMDetector::HandleData(const char* aBuf, PRUint32 aLen) ); #endif Report( mVerifier[mItemIdx[j]]->charset); - mDone = mDone; - return PR_TRUE; + mDone = PR_TRUE; + return mDone; } else if (eError == st) { #ifdef DETECTOR_DEBUG diff --git a/intl/chardet/src/nsUCS2BEVerifier.h b/intl/chardet/src/nsUCS2BEVerifier.h index 3b2ca1987cc..7c4a895cca5 100644 --- a/intl/chardet/src/nsUCS2BEVerifier.h +++ b/intl/chardet/src/nsUCS2BEVerifier.h @@ -71,7 +71,7 @@ PCK4BITS( 6, 6, 6, 6,eError,eError,eStart,eStart) //30-37 static nsVerifier nsUCS2BEVerifier = { - "ISO-10646-UCS-2", + "UTF-16BE", { eIdxSft4bits, eSftMsk4bits, diff --git a/intl/chardet/src/nsUCS2LEVerifier.h b/intl/chardet/src/nsUCS2LEVerifier.h index 85f20ec8d68..5b7120186e6 100644 --- a/intl/chardet/src/nsUCS2LEVerifier.h +++ b/intl/chardet/src/nsUCS2LEVerifier.h @@ -71,7 +71,7 @@ PCK4BITS( 5, 5, 5,eError, 5,eError,eStart,eStart) //30-37 static nsVerifier nsUCS2LEVerifier = { - "ISO-10646-UCS-2-LE", + "UTF-16LE", { eIdxSft4bits, eSftMsk4bits, diff --git a/intl/chardet/tests/DetectCharset.cpp b/intl/chardet/tests/DetectCharset.cpp index 2df2c2db952..81657f57e6d 100644 --- a/intl/chardet/tests/DetectCharset.cpp +++ b/intl/chardet/tests/DetectCharset.cpp @@ -337,7 +337,9 @@ int main(int argc, char** argv) { sz = read(0, buf, bs); if(sz > 0) { if(! done) { +printf("call DoIt %d\n",sz); rev = det->DoIt( buf, sz, &done); +printf("DoIt return Done = %d\n",done); if(NS_FAILED(rev)) { printf("XPCOM ERROR CODE = %x\n", rev); @@ -351,6 +353,8 @@ int main(int argc, char** argv) { } while(sz > 0); if(!done) { +printf("Done = %d\n",done); +printf("call Done %d\n",sz); rev = det->Done(); if(NS_FAILED(rev)) { diff --git a/intl/chardet/tools/genucs2be.pl b/intl/chardet/tools/genucs2be.pl index c29dc729360..cf593ce6f36 100644 --- a/intl/chardet/tools/genucs2be.pl +++ b/intl/chardet/tools/genucs2be.pl @@ -93,7 +93,7 @@ package genverifier; ); -$ucs2be_ver = genverifier::GenVerifier("UCS2BE", "ISO-10646-UCS-2", +$ucs2be_ver = genverifier::GenVerifier("UCS2BE", "UTF-16BE", \@ucs2be_cls, 6, \@ucs2be_st); print $ucs2be_ver; diff --git a/intl/chardet/tools/genucs2le.pl b/intl/chardet/tools/genucs2le.pl index f503b14e2bb..9c8a0362302 100644 --- a/intl/chardet/tools/genucs2le.pl +++ b/intl/chardet/tools/genucs2le.pl @@ -95,7 +95,7 @@ package genverifier; ); -$ucs2le_ver = genverifier::GenVerifier("UCS2LE", "ISO-10646-UCS-2-LE", \@ucs2le_cls, +$ucs2le_ver = genverifier::GenVerifier("UCS2LE", "UTF-16LE", \@ucs2le_cls, 6, \@ucs2le_st); print $ucs2le_ver;