fixed bug in ParseDateFormat() with numbers with leading zeroes

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@14305 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2002-02-19 15:03:00 +00:00
parent 072da98f10
commit 79067a961d

View File

@@ -440,7 +440,11 @@ static bool GetNumericToken(size_t len, const wxChar*& p, unsigned long *number)
break;
}
return !!s && s.ToULong(number);
// use the base 10 explicitly because otherwise the string "09" (the
// leading zeroes are common in the date specifications) is not parsed
// correctly as, according to the standard C rules, it is understood as an
// octal number and '9' is not a valid octal digit!
return !s.empty() && s.ToULong(number, 10);
}
// scans all alphabetic characters and returns the resulting string
@@ -3102,7 +3106,7 @@ const wxChar *wxDateTime::ParseDate(const wxChar *date)
// is it a number?
unsigned long val;
if ( token.ToULong(&val) )
if ( token.ToULong(&val, 10) ) // 10: see comment in GetNumericToken()
{
// guess what this number is