X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/03647350fc7cd141953c72e0284e928847d30f44..40c4350f96527e54bd51e789ccbc79baf4eb9f26:/src/osx/core/strconv_cf.cpp diff --git a/src/osx/core/strconv_cf.cpp b/src/osx/core/strconv_cf.cpp index 4355ee032a..c77825c23a 100644 --- a/src/osx/core/strconv_cf.cpp +++ b/src/osx/core/strconv_cf.cpp @@ -33,6 +33,7 @@ * assume ABI compatibility even within a given wxWidgets release. */ +#if wxUSE_FONTMAP WXDLLIMPEXP_BASE wxMBConv* new_wxMBConv_cf( const char* name) { wxMBConv_cf *result = new wxMBConv_cf(name); @@ -44,6 +45,7 @@ WXDLLIMPEXP_BASE wxMBConv* new_wxMBConv_cf( const char* name) else return result; } +#endif // wxUSE_FONTMAP WXDLLIMPEXP_BASE wxMBConv* new_wxMBConv_cf(wxFontEncoding encoding) { @@ -210,13 +212,15 @@ WXDLLIMPEXP_BASE wxMBConv* new_wxMBConv_cf(wxFontEncoding encoding) m_encoding, 0, // FAIL on unconvertible characters false, // not an external representation - // if dstSize is 0 then pass NULL to get required length in usedBufLen - (dstSize != 0)?(UInt8*)dst:NULL, + (UInt8*)dst, dstSize, &usedBufLen ); - if(charsConverted < CFStringGetLength(theString) ) + // when dst is non-NULL, we check usedBufLen against dstSize as + // CFStringGetBytes sometimes treats dst as being NULL when dstSize==0 + if( (charsConverted < CFStringGetLength(theString)) || + (dst && (size_t) usedBufLen > dstSize) ) return wxCONV_FAILED; return usedBufLen;