properly protect usage of iconv_t by HAVE_ICONV
This commit is contained in:
parent
b699ed4d9e
commit
aedcaea054
2 changed files with 15 additions and 3 deletions
|
@ -231,14 +231,18 @@ bool haveUTF8() {
|
|||
|
||||
}; // 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
|
||||
|
|
|
@ -67,12 +67,20 @@ public:
|
|||
~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;
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue