ICU-2135 modified checks for unsafe characters
X-SVN-Rev: 10460
This commit is contained in:
parent
bcd885f8c0
commit
72601a817c
@ -1003,6 +1003,13 @@ UBool checkNextExactContractionMatch(UStringSearch *strsrch,
|
||||
const UChar *text = strsrch->search->text;
|
||||
// This part checks if either ends of the match contains potential
|
||||
// contraction. If so we'll have to iterate through them
|
||||
// The start contraction needs to be checked since ucol_previous dumps
|
||||
// all characters till the first safe character into the buffer.
|
||||
// *start + 1 is used to test for the unsafe characters instead of *start
|
||||
// because ucol_prev takes all unsafe characters till the first safe
|
||||
// character ie *start. so by testing *start + 1, we can estimate if
|
||||
// excess prefix characters has been included in the potential search
|
||||
// results.
|
||||
if ((*end < textlength && ucol_unsafeCP(text[*end], collator)) ||
|
||||
(*start + 1 < textlength
|
||||
&& ucol_unsafeCP(text[*start + 1], collator))) {
|
||||
@ -1832,13 +1839,15 @@ UBool checkPreviousExactContractionMatch(UStringSearch *strsrch,
|
||||
{
|
||||
UCollationElements *coleiter = strsrch->textIter;
|
||||
int32_t textlength = strsrch->search->textLength;
|
||||
int32_t temp = *end;
|
||||
int32_t temp = *end;
|
||||
const UCollator *collator = strsrch->collator;
|
||||
const UChar *text = strsrch->search->text;
|
||||
// This part checks if either ends of the match contains potential
|
||||
// This part checks if either if the start of the match contains potential
|
||||
// contraction. If so we'll have to iterate through them
|
||||
if ((*end < textlength && ucol_unsafeCP(text[*end], collator)) ||
|
||||
(*start < textlength && ucol_unsafeCP(text[*start + 1], collator))) {
|
||||
// Since we used ucol_next while previously looking for the potential
|
||||
// match, this guarantees that our end will not be a partial contraction,
|
||||
// or a partial supplementary character.
|
||||
if (*start < textlength && ucol_unsafeCP(text[*start], collator)) {
|
||||
int32_t expansion = getExpansionSuffix(coleiter);
|
||||
UBool expandflag = expansion > 0;
|
||||
setColEIterOffset(coleiter, *end);
|
||||
|
Loading…
Reference in New Issue
Block a user