diff options
author | Patrick Ohly <patrick.ohly@intel.com> | 2010-05-12 15:48:09 +0200 |
---|---|---|
committer | Patrick Ohly <patrick.ohly@intel.com> | 2010-05-12 15:52:19 +0200 |
commit | 58f19738bdde67f2a216f4a817deb6a35f731d52 (patch) | |
tree | d6b64a1086fb0d47fb74ffb4c64e367cf01c49e4 | |
parent | 7bbec4fd20cde059973d4d1c840fcee85d947e60 (diff) |
VTIMEZONEtoTZEntry(): flagged failure incorrectly for VTIMEZONE without summer saving
Parsing a VTIMEZONE with only a STANDARD entry returned a "false"
value for two reasons:
- no DAYLIGHT rules found
- no RRULE in STANDARD component
This patch detects these cases and treats them explicitly like the
code before did implicitly (clear change rules for the DAYLIGHT and
STANDARD parts) without returning an error.
-rw-r--r-- | src/sysync/vtimezone.cpp | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/src/sysync/vtimezone.cpp b/src/sysync/vtimezone.cpp index f737379..530b97e 100644 --- a/src/sysync/vtimezone.cpp +++ b/src/sysync/vtimezone.cpp @@ -272,7 +272,17 @@ static bool GetTZInfo( cAppCharP aText, i++; } // while } // if - a= VStr( aText, aIdent, aNth ); + + a= VStr( aText, aIdent, aNth ); + if ( a.empty() ) { + // Happens for VTIMEZONEs without summer saving time when this + // function is called to extract changes for DAYLIGHT. Don't + // treat this as failure and continue with clean change rules, as + // before. + c = tChange(); + return success; + } + string rr= VValue( a, VTZ_RR ); // sub items: - RRULE st= VValue( a, VTZ_START ); // - start time string of= VValue( a, VTZ_OFROM ); // - tz offset from @@ -282,8 +292,12 @@ static bool GetTZInfo( cAppCharP aText, if (ISO8601StrToTimestamp( st.c_str(), dtstart, tctx )==0) return false; if (!Get_Bias( of,ot, cBias )) return false; - // Note: dtstart might be adjusted by this call in case of DTSTART not meeting a occurrence for given RRULE - if (RRULE2toInternalR ( rr.c_str(), &dtstart, r, aLogP )) { + if ( rr.empty() ) { + // Happens when parsing STANDARD part of VTIMEZONE + // without DAYLIGHT saving. + c = tChange(); + } else if (RRULE2toInternalR ( rr.c_str(), &dtstart, r, aLogP )) { + // Note: dtstart might have been adjusted by this call in case of DTSTART not meeting a occurrence for given RRULE string vvv; internalRToRRULE2( vvv, r, false, aLogP ); Rtm_to_tChange ( r, dtstart, c ); |