better check for conversion failure in OutputString(); use wxScopedCharBuffer::length() instead of strlen()
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@60126 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
582886dde5
commit
a6ed278608
@ -783,12 +783,18 @@ bool OutputString(wxOutputStream& stream,
|
|||||||
|
|
||||||
#if wxUSE_UNICODE
|
#if wxUSE_UNICODE
|
||||||
wxUnusedVar(convMem);
|
wxUnusedVar(convMem);
|
||||||
|
if ( !convFile )
|
||||||
|
convFile = &wxConvUTF8;
|
||||||
|
|
||||||
const wxWX2MBbuf buf(str.mb_str(*(convFile ? convFile : &wxConvUTF8)));
|
const wxScopedCharBuffer buf(str.mb_str(*convFile));
|
||||||
if ( !buf )
|
if ( !buf.length() )
|
||||||
|
{
|
||||||
|
// conversion failed, can't write this string in an XML file in this
|
||||||
|
// (presumably non-UTF-8) encoding
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
stream.Write(buf, strlen(buf));
|
stream.Write(buf, buf.length());
|
||||||
#else // !wxUSE_UNICODE
|
#else // !wxUSE_UNICODE
|
||||||
if ( convFile && convMem )
|
if ( convFile && convMem )
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user