properly protect usage of iconv_t by HAVE_ICONV
simonb simonb
2 files changed,
15 insertions(+),
3 deletions(-)
M
src/FbTk/FbString.cc
→
src/FbTk/FbString.cc
@@ -231,14 +231,18 @@
}; // end namespace StringUtil -StringConvertor::StringConvertor(EncodingTarget target): m_iconv((iconv_t)(-1)) { +StringConvertor::StringConvertor(EncodingTarget target): #ifdef HAVE_ICONV + m_iconv((iconv_t)(-1)) { if (target == ToLocaleStr) m_destencoding = FbStringUtil::locale_codeset; else m_destencoding = "UTF-8"; -#endif } +#else + m_iconv(-1) {} +#endif + StringConvertor::~StringConvertor() { #ifdef HAVE_ICONV
M
src/FbTk/FbString.hh
→
src/FbTk/FbString.hh
@@ -67,12 +67,20 @@ StringConvertor(EncodingTarget target);
~StringConvertor(); bool setSource(const std::string &encoding); - void reset() { m_iconv = ((iconv_t)(-1)); } + void reset() { +#ifdef HAVE_ICONV + m_iconv = ((iconv_t)(-1)); +#endif + } std::string recode(const std::string &src); private: +#ifdef HAVE_ICONV iconv_t m_iconv; +#else + int m_iconv; +#endif std::string m_destencoding; };