ICU-7273 minor C++ changes parallel with Java

X-SVN-Rev: 27494
This commit is contained in:
Markus Scherer 2010-02-04 23:57:28 +00:00
parent 343795167d
commit 7f34717f2e
3 changed files with 9 additions and 7 deletions

View File

@ -178,6 +178,7 @@ FilteredNormalizer2::quickCheck(const UnicodeString &s, UErrorCode &errorCode) c
if(U_FAILURE(errorCode)) {
return UNORM_MAYBE;
}
UNormalizationCheckResult result=UNORM_YES;
USetSpanCondition spanCondition=USET_SPAN_SIMPLE;
for(int32_t prevSpanLimit=0; prevSpanLimit<s.length();) {
int32_t spanLimit=set.span(s, prevSpanLimit, spanCondition);
@ -186,14 +187,16 @@ FilteredNormalizer2::quickCheck(const UnicodeString &s, UErrorCode &errorCode) c
} else {
UNormalizationCheckResult qcResult=
norm2.quickCheck(s.tempSubStringBetween(prevSpanLimit, spanLimit), errorCode);
if(U_FAILURE(errorCode) || qcResult!=UNORM_YES) {
if(U_FAILURE(errorCode) || qcResult==UNORM_NO) {
return qcResult;
} else if(qcResult==UNORM_MAYBE) {
result=qcResult;
}
spanCondition=USET_SPAN_NOT_CONTAINED;
}
prevSpanLimit=spanLimit;
}
return UNORM_YES;
return result;
}
int32_t

View File

@ -1426,7 +1426,7 @@ void Normalizer2Impl::setFCD16FromNorm16(UChar32 start, UChar32 end, uint16_t no
} else {
norm16=0;
}
norm16|=*mapping>>8; // tccc
norm16|=firstUnit>>8; // tccc
}
}
utrie2_setRange32(newFCDTrie, start, end, norm16, TRUE, &errorCode);

View File

@ -138,12 +138,11 @@ void NormalizationTransliterator::handleTransliterate(Replaceable& text, UTransP
int32_t prev = start;
// Skip at least one character so we make progress.
// c holds the character at start.
segment.setTo(c);
start += U16_LENGTH(c);
while(start < limit && !fNorm2.hasBoundaryBefore(c = text.char32At(start))) {
segment.remove();
do {
segment.append(c);
start += U16_LENGTH(c);
}
} while(start < limit && !fNorm2.hasBoundaryBefore(c = text.char32At(start)));
if(start == limit && isIncremental && !fNorm2.hasBoundaryAfter(c)) {
// stop in incremental mode when we reach the input limit
// in case there are additional characters that could change the