X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/d9d488cf1b5bd28722ae3020606e9674108dd417..18c9aebecad12ff04a971d803acbeb291fbc4ea6:/src/common/strconv.cpp diff --git a/src/common/strconv.cpp b/src/common/strconv.cpp index aea1e1a18a..dd60679952 100644 --- a/src/common/strconv.cpp +++ b/src/common/strconv.cpp @@ -40,11 +40,8 @@ #if wxUSE_WCHAR_T -#ifdef __WXMSW__ - #include "wx/msw/private.h" -#endif - #ifdef __WINDOWS__ + #include "wx/msw/private.h" #include "wx/msw/missing.h" #endif @@ -78,9 +75,11 @@ #include "wx/utils.h" #ifdef __WXMAC__ +#ifndef __DARWIN__ #include #include #include +#endif #include "wx/mac/private.h" // includes mac headers #endif @@ -360,7 +359,7 @@ size_t wxMBConvLibc::WC2MB(char *buf, const wchar_t *psz, size_t n) const #ifdef __UNIX__ // ---------------------------------------------------------------------------- -// wxConvBrokenFileNames +// wxConvBrokenFileNames // ---------------------------------------------------------------------------- wxConvBrokenFileNames::wxConvBrokenFileNames(const wxChar *charset) @@ -1347,6 +1346,18 @@ private: static bool ms_wcNeedsSwap; }; +// make the constructor available for unit testing +WXDLLIMPEXP_BASE wxMBConv* new_wxMBConv_iconv( const wxChar* name ) +{ + wxMBConv_iconv* result = new wxMBConv_iconv( name ); + if ( !result->IsOk() ) + { + delete result; + return 0; + } + return result; +} + const char *wxMBConv_iconv::ms_wcCharsetName = NULL; bool wxMBConv_iconv::ms_wcNeedsSwap = false; @@ -2406,6 +2417,18 @@ public: DECLARE_NO_COPY_CLASS(wxMBConv_wxwin) }; +// make the constructors available for unit testing +WXDLLIMPEXP_BASE wxMBConv* new_wxMBConv_wxwin( const wxChar* name ) +{ + wxMBConv_wxwin* result = new wxMBConv_wxwin( name ); + if ( !result->IsOk() ) + { + delete result; + return 0; + } + return result; +} + #endif // wxUSE_FONTMAP // ============================================================================ @@ -2516,7 +2539,7 @@ wxMBConv *wxCSConv::DoCreate() const #if wxUSE_FONTMAP if ( name.empty() ) - name = wxFontMapperBase::Get()->GetEncodingName(m_encoding); + name = wxFontMapperBase::GetEncodingName(m_encoding); #endif // wxUSE_FONTMAP wxMBConv_iconv *conv = new wxMBConv_iconv(name);