Return valid buffer from wxMBConv::c{MB,WC}2{WC,MB} for empty input.
Returning invalid buffer for empty input is unexpected and resulted in e.g. wxString::utf8_str() returning NULL and not "" in ANSI build for empty strings (which, in turn, resulted in crashes in the test suite and undoubtedly not only) as well as crashes when calling GTK+ functions (see #12432). Other uses of cMB2WC() also show that NULL return value from it is unexpected as it is often passed to CRT functions not accepting NULL. So return empty buffer instead for empty input to avoid all these problems. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@65836 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
24b4db9b0d
commit
cfcfada96e
@ -537,7 +537,7 @@ const wxWCharBuffer wxMBConv::cMB2WC(const wxScopedCharBuffer& buf) const
|
||||
}
|
||||
}
|
||||
|
||||
return wxWCharBuffer();
|
||||
return wxScopedWCharBuffer::CreateNonOwned(L"", 0);
|
||||
}
|
||||
|
||||
const wxCharBuffer wxMBConv::cWC2MB(const wxScopedWCharBuffer& wbuf) const
|
||||
@ -555,7 +555,7 @@ const wxCharBuffer wxMBConv::cWC2MB(const wxScopedWCharBuffer& wbuf) const
|
||||
}
|
||||
}
|
||||
|
||||
return wxCharBuffer();
|
||||
return wxScopedCharBuffer::CreateNonOwned("", 0);
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
Loading…
Reference in New Issue
Block a user