mirror of
https://github.com/unicode-org/icu.git
synced 2025-04-10 07:39:16 +00:00
ICU-6955 Fix potential error in mbcs and add more code coverage test cases.
X-SVN-Rev: 26194
This commit is contained in:
parent
f6536b3ed4
commit
737d833448
7 changed files with 23 additions and 9 deletions
|
@ -2074,7 +2074,7 @@ unrolled:
|
|||
#endif
|
||||
|
||||
/* conversion loop */
|
||||
while(targetCapacity>0) {
|
||||
while(targetCapacity > 0 && source < sourceLimit) {
|
||||
entry=stateTable[0][*source++];
|
||||
/* MBCS_ENTRY_IS_FINAL(entry) */
|
||||
|
||||
|
|
|
@ -1015,7 +1015,7 @@ ConversionTest::ToUnicodeCase(ConversionCase &cc, UConverterToUCallback callback
|
|||
// otherwise do nothing to make sure that flushing resets
|
||||
ucnv_resetToUnicode(cnv);
|
||||
}
|
||||
if (resultOffsets[resultLength] != -1) {
|
||||
if (cc.offsets != NULL && resultOffsets[resultLength] != -1) {
|
||||
errln("toUnicode[%d](%s) Conversion wrote too much to offsets at index %d",
|
||||
cc.caseNr, cc.charset, resultLength);
|
||||
}
|
||||
|
|
14
icu4c/source/test/testdata/conversion.txt
vendored
14
icu4c/source/test/testdata/conversion.txt
vendored
|
@ -915,6 +915,20 @@ conversion:table(nofallback) {
|
|||
:intvector{},
|
||||
:int{1}, :int{0}, "", "?", :bin{""}
|
||||
}
|
||||
{
|
||||
"*test1",
|
||||
:bin{ 0a0b },
|
||||
"",
|
||||
:intvector{},
|
||||
:int{1}, :int{0}, "", "0", :bin{""}
|
||||
}
|
||||
{
|
||||
"*test1bmp",
|
||||
:bin{ 0c06 },
|
||||
"\u0066",
|
||||
:intvector{},
|
||||
:int{0}, :int{0}, "", ".", :bin{""}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
4
icu4c/source/test/testdata/test1.ucm
vendored
4
icu4c/source/test/testdata/test1.ucm
vendored
|
@ -1,5 +1,5 @@
|
|||
# *******************************************************************************
|
||||
# * Copyright (C) 2001-2003, International Business Machines
|
||||
# * Copyright (C) 2001-2009, International Business Machines
|
||||
# * Corporation and others. All Rights Reserved.
|
||||
# *******************************************************************************
|
||||
#
|
||||
|
@ -12,7 +12,7 @@
|
|||
<mb_cur_min> 1
|
||||
<uconv_class> "MBCS"
|
||||
<subchar> \xff
|
||||
<icu:state> 0, 5-9, ff
|
||||
<icu:state> 0, 5-9, a:0.s, ff
|
||||
|
||||
CHARMAP
|
||||
|
||||
|
|
4
icu4c/source/test/testdata/test1bmp.ucm
vendored
4
icu4c/source/test/testdata/test1bmp.ucm
vendored
|
@ -1,5 +1,5 @@
|
|||
# *******************************************************************************
|
||||
# * Copyright (C) 2007, International Business Machines
|
||||
# * Copyright (C) 2007-2009, International Business Machines
|
||||
# * Corporation and others. All Rights Reserved.
|
||||
# *******************************************************************************
|
||||
#
|
||||
|
@ -14,7 +14,7 @@
|
|||
<mb_cur_min> 1
|
||||
<uconv_class> "MBCS"
|
||||
<subchar> \xff
|
||||
<icu:state> 0, 5-9, ff
|
||||
<icu:state> 0, 5-9, c:0.s, ff
|
||||
|
||||
CHARMAP
|
||||
|
||||
|
|
|
@ -2323,7 +2323,7 @@ class CharsetMBCS extends CharsetICU {
|
|||
}
|
||||
|
||||
/* conversion loop */
|
||||
while (targetCapacity > 0) {
|
||||
while (targetCapacity > 0 && sourceArrayIndex < source.limit()) {
|
||||
entry = stateTable[0][source.get(sourceArrayIndex++) & UConverterConstants.UNSIGNED_BYTE_MASK];
|
||||
/* MBCS_ENTRY_IS_FINAL(entry) */
|
||||
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:bfd9f10fc4a9cfe46d6af81b5800f3d55a3d80e5e85d7f1a57a8c856483a963b
|
||||
size 776398
|
||||
oid sha256:fb7c24961b3cd13b1f29084dfbbb51bfc3c3f844b55d790a229f34b2a4c14f81
|
||||
size 773475
|
||||
|
|
Loading…
Add table
Reference in a new issue