Return valid buffer from wxMBConv::c{MB,WC}2{WC,MB} for empty input.
authorVadim Zeitlin <vadim@wxwidgets.org>
Sun, 17 Oct 2010 13:59:42 +0000 (13:59 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Sun, 17 Oct 2010 13:59:42 +0000 (13:59 +0000)
commitcfcfada96e76129a630ab9c47f346fbfc5e9de8d
tree56e9be37d973a4823d38ac5b04a32e02f788b3ac
parent24b4db9b0de92ef5c899b98a556f8cd09ad1fc54
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
src/common/strconv.cpp