X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/33ac7e6f01acbac1cff0ad400d8ea7f0bfd0a62f..0ba344c712c77e4a6c7b94263b6f39ab22069039:/src/common/encconv.cpp diff --git a/src/common/encconv.cpp b/src/common/encconv.cpp index 7a288485d4..e4763473e5 100644 --- a/src/common/encconv.cpp +++ b/src/common/encconv.cpp @@ -18,6 +18,8 @@ #pragma hdrstop #endif +#if wxUSE_FONTMAP + #include "wx/encconv.h" #include @@ -52,7 +54,7 @@ typedef struct { -static int LINKAGEMODE CompareCharsetItems(const void *i1, const void *i2) +extern "C" int LINKAGEMODE CompareCharsetItems(const void *i1, const void *i2) { return ( ((CharsetItem*)i1) -> u - ((CharsetItem*)i2) -> u ); } @@ -155,7 +157,7 @@ bool wxEncodingConverter::Init(wxFontEncoding input_enc, wxFontEncoding output_e m_Table[128 + i] = (wchar_t)(128 + i); #else m_Table[128 + i] = (char)(128 + i); -#endif +#endif } delete[] rev; @@ -180,7 +182,7 @@ void wxEncodingConverter::Convert(const char* input, char* output) return; } - wxASSERT_MSG(m_Table != NULL, wxT("You must call wxEncodingConverter::Init() before actually converting!")); + wxCHECK_RET(m_Table != NULL, wxT("You must call wxEncodingConverter::Init() before actually converting!")); for (i = input, o = output; *i != 0;) *(o++) = (char)(m_Table[(wxUint8)*(i++)]); @@ -206,7 +208,7 @@ void wxEncodingConverter::Convert(const char* input, wchar_t* output) return; } - wxASSERT_MSG(m_Table != NULL, wxT("You must call wxEncodingConverter::Init() before actually converting!")); + wxCHECK_RET(m_Table != NULL, wxT("You must call wxEncodingConverter::Init() before actually converting!")); for (i = input, o = output; *i != 0;) *(o++) = (wchar_t)(m_Table[(wxUint8)*(i++)]); @@ -231,7 +233,7 @@ void wxEncodingConverter::Convert(const wchar_t* input, char* output) return; } - wxASSERT_MSG(m_Table != NULL, wxT("You must call wxEncodingConverter::Init() before actually converting!")); + wxCHECK_RET(m_Table != NULL, wxT("You must call wxEncodingConverter::Init() before actually converting!")); for (i = input, o = output; *i != 0;) *(o++) = (char)(m_Table[(wxUint16)*(i++)]); @@ -257,7 +259,7 @@ void wxEncodingConverter::Convert(const wchar_t* input, wchar_t* output) return; } - wxASSERT_MSG(m_Table != NULL, wxT("You must call wxEncodingConverter::Init() before actually converting!")); + wxCHECK_RET(m_Table != NULL, wxT("You must call wxEncodingConverter::Init() before actually converting!")); for (i = input, o = output; *i != 0;) *(o++) = (wchar_t)(m_Table[(wxUint8)*(i++)]); @@ -274,14 +276,20 @@ wxString wxEncodingConverter::Convert(const wxString& input) wxString s; const wxChar *i; - wxASSERT_MSG(m_Table != NULL, wxT("You must call wxEncodingConverter::Init() before actually converting!")); + wxCHECK_MSG(m_Table != NULL, s, + wxT("You must call wxEncodingConverter::Init() before actually converting!")); if (m_UnicodeInput) + { for (i = input.c_str(); *i != 0; i++) s << (wxChar)(m_Table[(wxUint16)*i]); + } else + { for (i = input.c_str(); *i != 0; i++) s << (wxChar)(m_Table[(wxUint8)*i]); + } + return s; } @@ -442,3 +450,5 @@ wxFontEncodingArray wxEncodingConverter::GetAllEquivalents(wxFontEncoding enc) return arr; } + +#endif // wxUSE_FONTMAP