Closed Bug 251880 Opened 20 years ago Closed 19 years ago

TestUConv fails in method DisplayDetectors -- missing HasMore

Categories

(Core :: Internationalization, defect)

defect
Not set
minor

Tracking

()

RESOLVED FIXED

People

(Reporter: klavins, Assigned: klavins)

Details

Attachments

(1 file)

User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7) Gecko/20040710
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7) Gecko/20040710

Testing the internationalisation code of a locally built MOZILLA_1_7_1_RELEASE
reveled a bug in the test code 'TestUConv' when invoked with the parameter
'-display'.

Reproducible: Always
Steps to Reproduce:
1. Download and build MOZILLA_1_7_1_RELEASE.
2. Test the internationalisation library by executing in dist/bin:

TestUConv -display
Actual Results:  
Truncated output terminated by an error:

***** Character Set Detectors *****
chardet.cjk_parallel_state_machine  "East Asian"
chardet.ko_parallel_state_machine   "Korean"
chardet.ruprob                      "Russian"
chardet.off                         "(Off)"
chardet.universal_charset_detector  "Universal"
chardet.zhcn_parallel_state_machine "Simplified Chinese"
chardet.zhtw_parallel_state_machine "Traditional Chinese"
chardet.zh_parallel_state_machine   "Chinese"
chardet.ja_parallel_state_machine   "Japanese"
chardet.ukprob                      "Ukrainian"
WARNING: NS_ENSURE_TRUE(mIndex < Count()) failed, file
c:/src/mozilla/xpcom/ds/nsStringEnumerator.cpp, line 170
ERROR at Main.DisplayDetectors.GetNext() code=0x8000ffff.

Expected Results:  
The output should continue and also display other information like the character
sets:

***** Character Set Detectors *****
chardet.cjk_parallel_state_machine  "East Asian"
chardet.ko_parallel_state_machine   "Korean"
chardet.ruprob                      "Russian"
chardet.off                         "(Off)"
chardet.universal_charset_detector  "Universal"
chardet.zhcn_parallel_state_machine "Simplified Chinese"
chardet.zhtw_parallel_state_machine "Traditional Chinese"
chardet.zh_parallel_state_machine   "Chinese"
chardet.ja_parallel_state_machine   "Japanese"
chardet.ukprob                      "Ukrainian"
***** Character Sets *****
UTF-16                  DbEb BCVE(  1,   1)  "Unicode (UTF-16)"
ISO-8859-8-E            DbEb XCVE(  2,   2)  "Hebrew (ISO-8859-8-E)"
ISO-8859-4              DbEb BCVE(  3,   3)  "Baltic (ISO-8859-4)"

...

I have located the error in the source code.  It is a missing HasMore method in
the while loop enumerating detectors, and appending HasMore inside the loop at
the end fixes the problem:

--- TestUConv-1.21.cpp  2004-07-17 16:04:44.000000000 +0200
+++ TestUConv.cpp       2004-07-17 14:30:31.000000000 +0200
@@ -307,6 +307,8 @@
     res = ccMan->GetCharsetTitle(detectorName.get(), title);
     if (NS_FAILED(res)) title.SetLength(0);
     printf("\"%s\"\n", NS_LossyConvertUCS2toASCII(title).get());
+
+    detectors->HasMore(&hasMore);
   }

   mLog.DelTrace(trace);

My Mozilla is MOZILLA_1_7_1_RELEASE, so the diff is against TestUConv.cpp 1.21.
 The problem still exists in the latest version 1.23.
Assignee: smontagu → klavins
Status: UNCONFIRMED → NEW
Ever confirmed: true
OS: Windows XP → All
Hardware: PC → All
Comment on attachment 153525 [details] [diff] [review]
Reporter's patch

Good catch. r=smontagu. Please ask for super-review.
Attachment #153525 - Flags: review+
Attachment #153525 - Flags: superreview?(alecf)
Comment on attachment 153525 [details] [diff] [review]
Reporter's patch

sorry, clearing out old reviews.. sr=alecf
Attachment #153525 - Flags: superreview?(alecf) → superreview+
Checked in.
Status: NEW → RESOLVED
Closed: 19 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: