diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/FbTk/FbString.cc | 12 |
1 files changed, 9 insertions, 3 deletions
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, | |||
132 | size_t insize = in.size(); | 132 | size_t insize = in.size(); |
133 | size_t outsize = insize; | 133 | size_t outsize = insize; |
134 | char * out = (char *) malloc(outsize * sizeof(char)); // need realloc | 134 | char * out = (char *) malloc(outsize * sizeof(char)); // need realloc |
135 | char * outptr = out; | 135 | char * out_ptr = out; |
136 | 136 | ||
137 | size_t inbytesleft = insize; | 137 | size_t inbytesleft = insize; |
138 | size_t outbytesleft = outsize; | 138 | size_t outbytesleft = outsize; |
@@ -143,7 +143,13 @@ std::string recode(iconv_t cd, | |||
143 | 143 | ||
144 | while (again) { | 144 | while (again) { |
145 | again = false; | 145 | again = false; |
146 | result = iconv(cd, &in_ptr, &inbytesleft, &outptr, &outbytesleft); | 146 | |
147 | #ifdef HAVE_CONST_ICONV | ||
148 | result = iconv(cd, (const char**)(&in_ptr), &inbytesleft, &out_ptr, &outbytesleft); | ||
149 | #else | ||
150 | result = iconv(cd, &in_ptr, &inbytesleft, &out_ptr, &outbytesleft); | ||
151 | #endif // HAVE_CONST_ICONV | ||
152 | |||
147 | if (result == (size_t)(-1)) { | 153 | if (result == (size_t)(-1)) { |
148 | switch(errno) { | 154 | switch(errno) { |
149 | case EILSEQ: | 155 | case EILSEQ: |
@@ -160,7 +166,7 @@ std::string recode(iconv_t cd, | |||
160 | if (out != NULL) | 166 | if (out != NULL) |
161 | again = true; | 167 | again = true; |
162 | outbytesleft += insize; | 168 | outbytesleft += insize; |
163 | outptr = out + outsize - outbytesleft; | 169 | out_ptr = out + outsize - outbytesleft; |
164 | break; | 170 | break; |
165 | default: | 171 | default: |
166 | // something else broke | 172 | // something else broke |