write the entire file at once in Flush() instead of doing it line by line (patch 1656509)

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@44448 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2007-02-11 02:09:39 +00:00
parent e74d43ab63
commit 20160a32ea

View File

@@ -1047,15 +1047,17 @@ bool wxFileConfig::Flush(bool /* bCurrentOnly */)
} }
// write all strings to file // write all strings to file
wxString filetext;
filetext.reserve(4096);
for ( wxFileConfigLineList *p = m_linesHead; p != NULL; p = p->Next() ) for ( wxFileConfigLineList *p = m_linesHead; p != NULL; p = p->Next() )
{ {
wxString line = p->Text(); filetext << p->Text() << wxTextFile::GetEOL();
line += wxTextFile::GetEOL(); }
if ( !file.Write(line, *m_conv) )
{ if ( !file.Write(filetext, *m_conv) )
wxLogError(_("can't write user configuration file.")); {
return false; wxLogError(_("can't write user configuration file."));
} return false;
} }
if ( !file.Commit() ) if ( !file.Commit() )