summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorFlorent Le Coz <louiz@louiz.org>2013-11-10 03:18:08 +0100
committerFlorent Le Coz <louiz@louiz.org>2013-11-10 03:18:08 +0100
commitef014f7ddf8fd603a4238f5ed4878d7038ce162d (patch)
tree9b941900312c91f52c9a8752dd276e31c7583bd6 /src
parent6a43d350bed472f8e52525d9afc2d40ee72cef7e (diff)
downloadbiboumi-ef014f7ddf8fd603a4238f5ed4878d7038ce162d.tar.gz
biboumi-ef014f7ddf8fd603a4238f5ed4878d7038ce162d.tar.bz2
biboumi-ef014f7ddf8fd603a4238f5ed4878d7038ce162d.tar.xz
biboumi-ef014f7ddf8fd603a4238f5ed4878d7038ce162d.zip
Properly detect iconv features to compile
Diffstat (limited to 'src')
-rw-r--r--src/utils/encoding.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/utils/encoding.cpp b/src/utils/encoding.cpp
index a1bc01b..2a6aecb 100644
--- a/src/utils/encoding.cpp
+++ b/src/utils/encoding.cpp
@@ -75,10 +75,15 @@ namespace utils
// Make sure cd is always closed when we leave this function
ScopeGuard sg([&]{ iconv_close(cd); });
- // iconv will not attempt to modify this buffer, but it still requires
- // a char**.
size_t inbytesleft = str.size();
+
+ // iconv will not attempt to modify this buffer, but some plateform
+ // require a char** anyway
+#ifdef ICONV_SECOND_ARGUMENT_IS_CONST
+ const char* inbuf_ptr = str.c_str();
+#else
char* inbuf_ptr = const_cast<char*>(str.c_str());
+#endif
size_t outbytesleft = str.size() * 4;
char* outbuf = new char[outbytesleft];