fix build on cygwin (iconv constness)

This commit is contained in:
simonb 2006-05-22 07:34:25 +00:00
parent f564d3c4cf
commit d508292a57
2 changed files with 11 additions and 3 deletions

View file

@ -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

View file

@ -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