applied part of patch 1169925: fix errors with multibyte <-> wx conversions
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@33098 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -505,7 +505,12 @@ wxFileConfig::wxFileConfig(wxInputStream &inStream, wxMBConv& conv)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
strTmp.append(wxConvertMB2WX(buf), inStream.LastRead());
|
// FIXME: this is broken because if we have part of multibyte
|
||||||
|
// character in the buffer (and another part hasn't been
|
||||||
|
// read yet) we're going to lose data because of conversion
|
||||||
|
// errors
|
||||||
|
buf[inStream.LastRead()] = '\0';
|
||||||
|
strTmp += conv.cMB2WX(buf);
|
||||||
}
|
}
|
||||||
while ( !inStream.Eof() );
|
while ( !inStream.Eof() );
|
||||||
|
|
||||||
@@ -1014,7 +1019,9 @@ bool wxFileConfig::Save(wxOutputStream& os, wxMBConv& conv)
|
|||||||
{
|
{
|
||||||
wxString line = p->Text();
|
wxString line = p->Text();
|
||||||
line += wxTextFile::GetEOL();
|
line += wxTextFile::GetEOL();
|
||||||
if ( !os.Write(line.mb_str(conv), line.length()) )
|
|
||||||
|
wxCharBuffer buf(line.mb_str(conv));
|
||||||
|
if ( !os.Write(buf, strlen(buf)) )
|
||||||
{
|
{
|
||||||
wxLogError(_("Error saving user configuration data."));
|
wxLogError(_("Error saving user configuration data."));
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user