X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/80fdb8d64f1ddecdef2d987d79871b5b508930c0..3af5821cf964398265547e23341e50cb6f55c081:/src/common/fileconf.cpp diff --git a/src/common/fileconf.cpp b/src/common/fileconf.cpp index 9899d67a9d..071b90f243 100644 --- a/src/common/fileconf.cpp +++ b/src/common/fileconf.cpp @@ -494,10 +494,21 @@ wxFileConfig::wxFileConfig(wxInputStream &inStream, wxMBConv& conv) wxString strTmp; char buf[1024]; - while ( !inStream.Read(buf, WXSIZEOF(buf)).Eof() ) - strTmp.append(wxConvertMB2WX(buf), inStream.LastRead()); + do + { + inStream.Read(buf, WXSIZEOF(buf)); + + const wxStreamError err = inStream.GetLastError(); - strTmp.append(wxConvertMB2WX(buf), inStream.LastRead()); + if ( err != wxSTREAM_NO_ERROR && err != wxSTREAM_EOF ) + { + wxLogError(_("Error reading config options.")); + break; + } + + strTmp.append(wxConvertMB2WX(buf), inStream.LastRead()); + } + while ( !inStream.Eof() ); strTrans = wxTextBuffer::Translate(strTmp); } @@ -1090,8 +1101,11 @@ bool wxFileConfig::DeleteAll() { CleanUp(); - if ( wxRemove(m_strLocalFile) == -1 ) - wxLogSysError(_("can't delete user configuration file '%s'"), m_strLocalFile.c_str()); + if ( wxFile::Exists(m_strLocalFile) && wxRemove(m_strLocalFile) == -1 ) + { + wxLogSysError(_("can't delete user configuration file '%s'"), m_strLocalFile.c_str()); + return FALSE; + } m_strLocalFile = m_strGlobalFile = wxT(""); Init();