Need a suggest the best way to fix iconv..

Andrew Pantyukhin infofarmer at FreeBSD.org
Thu Mar 29 09:56:53 UTC 2007


On 3/29/07, Andrew Pantyukhin <infofarmer at freebsd.org> wrote:
> This iconv issue appears every now and again. I'm sorry
> to bother you guys, but any suggestions how to fix this
> one are welcome:
>
> ==================================================
>         size_t inSize;
>         char *in;
>         if (myBuffer.empty()) {
>                 inSize = srcEnd - srcStart;
>                 in = (char*)srcStart;
>         } else {
>                 myBuffer.append(srcStart, srcEnd - srcStart);
>                 inSize = myBuffer.length();
>                 in = (char*)myBuffer.data();
>         }
>
>         size_t outSize = 3 * inSize;
>         const size_t startOutSize = outSize;
>         size_t oldLength = dst.length();
>         dst.append(outSize, '\0');
>         char *out = (char*)dst.data() + oldLength;
>
> iconvlabel:
>         iconv(myIConverter, &in, &inSize, &out, &outSize);
> ==================================================
>
> Should I add another const and initialize with "in"?

hmm, just a cast to (const char**) works for me. I'm
not sure it's the best solution, though.


More information about the freebsd-gnome mailing list