From 0acd3d9a0813ecf1c448ff9403c9fe560a5d75ec Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Mon, 22 May 2000 13:10:15 +0000 Subject: [PATCH] another buglet in ParseDate() fixed git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_2_BRANCH@7457 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/common/datetime.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/common/datetime.cpp b/src/common/datetime.cpp index 8d719e9605..fe9d36485e 100644 --- a/src/common/datetime.cpp +++ b/src/common/datetime.cpp @@ -3021,7 +3021,6 @@ const wxChar *wxDateTime::ParseDate(const wxChar *date) wxStringTokenizer tok(p, dateDelimiters); while ( tok.HasMoreTokens() ) { - nPosCur = tok.GetPosition(); wxString token = tok.GetNextToken(); // is it a number? @@ -3140,8 +3139,9 @@ const wxChar *wxDateTime::ParseDate(const wxChar *date) } else // not a number { - mon = GetMonthFromName(token, Name_Full | Name_Abbr); - if ( mon != Inv_Month ) + // be careful not to overwrite the current mon value + Month mon2 = GetMonthFromName(token, Name_Full | Name_Abbr); + if ( mon2 != Inv_Month ) { // it's a month if ( haveMon ) @@ -3149,6 +3149,8 @@ const wxChar *wxDateTime::ParseDate(const wxChar *date) break; } + mon = mon2; + haveMon = TRUE; } else @@ -3223,6 +3225,8 @@ const wxChar *wxDateTime::ParseDate(const wxChar *date) } } } + + nPosCur = tok.GetPosition(); } // either no more tokens or the scan was stopped by something we couldn't