Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 05 Feb 2007 12:23:43 -0600
From:      "Jeremy Messenger" <mezz7@cox.net>
To:        freebsd-gnome@freebsd.org
Subject:   Need a suggest the best way to fix iconv..
Message-ID:  <op.tnaf1tni9aq2h7@mezz.mezzweb.com>

next in thread | raw e-mail | index | archive | help
Hello folks,

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

error:

=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
client/Text.cpp: In static member function `static std::string&  =

Text::convert(const std::string&, std::string&, const std::string&, cons=
t  =

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*)'
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D

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

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

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

Which should I change it to?

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

or

rv =3D 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 sur=
e  =

so I rather ask in here to see if I am right or wrong. Thanks.

Cheers,
Mezz


-- =

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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?op.tnaf1tni9aq2h7>