From d508292a578f0bee4e96b232bf7d8f5180a07296 Mon Sep 17 00:00:00 2001
From: simonb <simonb>
Date: Mon, 22 May 2006 07:34:25 +0000
Subject: fix build on cygwin (iconv constness)

---
 ChangeLog            |  2 ++
 src/FbTk/FbString.cc | 12 +++++++++---
 2 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 976981d..0ec5f8c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,8 @@
 (Format: Year/Month/Day)
 Changes for 0.9.16:
 *06/05/21:
+   * Fix build on cygwin (iconv const error) (Simon)
+     FbTk/FbString.cc
    * Fix background of external tabs when label background is 
      ParentRelative (Simon)
      FbWinFrame.cc
diff --git a/src/FbTk/FbString.cc b/src/FbTk/FbString.cc
index 687a1bd..c11b11d 100644
--- a/src/FbTk/FbString.cc
+++ b/src/FbTk/FbString.cc
@@ -132,7 +132,7 @@ std::string recode(iconv_t cd,
     size_t insize = in.size();
     size_t outsize = insize;
     char * out = (char *) malloc(outsize * sizeof(char)); // need realloc
-    char * outptr = out;
+    char * out_ptr = out;
 
     size_t inbytesleft = insize;
     size_t outbytesleft = outsize;
@@ -143,7 +143,13 @@ std::string recode(iconv_t cd,
 
     while (again) {
         again = false;
-        result = iconv(cd, &in_ptr, &inbytesleft, &outptr, &outbytesleft);
+
+#ifdef HAVE_CONST_ICONV
+        result = iconv(cd, (const char**)(&in_ptr), &inbytesleft, &out_ptr, &outbytesleft);
+#else
+        result = iconv(cd, &in_ptr, &inbytesleft, &out_ptr, &outbytesleft);
+#endif  // HAVE_CONST_ICONV
+
         if (result == (size_t)(-1)) {
             switch(errno) {
             case EILSEQ:
@@ -160,7 +166,7 @@ std::string recode(iconv_t cd,
                 if (out != NULL)
                     again = true;
                 outbytesleft += insize;
-                outptr = out + outsize - outbytesleft;
+                out_ptr = out + outsize - outbytesleft;
                 break;
             default:
                 // something else broke
-- 
cgit v0.11.2