ICU-1855 Considered strings to be Null-terminated, when they were not. Fixed.

X-SVN-Rev: 10054
This commit is contained in:
Vladimir Weinstein 2002-10-23 21:11:51 +00:00
parent b5a133cc7d
commit 8d1a83e3d5

View File

@ -542,7 +542,7 @@ int32_t ucol_uprv_tok_readOption(const UChar *start, const UChar *end, const UCh
static static
uint8_t ucol_uprv_tok_readAndSetOption(UColTokenParser *src, UErrorCode *status) { uint8_t ucol_uprv_tok_readAndSetOption(UColTokenParser *src, UErrorCode *status) {
const UChar* start = src->current; const UChar* start = src->current;
uint32_t i = 0; int32_t i = 0;
int32_t j=0; int32_t j=0;
const UChar *optionArg = NULL; const UChar *optionArg = NULL;
@ -1533,37 +1533,43 @@ void ucol_tok_initTokenList(UColTokenParser *src, const UChar *rules, const uint
// first we need to find options that don't like to be normalized, // first we need to find options that don't like to be normalized,
// like copy and remove... // like copy and remove...
const UChar *openBrace = rules; //const UChar *openBrace = rules;
int32_t optionNumber = -1; int32_t optionNumber = -1;
const UChar *setStart; const UChar *setStart;
while((openBrace = u_strchr(openBrace, 0x005B)) != NULL) { // find open braces uint32_t i = 0;
optionNumber = ucol_uprv_tok_readOption(openBrace+1, rules+rulesLength, &setStart); while(i < rulesLength) {
if(optionNumber == 13) { /* copy - parts of UCA to tailoring */ if(rules[i] == 0x005B) {
USet *newSet = ucol_uprv_tok_readAndSetUnicodeSet(setStart, rules+rulesLength, status); // while((openBrace = u_strchr(openBrace, 0x005B)) != NULL) { // find open braces
if(U_SUCCESS(*status)) { //optionNumber = ucol_uprv_tok_readOption(openBrace+1, rules+rulesLength, &setStart);
if(src->copySet == NULL) { optionNumber = ucol_uprv_tok_readOption(rules+i+1, rules+rulesLength, &setStart);
src->copySet = newSet; if(optionNumber == 13) { /* copy - parts of UCA to tailoring */
USet *newSet = ucol_uprv_tok_readAndSetUnicodeSet(setStart, rules+rulesLength, status);
if(U_SUCCESS(*status)) {
if(src->copySet == NULL) {
src->copySet = newSet;
} else {
((UnicodeSet *)src->copySet)->addAll(*((UnicodeSet *)newSet));
uset_close(newSet);
}
} else { } else {
((UnicodeSet *)src->copySet)->addAll(*((UnicodeSet *)newSet)); return;
uset_close(newSet);
} }
} else { } else if(optionNumber == 14) {
return; USet *newSet = ucol_uprv_tok_readAndSetUnicodeSet(setStart, rules+rulesLength, status);
} if(U_SUCCESS(*status)) {
} else if(optionNumber == 14) { if(src->removeSet == NULL) {
USet *newSet = ucol_uprv_tok_readAndSetUnicodeSet(setStart, rules+rulesLength, status); src->removeSet = newSet;
if(U_SUCCESS(*status)) { } else {
if(src->removeSet == NULL) { ((UnicodeSet *)src->removeSet)->addAll(*((UnicodeSet *)newSet));
src->removeSet = newSet; uset_close(newSet);
}
} else { } else {
((UnicodeSet *)src->removeSet)->addAll(*((UnicodeSet *)newSet)); return;
uset_close(newSet);
} }
} else {
return;
} }
} }
openBrace++; //openBrace++;
i++;
} }
src->source = (UChar *)uprv_malloc(estimatedSize*sizeof(UChar)); src->source = (UChar *)uprv_malloc(estimatedSize*sizeof(UChar));