From 3c67ec06a78866b68c288f48af5e053a05beda8c Mon Sep 17 00:00:00 2001 From: Stefan Csomor Date: Tue, 1 Aug 2006 09:37:42 +0000 Subject: [PATCH] on mac using macroman only created once a successful wxCSConv, because the iconv' miss was entered as a failure into the cache, which then killed any subsequent attempt .. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@40411 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/common/strconv.cpp | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/src/common/strconv.cpp b/src/common/strconv.cpp index 8936454dfe..742feb387f 100644 --- a/src/common/strconv.cpp +++ b/src/common/strconv.cpp @@ -3339,20 +3339,26 @@ wxMBConv *wxCSConv::DoCreate() const } const wxChar** names = wxFontMapperBase::GetAllEncodingNames(encoding); - - for ( ; *names; ++names ) + // CS : in case this does not return valid names (eg for MacRoman) encoding + // got a 'failure' entry in the cache all the same, although it just has to + // be created using a different method, so only store failed iconv creation + // attempts (or perhaps we shoulnd't do this at all ?) + if ( names[0] != NULL ) { - wxMBConv_iconv *conv = new wxMBConv_iconv(*names); - if ( conv->IsOk() ) + for ( ; *names; ++names ) { - gs_nameCache[encoding] = *names; - return conv; + wxMBConv_iconv *conv = new wxMBConv_iconv(*names); + if ( conv->IsOk() ) + { + gs_nameCache[encoding] = *names; + return conv; + } + + delete conv; } - delete conv; + gs_nameCache[encoding] = _T(""); // cache the failure } - - gs_nameCache[encoding] = _T(""); // cache the failure } #endif // wxUSE_FONTMAP } -- 2.45.2