Date: Tue, 06 Feb 2007 07:08:34 -0600 From: "Jeremy Messenger" <mezz7@cox.net> To: "Alexander Nedotsukov" <bland@freebsd.org> Cc: freebsd-gnome@freebsd.org Subject: Re: Need a suggest the best way to fix iconv.. Message-ID: <op.tnbv4kh99aq2h7@mezz.mezzweb.com> In-Reply-To: <45C7F45D.4020407@FreeBSD.org> References: <op.tnaf1tni9aq2h7@mezz.mezzweb.com> <45C7F45D.4020407@FreeBSD.org>
next in thread | previous in thread | raw e-mail | index | archive | help
On Mon, 05 Feb 2007 21:22:05 -0600, Alexander Nedotsukov = <bland@FreeBSD.org> wrote: > Jeremy Messenger wrote: >> Hello folks, >> >> I am not sure what is the best way to fix iconv. I get following buil= d = >> 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&, = >> const std::string&)': >> client/Text.cpp:312: error: invalid conversion from `char**' to `cons= t = >> 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); > > This one. Thanks! > And if you have a plan to send your patch back to the authors it is = > better to declare inbuf as ICONV_CONST char* as well (though not sure = if = > their configure smart enough to define that macro. check produced = > config.h to be sure). I will showing the developer about this thread and let him to figure out= = what to do with the scons. I will be using a hardcore patch until whomev= er = create ICONV_CONST check in scons. Another way is to create define LINUX= , = since I think Linux (glibc) is the only one that is doing different. Cheers, Mezz >> 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. Thank= s. >> >> 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.tnbv4kh99aq2h7>