X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/56d0c5a6a73180f263ff39307a0718ebd6e235da..564225a113e7bd03aad21c7cdf168da6ee02ba01:/src/common/datetime.cpp diff --git a/src/common/datetime.cpp b/src/common/datetime.cpp index 418a72f51c..73973840e1 100644 --- a/src/common/datetime.cpp +++ b/src/common/datetime.cpp @@ -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