mirror of
https://github.com/unicode-org/icu.git
synced 2025-04-08 15:05:53 +00:00
ICU-2840 tests shouldn't crash if there is no data
X-SVN-Rev: 12342
This commit is contained in:
parent
34a35748f5
commit
752e44d7d9
4 changed files with 16 additions and 6 deletions
|
@ -180,10 +180,10 @@ UnicodeString CanonicalIterator::next() {
|
|||
* while changing the source string, saving object creation.
|
||||
*/
|
||||
void CanonicalIterator::setSource(const UnicodeString &newSource, UErrorCode &status) {
|
||||
Normalizer::normalize(newSource, UNORM_NFD, 0, source, status);
|
||||
if(U_FAILURE(status)) {
|
||||
return;
|
||||
}
|
||||
Normalizer::normalize(newSource, UNORM_NFD, 0, source, status);
|
||||
done = FALSE;
|
||||
|
||||
cleanPieces();
|
||||
|
|
|
@ -505,8 +505,12 @@ CLEANUP:
|
|||
// So if any step fails lets copy source to destination
|
||||
if(U_FAILURE(*status)){
|
||||
//copy the source to destination
|
||||
if(srcLength <= destCapacity){
|
||||
if(dest && srcLength <= destCapacity){
|
||||
if(srcLength == -1) {
|
||||
uprv_memmove(dest,src,u_strlen(src)* U_SIZEOF_UCHAR);
|
||||
} else {
|
||||
uprv_memmove(dest,src,srcLength * U_SIZEOF_UCHAR);
|
||||
}
|
||||
}
|
||||
reqLength = srcLength;
|
||||
}
|
||||
|
|
|
@ -428,8 +428,13 @@ void SimpleDateFormat::initializeDefaultCentury()
|
|||
*/
|
||||
void SimpleDateFormat::parseAmbiguousDatesAsAfter(UDate startDate, UErrorCode& status)
|
||||
{
|
||||
if(U_FAILURE(status))
|
||||
if(U_FAILURE(status)) {
|
||||
return;
|
||||
}
|
||||
if(!fCalendar) {
|
||||
status = U_ILLEGAL_ARGUMENT_ERROR;
|
||||
return;
|
||||
}
|
||||
|
||||
fCalendar->setTime(startDate, status);
|
||||
if(U_SUCCESS(status)) {
|
||||
|
|
|
@ -157,6 +157,7 @@ RuleBasedCollator::construct(const UnicodeString& rules,
|
|||
UColAttributeValue decompositionMode,
|
||||
UErrorCode& status)
|
||||
{
|
||||
urulestring = 0;
|
||||
ucollator = ucol_openRules(rules.getBuffer(), rules.length(),
|
||||
decompositionMode, collationStrength,
|
||||
NULL, &status);
|
||||
|
@ -596,13 +597,13 @@ RuleBasedCollator::setLocales(const Locale& requestedLocale, const Locale& valid
|
|||
// RuleBaseCollatorNew private constructor ----------------------------------
|
||||
|
||||
RuleBasedCollator::RuleBasedCollator()
|
||||
: dataIsOwned(FALSE), isWriteThroughAlias(FALSE), ucollator(0)
|
||||
: dataIsOwned(FALSE), isWriteThroughAlias(FALSE), ucollator(0), urulestring(0)
|
||||
{
|
||||
}
|
||||
|
||||
RuleBasedCollator::RuleBasedCollator(UCollator *collator,
|
||||
UnicodeString *rule)
|
||||
: dataIsOwned(FALSE), isWriteThroughAlias(FALSE)
|
||||
: dataIsOwned(FALSE), isWriteThroughAlias(FALSE), urulestring(0)
|
||||
{
|
||||
ucollator = collator;
|
||||
urulestring = rule;
|
||||
|
@ -610,7 +611,7 @@ RuleBasedCollator::RuleBasedCollator(UCollator *collator,
|
|||
|
||||
RuleBasedCollator::RuleBasedCollator(const Locale& desiredLocale,
|
||||
UErrorCode& status) :
|
||||
dataIsOwned(FALSE), ucollator(0)
|
||||
dataIsOwned(FALSE), ucollator(0), urulestring(0)
|
||||
{
|
||||
if (U_FAILURE(status))
|
||||
return;
|
||||
|
|
Loading…
Add table
Reference in a new issue