ICU-5808 Declare a UTF-16 string when available instead of converting a string.

X-SVN-Rev: 22564
This commit is contained in:
George Rhoten 2007-08-29 08:09:55 +00:00
parent a904086007
commit bee56b37b7
2 changed files with 10 additions and 10 deletions

View File

@ -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) {

View File

@ -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);
}