projects
/
wxWidgets.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
13d92ad
)
corrected last change to cWC2MB() to also work for encoding with NUL length > 1
author
Vadim Zeitlin
<vadim@wxwidgets.org>
Sat, 6 May 2006 18:53:43 +0000
(18:53 +0000)
committer
Vadim Zeitlin
<vadim@wxwidgets.org>
Sat, 6 May 2006 18:53:43 +0000
(18:53 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@39076
c3d73ce0
-8a6f-49c7-b76d-
6d57e0e08775
src/common/strconv.cpp
patch
|
blob
|
blame
|
history
diff --git
a/src/common/strconv.cpp
b/src/common/strconv.cpp
index 4e62a144b1f028891048d082b4fc123ab8369176..f4a58755c3cb3f2a983cb4c2bb6fa1a31614a718 100644
(file)
--- a/
src/common/strconv.cpp
+++ b/
src/common/strconv.cpp
@@
-425,13
+425,9
@@
wxMBConv::cWC2MB(const wchar_t *inBuff, size_t inLen, size_t *outLen) const
size_t dstLen = FromWChar(NULL, 0, inBuff, inLen);
if ( dstLen != wxCONV_FAILED )
{
- if ( !dstLen )
- {
- // special case: can't allocate 0 size buffer below
- dstLen++;
- }
-
- wxCharBuffer buf(dstLen - 1);
+ // special case of empty input: can't allocate 0 size buffer below as
+ // wxCharBuffer insists on NUL-terminating it
+ wxCharBuffer buf(dstLen ? dstLen - 1 : 1);
if ( FromWChar(buf.data(), dstLen, inBuff, inLen) != wxCONV_FAILED )
{
if ( outLen )