ICU-3100 collator <> identifier, bug fix

X-SVN-Rev: 15545
This commit is contained in:
Vladimir Weinstein 2004-05-25 23:00:52 +00:00
parent f3c1821513
commit f9d36f208d
2 changed files with 12 additions and 11 deletions

View File

@ -184,8 +184,8 @@ _processLocaleElement(CollatorSpec *spec, uint32_t value, const char* string,
*status = U_BUFFER_OVERFLOW_ERROR;
return string;
}
// skip the underscore at the end
return ++string;
// don't skip the underscore at the end
return string;
}
U_CDECL_END
@ -202,7 +202,7 @@ _processRFC3066Locale(CollatorSpec *spec, uint32_t value1, const char* string,
return string;
} else {
uprv_strncpy(spec->locale, string, end-string);
return end+2;
return end+1;
}
}
@ -217,9 +217,8 @@ _processCollatorOption(CollatorSpec *spec, uint32_t option, const char* string,
spec->options[option] = ucol_sit_letterToAttributeValue(*string, status);
if((*(++string) != '_' && *string) || U_FAILURE(*status)) {
*status = U_ILLEGAL_ARGUMENT_ERROR;
return string;
}
return ++string;
return string;
}
U_CDECL_END
@ -264,10 +263,8 @@ _processVariableTop(CollatorSpec *spec, uint32_t value1, const char* string, UEr
}
if(U_SUCCESS(*status)) {
spec->variableTopSet = TRUE;
return string+1; // to move over the '_'
} else {
return string;
}
}
return string;
}
U_CDECL_END
@ -310,7 +307,7 @@ const char* ucol_sit_readOption(const char *start, CollatorSpec *spec,
if(*start == options[i].optionStart) {
spec->entries[i].start = start;
const char* end = options[i].action(spec, options[i].attr, start+1, status);
spec->entries[i].len = end - start - 1;
spec->entries[i].len = end - start;
return end;
}
}
@ -337,6 +334,10 @@ ucol_sit_readSpecs(CollatorSpec *s, const char *string,
const char *definition = string;
while(U_SUCCESS(*status) && *string) {
string = ucol_sit_readOption(string, s, status);
// advance over '_'
while(*string && *string == '_') {
string++;
}
}
if(U_FAILURE(*status)) {
parseError->offset = string - definition;

View File

@ -1735,7 +1735,7 @@ static void TestShortString(void)
{"LDE_Kphonebook","KPHONEBOOK_LDE", "de@collation=phonebook", U_ZERO_ERROR, 0, 0 },
{"Xqde_DE@collation=phonebookq_S3_EX","KPHONEBOOK_LDE", "de@collation=phonebook", U_USING_FALLBACK_WARNING, 0, 0 },
{"LFR_FO", "LFR", NULL, U_ZERO_ERROR, 0, 0 },
{"SO_LX_AS", "", NULL, U_ILLEGAL_ARGUMENT_ERROR, 9, 0 },
{"SO_LX_AS", "", NULL, U_ILLEGAL_ARGUMENT_ERROR, 8, 0 },
{"S3_ASS_MMM", "", NULL, U_ILLEGAL_ARGUMENT_ERROR, 5, 0 }
};