Compile error, iconv and const

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Compile error, iconv and const

Stefan Schimanski
/Users/sts/Quellen/mac/lyx-devel/src/support/unicode.cpp: In member  
function 'int lyx::IconvProcessor::convert(const char*, size_t, char*,  
size_t)':
/Users/sts/Quellen/mac/lyx-devel/src/support/unicode.cpp:138: error:  
invalid conversion from 'const char**' to 'char**'
/Users/sts/Quellen/mac/lyx-devel/src/support/unicode.cpp:138: error:    
initializing argument 2 of 'size_t iconv(void*, char**, size_t*,  
char**, size_t*)'

I get this with Leopard's gcc 4.01. Fixed it by this patch:

Index: src/support/docstream.cpp
===================================================================
--- src/support/docstream.cpp (revision 21402)
+++ src/support/docstream.cpp (working copy)
@@ -240,7 +240,7 @@
  size_t * inbytesleft, char ** to, size_t * outbytesleft) const
  {
  char const * const to_start = *to;
- size_t converted = iconv(cd, const_cast<char ICONV_CONST **>(from),
+ size_t converted = iconv(cd, const_cast<char **>(from),
  inbytesleft, to, outbytesleft);
  if (converted == (size_t)(-1)) {
  switch(errno) {
Index: src/support/unicode.cpp
===================================================================
--- src/support/unicode.cpp (revision 21402)
+++ src/support/unicode.cpp (working copy)
@@ -131,7 +131,7 @@
  return -1;
  }

- char ICONV_CONST * inbuf = const_cast<char ICONV_CONST *>(buf);
+ char * inbuf = const_cast<char *>(buf);
  size_t inbytesleft = buflen;
  size_t outbytesleft = maxoutsize;

But I have no clue whether this is sensible in general.

Stefan
Loading...