X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/128e0251fedc47a93c8de5fcd194ea826159b7d4..d546eba94e77831c41e3370484a41181517bd611:/src/common/fileconf.cpp diff --git a/src/common/fileconf.cpp b/src/common/fileconf.cpp index fb05de0a4c..3e39151ade 100644 --- a/src/common/fileconf.cpp +++ b/src/common/fileconf.cpp @@ -672,6 +672,16 @@ void wxFileConfig::Parse(wxTextBuffer& buffer, bool bLocal) // new entry pEntry = m_pCurrentGroup->AddEntry(strKey, n); + // + // Take the opportunity to set some pointers now + // that we know there are items in this group. + // Otherwise, items added to a newly read file + // can be put in the wrong place. + m_pCurrentGroup->SetLastEntry(pEntry); + if (m_pCurrentGroup->Parent()) + m_pCurrentGroup->Parent()->SetLastGroup(m_pCurrentGroup); + // + if ( bLocal ) pEntry->SetLine(m_linesTail); } @@ -865,12 +875,14 @@ bool wxFileConfig::DoReadString(const wxString& key, wxString* pStr) const bool wxFileConfig::DoReadLong(const wxString& key, long *pl) const { - wxString str; - if ( !Read(key, & str) ) - { - return FALSE; - } - return str.ToLong(pl) ; + wxString str; + if ( !Read(key, &str) ) + return FALSE; + + // extra spaces shouldn't prevent us from reading numeric values + str.Trim(); + + return str.ToLong(pl); } bool wxFileConfig::DoWriteString(const wxString& key, const wxString& szValue)