Improve handling of wxUSE_FONTMAP==0 case with wxMSW

wxEncodingToCodepage() can be used when wxUSE_FONTMAP==0
Also avoid unreachable code warning with MSVC when using whole program optimization
This commit is contained in:
Paul Cornett
2016-12-22 22:09:41 -08:00
parent 2155eb2fde
commit 64f1d760c6
2 changed files with 10 additions and 8 deletions

View File

@@ -2536,8 +2536,8 @@ bool wxMBConv_iconv::IsUTF8() const
// from utils.cpp
#if wxUSE_FONTMAP
extern WXDLLIMPEXP_BASE long wxCharsetToCodepage(const char *charset);
extern WXDLLIMPEXP_BASE long wxEncodingToCodepage(wxFontEncoding encoding);
#endif
extern WXDLLIMPEXP_BASE long wxEncodingToCodepage(wxFontEncoding encoding);
class wxMBConv_win32 : public wxMBConv
{
@@ -2561,13 +2561,13 @@ public:
m_CodePage = wxCharsetToCodepage(name);
m_minMBCharWidth = 0;
}
#endif // wxUSE_FONTMAP
wxMBConv_win32(wxFontEncoding encoding)
{
m_CodePage = wxEncodingToCodepage(encoding);
m_minMBCharWidth = 0;
}
#endif // wxUSE_FONTMAP
virtual size_t MB2WC(wchar_t *buf, const char *psz, size_t n) const wxOVERRIDE
{
@@ -3084,13 +3084,13 @@ wxMBConv *wxCSConv::DoCreate() const
#if wxUSE_FONTMAP
wxMBConv_win32 *conv = m_name ? new wxMBConv_win32(m_name)
: new wxMBConv_win32(m_encoding);
#else
wxMBConv_win32* conv = new wxMBConv_win32(m_encoding);
#endif
if ( conv->IsOk() )
return conv;
delete conv;
#else
return NULL;
#endif
}
#endif // wxHAVE_WIN32_MB2WC