-
- t->buf = (unsigned char *) outbuf;
-
- ret = yaz_iconv (o->op->iconv_handle, &inbuf, &inleft,
- &outbuf, &outleft);
+
+ t->buf = outbuf;
+
+ ret = yaz_iconv(o->op->iconv_handle, &inbuf, &inleft,
+ &outbuf, &outleft);
+ if (ret == (size_t)(-1))
+ {
+ odr_seterror(o, ODATA, 44);
+ return 0;
+ }
+ ret = yaz_iconv(o->op->iconv_handle, 0, 0,
+ &outbuf, &outleft);
+