ICU-2016 mergeOrdered bug fixed

X-SVN-Rev: 9301
This commit is contained in:
Ram Viswanadha 2002-07-24 01:04:10 +00:00
parent 3c942bde51
commit 6e8075fa4c

View File

@ -5,8 +5,8 @@
******************************************************************************* *******************************************************************************
* *
* $Source: /xsrl/Nsvn/icu/icu4j/src/com/ibm/icu/impl/NormalizerImpl.java,v $ * $Source: /xsrl/Nsvn/icu/icu4j/src/com/ibm/icu/impl/NormalizerImpl.java,v $
* $Date: 2002/07/16 00:18:33 $ * $Date: 2002/07/24 01:04:10 $
* $Revision: 1.6 $ * $Revision: 1.7 $
******************************************************************************* *******************************************************************************
*/ */
@ -392,6 +392,7 @@ public final class NormalizerImpl {
private static long getNorm32(int c){ private static long getNorm32(int c){
return (UNSIGNED_INT_MASK&(normTrieImpl.normTrie.getCodePointValue(c))); return (UNSIGNED_INT_MASK&(normTrieImpl.normTrie.getCodePointValue(c)));
} }
private static long getNorm32(int c,int mask){ private static long getNorm32(int c,int mask){
long/*unsigned*/ norm32= getNorm32(UTF16.getLeadSurrogate(c)); long/*unsigned*/ norm32= getNorm32(UTF16.getLeadSurrogate(c));
if(((norm32&mask)>0) && isNorm32LeadSurrogate(norm32)) { if(((norm32&mask)>0) && isNorm32LeadSurrogate(norm32)) {
@ -400,7 +401,8 @@ public final class NormalizerImpl {
} }
return norm32; return norm32;
} }
/*
/*
* get a norm32 from text with complete code points * get a norm32 from text with complete code points
* (like from decompositions) * (like from decompositions)
*/ */
@ -761,12 +763,13 @@ public final class NormalizerImpl {
boolean adjacent; boolean adjacent;
adjacent= current==next; adjacent= current==next;
NextCCArgs ncArgs = new NextCCArgs();
ncArgs.source = data;
ncArgs.next = next;
ncArgs.limit = limit;
if(start!=current || !isOrdered) { if(start!=current || !isOrdered) {
NextCCArgs ncArgs = new NextCCArgs();
ncArgs.source = data;
ncArgs.next = next;
ncArgs.limit = limit;
while(ncArgs.next<ncArgs.limit) { while(ncArgs.next<ncArgs.limit) {
cc=getNextCC(ncArgs); cc=getNextCC(ncArgs);
if(cc==0) { if(cc==0) {
@ -794,21 +797,21 @@ public final class NormalizerImpl {
} }
} }
if(next==limit) { if(ncArgs.next==ncArgs.limit) {
// we know the cc of the last code point // we know the cc of the last code point
return trailCC; return trailCC;
} else { } else {
if(!adjacent) { if(!adjacent) {
// copy the second string part // copy the second string part
do { do {
source[current++]=data[next++]; source[current++]=data[ncArgs.next++];
} while(next!=limit); } while(ncArgs.next!=ncArgs.limit);
limit=current; ncArgs.limit=current;
} }
PrevArgs prevArgs = new PrevArgs(); PrevArgs prevArgs = new PrevArgs();
prevArgs.src = data; prevArgs.src = data;
prevArgs.start = start; prevArgs.start = start;
prevArgs.current = limit; prevArgs.current = ncArgs.limit;
return getPrevCC(prevArgs); return getPrevCC(prevArgs);
} }