From bee56b37b7f81f552141d258f6cfd1cf0b21bc1a Mon Sep 17 00:00:00 2001 From: George Rhoten Date: Wed, 29 Aug 2007 08:09:55 +0000 Subject: [PATCH] ICU-5808 Declare a UTF-16 string when available instead of converting a string. X-SVN-Rev: 22564 --- icu4c/source/i18n/olsontz.cpp | 6 ++---- icu4c/source/i18n/simpletz.cpp | 14 ++++++++------ 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/icu4c/source/i18n/olsontz.cpp b/icu4c/source/i18n/olsontz.cpp index 184549f7f6..8599d4d2dc 100644 --- a/icu4c/source/i18n/olsontz.cpp +++ b/icu4c/source/i18n/olsontz.cpp @@ -616,10 +616,8 @@ OlsonTimeZone::initTransitionRules(UErrorCode& status) { UnicodeString tzid; getID(tzid); - UnicodeString _std("(STD)", -1, US_INV); - UnicodeString _dst("(DST)", -1, US_INV); - UnicodeString stdName = tzid + _std; - UnicodeString dstName = tzid + _dst; + UnicodeString stdName = tzid + UNICODE_STRING_SIMPLE("(STD)"); + UnicodeString dstName = tzid + UNICODE_STRING_SIMPLE("(DST)"); int32_t raw, dst; if (transitionCount > 0) { diff --git a/icu4c/source/i18n/simpletz.cpp b/icu4c/source/i18n/simpletz.cpp index ff7cd8f3d8..ca827f381d 100644 --- a/icu4c/source/i18n/simpletz.cpp +++ b/icu4c/source/i18n/simpletz.cpp @@ -47,6 +47,10 @@ UOBJECT_DEFINE_RTTI_IMPLEMENTATION(SimpleTimeZone) // Gregorian calendar started. const int8_t SimpleTimeZone::STATICMONTHLENGTH[] = {31,29,31,30,31,30,31,31,30,31,30,31}; +static const UChar DST_STR[] = {0x0028,0x0044,0x0053,0x0054,0x0029,0}; // "(DST)" +static const UChar STD_STR[] = {0x0028,0x0053,0x0054,0x0044,0x0029,0}; // "(STD)" + + // ***************************************************************************** // class SimpleTimeZone // ***************************************************************************** @@ -1021,8 +1025,6 @@ SimpleTimeZone::initTransitionRules(UErrorCode& status) { DateTimeRule* dtRule; DateTimeRule::TimeRuleType timeRuleType; UDate firstStdStart, firstDstStart; - UnicodeString dst("(DST)", -1, US_INV); // These work even if - UnicodeString std("(STD)", -1, US_INV); // UCONFIG_NO_CONVERSION is set. // Create a TimeZoneRule for daylight saving time timeRuleType = (startTimeMode == STANDARD_TIME) ? DateTimeRule::STANDARD_TIME : @@ -1045,7 +1047,7 @@ SimpleTimeZone::initTransitionRules(UErrorCode& status) { return; } // For now, use ID + "(DST)" as the name - dstRule = new AnnualTimeZoneRule(tzid+dst, getRawOffset(), getDSTSavings(), + dstRule = new AnnualTimeZoneRule(tzid+DST_STR, getRawOffset(), getDSTSavings(), dtRule, startYear, AnnualTimeZoneRule::MAX_YEAR); // Calculate the first DST start time @@ -1069,7 +1071,7 @@ SimpleTimeZone::initTransitionRules(UErrorCode& status) { break; } // For now, use ID + "(STD)" as the name - stdRule = new AnnualTimeZoneRule(tzid+std, getRawOffset(), 0, + stdRule = new AnnualTimeZoneRule(tzid+STD_STR, getRawOffset(), 0, dtRule, startYear, AnnualTimeZoneRule::MAX_YEAR); // Calculate the first STD start time @@ -1077,10 +1079,10 @@ SimpleTimeZone::initTransitionRules(UErrorCode& status) { // Create a TimeZoneRule for initial time if (firstStdStart < firstDstStart) { - initialRule = new InitialTimeZoneRule(tzid+dst, getRawOffset(), dstRule->getDSTSavings()); + initialRule = new InitialTimeZoneRule(tzid+DST_STR, getRawOffset(), dstRule->getDSTSavings()); firstTransition = new TimeZoneTransition(firstStdStart, *initialRule, *stdRule); } else { - initialRule = new InitialTimeZoneRule(tzid+std, getRawOffset(), 0); + initialRule = new InitialTimeZoneRule(tzid+STD_STR, getRawOffset(), 0); firstTransition = new TimeZoneTransition(firstDstStart, *initialRule, *dstRule); }