gnokii-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

compilation


From: Manuel Felipe
Subject: compilation
Date: 25 Nov 2003 02:35:33 +0100

Hi!, I'm a spanish gnokii-0.5.6 (tarball) user (sorry for my ugly
english).
During compilation, I encountered a problem in the file
common/gsm-encoding.c:

int utf8_encode(char *outstring, int outlen, const char *instring, int
inlen)
{
        size_t outleft, inleft, nconv;
        char *pin, *pout;

        outleft = outlen;
        inleft = inlen;
        pin = (char *)instring;
        pout = outstring;

/*                      HERE IT IS:
                        ----------                              */
#if defined(HAVE_ICONV) && defined(HAVE_LANGINFO_CODESET)
/* Oops!, If the last is true, the following is a declaration of a
 * variable in the middle of code!                               */
        iconv_t cd; 





        cd = iconv_open("UTF-8", nl_langinfo(CODESET));

        nconv = iconv(cd, &pin, &inleft, &pout, &outleft);
        *pout = 0;
        iconv_close(cd);
#else
        nconv = 0;
        pin = (char *)instring;
        pout = outstring;

        while (inlen > 0 && outlen > 0) {
                if (*pin < 0 || *pin > 127)
                        *pout = '?';
                else
                        *pout = *pin;

                inlen--;
                outlen--;
                pin++;
                if (*pout++ == '\0') break;
        }
#endif
        return (nconv < 0) ?  -1 : pout - outstring;
}

Thanks a lot, and may all the errors in your code be like this one ;-)
Manuel Felipe.







reply via email to

[Prev in Thread] Current Thread [Next in Thread]