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:
@@ -2536,8 +2536,8 @@ bool wxMBConv_iconv::IsUTF8() const
|
|||||||
// from utils.cpp
|
// from utils.cpp
|
||||||
#if wxUSE_FONTMAP
|
#if wxUSE_FONTMAP
|
||||||
extern WXDLLIMPEXP_BASE long wxCharsetToCodepage(const char *charset);
|
extern WXDLLIMPEXP_BASE long wxCharsetToCodepage(const char *charset);
|
||||||
extern WXDLLIMPEXP_BASE long wxEncodingToCodepage(wxFontEncoding encoding);
|
|
||||||
#endif
|
#endif
|
||||||
|
extern WXDLLIMPEXP_BASE long wxEncodingToCodepage(wxFontEncoding encoding);
|
||||||
|
|
||||||
class wxMBConv_win32 : public wxMBConv
|
class wxMBConv_win32 : public wxMBConv
|
||||||
{
|
{
|
||||||
@@ -2561,13 +2561,13 @@ public:
|
|||||||
m_CodePage = wxCharsetToCodepage(name);
|
m_CodePage = wxCharsetToCodepage(name);
|
||||||
m_minMBCharWidth = 0;
|
m_minMBCharWidth = 0;
|
||||||
}
|
}
|
||||||
|
#endif // wxUSE_FONTMAP
|
||||||
|
|
||||||
wxMBConv_win32(wxFontEncoding encoding)
|
wxMBConv_win32(wxFontEncoding encoding)
|
||||||
{
|
{
|
||||||
m_CodePage = wxEncodingToCodepage(encoding);
|
m_CodePage = wxEncodingToCodepage(encoding);
|
||||||
m_minMBCharWidth = 0;
|
m_minMBCharWidth = 0;
|
||||||
}
|
}
|
||||||
#endif // wxUSE_FONTMAP
|
|
||||||
|
|
||||||
virtual size_t MB2WC(wchar_t *buf, const char *psz, size_t n) const wxOVERRIDE
|
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
|
#if wxUSE_FONTMAP
|
||||||
wxMBConv_win32 *conv = m_name ? new wxMBConv_win32(m_name)
|
wxMBConv_win32 *conv = m_name ? new wxMBConv_win32(m_name)
|
||||||
: new wxMBConv_win32(m_encoding);
|
: new wxMBConv_win32(m_encoding);
|
||||||
|
#else
|
||||||
|
wxMBConv_win32* conv = new wxMBConv_win32(m_encoding);
|
||||||
|
#endif
|
||||||
if ( conv->IsOk() )
|
if ( conv->IsOk() )
|
||||||
return conv;
|
return conv;
|
||||||
|
|
||||||
delete conv;
|
delete conv;
|
||||||
#else
|
|
||||||
return NULL;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
#endif // wxHAVE_WIN32_MB2WC
|
#endif // wxHAVE_WIN32_MB2WC
|
||||||
|
|
||||||
|
@@ -36,6 +36,7 @@
|
|||||||
#include "wx/dynload.h"
|
#include "wx/dynload.h"
|
||||||
#include "wx/scopeguard.h"
|
#include "wx/scopeguard.h"
|
||||||
#include "wx/filename.h"
|
#include "wx/filename.h"
|
||||||
|
#include "wx/fontenc.h"
|
||||||
|
|
||||||
#include "wx/confbase.h" // for wxExpandEnvVars()
|
#include "wx/confbase.h" // for wxExpandEnvVars()
|
||||||
|
|
||||||
@@ -1466,9 +1467,6 @@ extern WXDLLIMPEXP_BASE long wxEncodingToCharset(wxFontEncoding encoding)
|
|||||||
// looks up the vlaues in the registry and the new one which is more
|
// looks up the vlaues in the registry and the new one which is more
|
||||||
// politically correct and has more chances to work on other Windows versions
|
// politically correct and has more chances to work on other Windows versions
|
||||||
// as well but the old version is still needed for !wxUSE_FONTMAP case
|
// as well but the old version is still needed for !wxUSE_FONTMAP case
|
||||||
#if wxUSE_FONTMAP
|
|
||||||
|
|
||||||
#include "wx/fontmap.h"
|
|
||||||
|
|
||||||
extern WXDLLIMPEXP_BASE long wxEncodingToCodepage(wxFontEncoding encoding)
|
extern WXDLLIMPEXP_BASE long wxEncodingToCodepage(wxFontEncoding encoding)
|
||||||
{
|
{
|
||||||
@@ -1554,6 +1552,10 @@ extern WXDLLIMPEXP_BASE long wxEncodingToCodepage(wxFontEncoding encoding)
|
|||||||
return (long) ret;
|
return (long) ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if wxUSE_FONTMAP
|
||||||
|
|
||||||
|
#include "wx/fontmap.h"
|
||||||
|
|
||||||
extern long wxCharsetToCodepage(const char *name)
|
extern long wxCharsetToCodepage(const char *name)
|
||||||
{
|
{
|
||||||
// first get the font encoding for this charset
|
// first get the font encoding for this charset
|
||||||
|
Reference in New Issue
Block a user