Need a suggest the best way to fix iconv..

Jeremy Messenger mezz7 at cox.net
Mon Feb 5 18:22:15 UTC 2007


Hello folks,

I am not sure what is the best way to fix iconv. I get following build  
error:

===================================
client/Text.cpp: In static member function `static std::string&  
Text::convert(const std::string&, std::string&, const std::string&, const  
std::string&)':
client/Text.cpp:312: error: invalid conversion from `char**' to `const  
char**'
client/Text.cpp:312: error:   initializing argument 2 of `size_t  
libiconv(void*, const char**, size_t*, char**, size_t*)'
===================================

The code looks like (last line is 312 line):

===================================
	size_t rv;
	size_t len = str.length() * 2; // optimization
	size_t inleft = str.length();
	size_t outleft = len;
	tmp.resize(len);
	const char *inbuf = str.data();
	char *outbuf = (char *)tmp.data();

	while(inleft > 0) {
		rv = iconv(cd, (char **)&inbuf, &inleft, &outbuf, &outleft);
===================================

Which should I change it to?

rv = iconv(cd, (const char **)&inbuf, &inleft, &outbuf, &outleft);

or

rv = iconv(cd, &inbuf, &inleft, &outbuf, &outleft);

Both of them build fine. If I remember it correct about that AbiWord has  
ICONV_CONST stuff, so I have chosen add 'const'. But, I am still not sure  
so I rather ask in here to see if I am right or wrong. Thanks.

Cheers,
Mezz


-- 
mezz7 at cox.net  -  mezz at FreeBSD.org
FreeBSD GNOME Team  -  FreeBSD Multimedia Hat (ports, not src)
http://www.FreeBSD.org/gnome/  -  gnome at FreeBSD.org
http://wiki.freebsd.org/multimedia  -  multimedia at FreeBSD.org


More information about the freebsd-gnome mailing list