[Yazlist] Error in latest SICONV.C

Gary Anderson ganderson at bslw.com
Thu Mar 22 02:05:51 CET 2007


Adam,

I've run through the latest siconv.c from your cvs repository.  It now 
has additional problems with converting UTF8 to MARC8.  I ran a 
simplified test.  The input string was (hex bytes, ignore spaces):

61 E8 87 BA  E7 81 A3  E5 BE 97

The output string was:

61 1B 24 31 21 54 2B 21 49 43

Notice that only the first two hangul triples were converted and 
output.  The ending ESC string was also not output.  This happened 
because the normal flow of the logic does NOT call your flush function.  
In fact in siconv.c version $Id: siconv.c,v 1.37 2007/03/20 21:37:32 
adam Exp $, yaz_iconv exits at the point shown below.

    while (1)
    {
        unsigned long x;
        size_t no_read;

        if (cd->unget_x)
        {
            x = cd->unget_x;
            no_read = cd->no_read_x;
        }
        else
        {
            if (*inbytesleft == 0)
            {
                r = *inbuf - inbuf0;
                break;    <-------------------This is the exit point.
            }

I think what you really meant to do was this:
    while (1)
    {
        unsigned long x;
        size_t no_read;

        if (cd->unget_x)
        {
            x = cd->unget_x;
            no_read = cd->no_read_x;
        }
        else
        {
            if (*inbytesleft == 0)
            {
               if (cd->flush_handle)     // Proposed fix to correctly 
clear the buffers
                   r = (*cd->flush_handle)(cd, outbuf, outbytesleft);  
// Proposed fix to correctly clear the buffers.
                r = *inbuf - inbuf0;
                break;    <-------------------This is the exit point.
            }

Anyway, I tried the code with this fix, and it works properly.  Is this 
the correct fix, or should this problem be fixed another way?

Gary

-------------- next part --------------
A non-text attachment was scrubbed...
Name: ganderson.vcf
Type: text/x-vcard
Size: 235 bytes
Desc: not available
Url : http://lists.indexdata.dk/pipermail/yazlist/attachments/20070321/10e9a1b5/ganderson.vcf


More information about the Yazlist mailing list