From c45fad9aa95f320213baa7bf2be29b606e0eb111 Mon Sep 17 00:00:00 2001 From: Stefan Csomor Date: Wed, 25 Mar 2009 21:24:02 +0000 Subject: [PATCH] making sure NULs stay in the result, even if the string is not nul terminated git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@59858 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/common/strconv.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/common/strconv.cpp b/src/common/strconv.cpp index c56719561e..dd1844c5b2 100644 --- a/src/common/strconv.cpp +++ b/src/common/strconv.cpp @@ -333,7 +333,7 @@ wxMBConv::FromWChar(char *dst, size_t dstLen, return wxCONV_FAILED; dstWritten += lenChunk; - if ( isNulTerminated ) + if ( src+lenChunk < srcEnd || isNulTerminated ) dstWritten += lenNul; if ( dst ) @@ -345,7 +345,7 @@ wxMBConv::FromWChar(char *dst, size_t dstLen, return wxCONV_FAILED; dst += lenChunk; - if ( isNulTerminated ) + if ( src+lenChunk < srcEnd || isNulTerminated ) dst += lenNul; } } @@ -3371,6 +3371,8 @@ wxCharBuffer wxSafeConvertWX2MB(const wchar_t *ws) #ifdef __WINDOWS__ WX_DEFINE_GLOBAL_CONV2(wxMBConv, wxMBConv_win32, wxConvLibc, wxEMPTY_PARAMETER_VALUE); +#elif 0 // defined(__WXOSX__) + WX_DEFINE_GLOBAL_CONV2(wxMBConv, wxMBConv_cf, wxConvLibc, (wxFONTENCODING_UTF8)); #else WX_DEFINE_GLOBAL_CONV2(wxMBConv, wxMBConvLibc, wxConvLibc, wxEMPTY_PARAMETER_VALUE); #endif