http://bugs.meego.com/show_bug.cgi?id=1007
--- Comment #17 from pohly <patrick.ohly(a)intel.com> 2010-05-27 02:53:47 PDT ---
(In reply to comment #16)
(In reply to comment #15)
> (In reply to comment #13)
> > > No, GetTZInfo() gets dBias as reference and initializes it. It seems that
you
> > > have found a case where it returns "true" without initializing
dBias. That case
> > > needs to be fixed inside GetTZInfo(), it should return false if it cannot
find
> > > dBias.
> > correct, you're right. Is it possible to assign 'dBias' as a
default value
> > (such as '0') in the beginning of 'GetTZInfo'?
>
> That depends - is 0 the right answer for the case where GetTZInfo() currently
> returns true without setting dBias? It might be that returning false is the
> better solution.
Patrick, it's because your newly committed code causes this problem, so I think
you could help identify my change:
In synthesis code commit 58f19738bdde67f2a216f4a817deb6a35f731d52,
249 static bool GetTZInfo( cAppCharP aText,
250 cAppCharP aIdent,
251 tChange &c,
252 short &cBias,
253 string &cName,
254 sInt32 aNth, // take nth occurance, -1: take
last
255 TDebugLogger* aLogP )
256 {
+
+ 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;
+ }
+
when returning 'success' here, cBias isn't set. So my patch is to set
'cBias'
as 0 here. Is it correct?
I think that would fail the t.bias == dBias check in VTIMEZONEtoTZEntry().
How about this patch here:
diff --git a/src/sysync/vtimezone.cpp b/src/sysync/vtimezone.cpp
index 530b97e..60a9232 100644
--- a/src/sysync/vtimezone.cpp
+++ b/src/sysync/vtimezone.cpp
@@ -245,7 +245,11 @@ static bool Get_Bias( string of, string ot, short &bias )
} // Get_Bias
-/*! Fill in the TZ info */
+/*! Fill in the TZ info.
+ * @return false if some information was found, but couldn't be extracted;
+ * true if not found (in which case c, cBias, cName are unchanged)
+ * or found and extracted
+ */
static bool GetTZInfo( cAppCharP aText,
cAppCharP aIdent,
tChange &c,
@@ -279,7 +283,6 @@ static bool GetTZInfo( cAppCharP aText,
// 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;
}
@@ -295,7 +298,6 @@ static bool GetTZInfo( cAppCharP aText,
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;
@@ -420,10 +422,14 @@ bool VTIMEZONEtoTZEntry( const char* aText, //
VTIMEZONE string to be parsed
t.ident = "";
t.dynYear= "CUR";
t.biasDST= 0;
+ t.bias = 0;
if (!GetTZInfo( aText,VTZ_STD, t.std, t.bias, aStdName, -1, aLogP )) {
success = false;
}
+ // default value if not found (which is treated as success by GetTZInfo)
+ dBias= t.bias;
if (!GetTZInfo( aText,VTZ_DST, t.dst, dBias, aDstName, -1, aLogP )) {
+ // unknown failure, better restore default
dBias= t.bias;
success = false;
}
--
Configure bugmail:
http://bugs.meego.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are watching someone on the CC list of the bug.