ICU-10281 Fixed a VTIMEZONE writer problem that may produce overlapping rules.

X-SVN-Rev: 34026
This commit is contained in:
Yoshito Umaoka 2013-08-09 16:32:44 +00:00
parent 78a74d6171
commit bea4641b0d

View File

@ -18,6 +18,7 @@
#include "cmemory.h"
#include "uvector.h"
#include "gregoimp.h"
#include "uassert.h"
U_NAMESPACE_BEGIN
@ -2109,8 +2110,13 @@ VTimeZone::writeZone(VTZWriter& w, BasicTimeZone& basictz,
if (U_FAILURE(status)) {
goto cleanupWriteZone;
}
writeFinalRule(w, TRUE, finalDstRule,
dstFromOffset - dstFromDSTSavings, dstFromDSTSavings, dstStartTime, status);
UDate nextStart;
UBool nextStartAvail = finalDstRule->getNextStart(dstUntilTime, dstFromOffset - dstFromDSTSavings, dstFromDSTSavings, false, nextStart);
U_ASSERT(nextStartAvail);
if (nextStartAvail) {
writeFinalRule(w, TRUE, finalDstRule,
dstFromOffset - dstFromDSTSavings, dstFromDSTSavings, nextStart, status);
}
}
}
if (U_FAILURE(status)) {
@ -2138,7 +2144,7 @@ VTimeZone::writeZone(VTZWriter& w, BasicTimeZone& basictz,
// Use a single rule if possible
if (isEquivalentDateRule(stdMonth, stdWeekInMonth, stdDayOfWeek, finalStdRule->getRule())) {
writeZonePropsByDOW(w, FALSE, stdName, stdFromOffset, stdToOffset,
stdMonth, stdWeekInMonth, stdDayOfWeek, stdStartTime, MAX_MILLIS, status);
stdMonth, stdWeekInMonth, stdDayOfWeek, stdStartTime, MAX_MILLIS, status);
} else {
// Not equivalent rule - write out two different rules
writeZonePropsByDOW(w, FALSE, stdName, stdFromOffset, stdToOffset,
@ -2146,8 +2152,13 @@ VTimeZone::writeZone(VTZWriter& w, BasicTimeZone& basictz,
if (U_FAILURE(status)) {
goto cleanupWriteZone;
}
writeFinalRule(w, FALSE, finalStdRule,
stdFromOffset - stdFromDSTSavings, stdFromDSTSavings, stdStartTime, status);
UDate nextStart;
UBool nextStartAvail = finalStdRule->getNextStart(stdUntilTime, stdFromOffset - stdFromDSTSavings, stdFromDSTSavings, false, nextStart);
U_ASSERT(nextStartAvail);
if (nextStartAvail) {
writeFinalRule(w, FALSE, finalStdRule,
stdFromOffset - stdFromDSTSavings, stdFromDSTSavings, nextStart, status);
}
}
}
if (U_FAILURE(status)) {