X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;ds=sidebyside;f=data1%2Fd1_read.c;h=8247e6255502eaf30c8f42f49c32e6eefc2ba362;hb=46d18b14e7af411cd9b9a4614e6bb0cb1a99069c;hp=68ee97f06da30f2c9a7b2c5b5107ccd1dfb5f01d;hpb=a3b3b8fc3baa797d7052466bd8d6b4414617e46d;p=idzebra-moved-to-github.git diff --git a/data1/d1_read.c b/data1/d1_read.c index 68ee97f..8247e62 100644 --- a/data1/d1_read.c +++ b/data1/d1_read.c @@ -1,4 +1,4 @@ -/* $Id: d1_read.c,v 1.23 2007-03-19 21:50:39 adam Exp $ +/* $Id: d1_read.c,v 1.24 2007-03-20 22:07:35 adam Exp $ Copyright (C) 1995-2007 Index Data ApS @@ -1013,14 +1013,15 @@ static int conv_item (NMEM m, yaz_iconv_t t, { char *outbuf = wrbuf->buf + wrbuf->pos; size_t outlen = wrbuf->size - wrbuf->pos; - if (yaz_iconv (t, &inbuf, &inlen, &outbuf, &outlen) == + if (yaz_iconv(t, &inbuf, &inlen, &outbuf, &outlen) == (size_t)(-1) && yaz_iconv_error(t) != YAZ_ICONV_E2BIG) { /* bad data. stop and skip conversion entirely */ return -1; } else if (inlen == 0) - { /* finished converting */ + { /* finished converting, flush it */ + yaz_iconv(t, 0, 0, &outbuf, &outlen); wrbuf->pos = wrbuf->size - outlen; break; }