aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorsimonb <simonb>2006-06-26 01:36:27 (GMT)
committersimonb <simonb>2006-06-26 01:36:27 (GMT)
commitaedcaea054a91f10329377ca776396326d0078fa (patch)
treeb506c987f26bb8720784a678b6026034f9b17532 /src
parentb699ed4d9e4fd99fd894b5d3d2e3767c41ebf80c (diff)
downloadfluxbox_paul-aedcaea054a91f10329377ca776396326d0078fa.zip
fluxbox_paul-aedcaea054a91f10329377ca776396326d0078fa.tar.bz2
properly protect usage of iconv_t by HAVE_ICONV
Diffstat (limited to 'src')
-rw-r--r--src/FbTk/FbString.cc8
-rw-r--r--src/FbTk/FbString.hh10
2 files changed, 15 insertions, 3 deletions
diff --git a/src/FbTk/FbString.cc b/src/FbTk/FbString.cc
index 3ed1c70..d3f6b81 100644
--- a/src/FbTk/FbString.cc
+++ b/src/FbTk/FbString.cc
@@ -231,14 +231,18 @@ bool haveUTF8() {
231 231
232}; // end namespace StringUtil 232}; // end namespace StringUtil
233 233
234StringConvertor::StringConvertor(EncodingTarget target): m_iconv((iconv_t)(-1)) { 234StringConvertor::StringConvertor(EncodingTarget target):
235#ifdef HAVE_ICONV 235#ifdef HAVE_ICONV
236 m_iconv((iconv_t)(-1)) {
236 if (target == ToLocaleStr) 237 if (target == ToLocaleStr)
237 m_destencoding = FbStringUtil::locale_codeset; 238 m_destencoding = FbStringUtil::locale_codeset;
238 else 239 else
239 m_destencoding = "UTF-8"; 240 m_destencoding = "UTF-8";
240#endif
241} 241}
242#else
243 m_iconv(-1) {}
244#endif
245
242 246
243StringConvertor::~StringConvertor() { 247StringConvertor::~StringConvertor() {
244#ifdef HAVE_ICONV 248#ifdef HAVE_ICONV
diff --git a/src/FbTk/FbString.hh b/src/FbTk/FbString.hh
index 502290b..133945b 100644
--- a/src/FbTk/FbString.hh
+++ b/src/FbTk/FbString.hh
@@ -67,12 +67,20 @@ public:
67 ~StringConvertor(); 67 ~StringConvertor();
68 68
69 bool setSource(const std::string &encoding); 69 bool setSource(const std::string &encoding);
70 void reset() { m_iconv = ((iconv_t)(-1)); } 70 void reset() {
71#ifdef HAVE_ICONV
72 m_iconv = ((iconv_t)(-1));
73#endif
74 }
71 75
72 std::string recode(const std::string &src); 76 std::string recode(const std::string &src);
73 77
74private: 78private:
79#ifdef HAVE_ICONV
75 iconv_t m_iconv; 80 iconv_t m_iconv;
81#else
82 int m_iconv;
83#endif
76 84
77 std::string m_destencoding; 85 std::string m_destencoding;
78}; 86};