X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/39b307b82fd873bfcf553e98d93de0876fea0476..f5ba273ecd799f652736ce2bc830283787302a56:/src/common/fileconf.cpp diff --git a/src/common/fileconf.cpp b/src/common/fileconf.cpp index 54bc21641a..d9ab373bdb 100644 --- a/src/common/fileconf.cpp +++ b/src/common/fileconf.cpp @@ -49,9 +49,6 @@ #if defined(__WXPM__) #define INCL_DOS #include - #define LINKAGEMODE _Optlink -#else - #define LINKAGEMODE #endif #include @@ -472,11 +469,15 @@ void wxFileConfig::Parse(wxTextFile& file, bool bLocal) } else { // a key const wxChar *pEnd = pStart; - while ( *pEnd != wxT('=') && !wxIsspace(*pEnd) ) { + while ( *pEnd && *pEnd != wxT('=') && !wxIsspace(*pEnd) ) { if ( *pEnd == wxT('\\') ) { // next character may be space or not - still take it because it's - // quoted + // quoted (unless there is nothing) pEnd++; + if ( !*pEnd ) { + // the error message will be given below anyhow + break; + } } pEnd++; @@ -595,7 +596,7 @@ bool wxFileConfig::GetFirstGroup(wxString& str, long& lIndex) const bool wxFileConfig::GetNextGroup (wxString& str, long& lIndex) const { if ( size_t(lIndex) < m_pCurrentGroup->Groups().Count() ) { - str = m_pCurrentGroup->Groups()[lIndex++]->Name(); + str = m_pCurrentGroup->Groups()[(size_t)lIndex++]->Name(); return TRUE; } else @@ -611,7 +612,7 @@ bool wxFileConfig::GetFirstEntry(wxString& str, long& lIndex) const bool wxFileConfig::GetNextEntry (wxString& str, long& lIndex) const { if ( size_t(lIndex) < m_pCurrentGroup->Entries().Count() ) { - str = m_pCurrentGroup->Entries()[lIndex++]->Name(); + str = m_pCurrentGroup->Entries()[(size_t)lIndex++]->Name(); return TRUE; } else @@ -764,7 +765,7 @@ bool wxFileConfig::Write(const wxString& key, long lValue) bool wxFileConfig::Flush(bool /* bCurrentOnly */) { - if ( LineListIsEmpty() || !m_pRootGroup->IsDirty() ) + if ( LineListIsEmpty() || !m_pRootGroup->IsDirty() || !m_strLocalFile ) return TRUE; wxTempFile file(m_strLocalFile);