X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=data1%2Fd1_read.c;h=0db4c89622b08ed14c8f2d4f152578debf455963;hb=43e4297c07b9c8b29bfc1ea647fc27456198f6ce;hp=68ee97f06da30f2c9a7b2c5b5107ccd1dfb5f01d;hpb=3e4a78274a6cb7a99f3e90967ea30c830ffbf8c3;p=idzebra-moved-to-github.git diff --git a/data1/d1_read.c b/data1/d1_read.c index 68ee97f..0db4c89 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.25 2007-04-16 08:44:31 adam Exp $ Copyright (C) 1995-2007 Index Data ApS @@ -174,6 +174,7 @@ data1_node *data1_mk_root (data1_handle dh, NMEM nmem, const char *name) { data1_absyn *absyn = data1_get_absyn(dh, name, 1); data1_node *res; + if (!absyn) { yaz_log(YLOG_WARN, "Unable to acquire abstract syntax " "for '%s'", @@ -1013,14 +1014,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; }