X-Git-Url: http://git.indexdata.com/?p=yaz-moved-to-github.git;a=blobdiff_plain;f=src%2Fwrbuf.c;h=67de45e5cf9c1d69bca221141ae6cd296a9d765a;hp=31729b031c11fc362b04a686d0acd6a9c7123518;hb=38d2e7b4d30b060d3b6dc85e0e3f57c4930c6313;hpb=055f23ee3692349a03f681ef1a0d5fd70c0cc770 diff --git a/src/wrbuf.c b/src/wrbuf.c index 31729b0..67de45e 100644 --- a/src/wrbuf.c +++ b/src/wrbuf.c @@ -1,5 +1,5 @@ /* This file is part of the YAZ toolkit. - * Copyright (C) 1995-2010 Index Data + * Copyright (C) 1995-2011 Index Data * See the file LICENSE for details. */ @@ -79,6 +79,12 @@ void wrbuf_puts(WRBUF b, const char *buf) wrbuf_write(b, buf, strlen(buf)); } +void wrbuf_vp_puts(const char *buf, void *client_data) +{ + WRBUF b = (WRBUF) client_data; + wrbuf_puts(b, buf); +} + void wrbuf_puts_replace_char(WRBUF b, const char *buf, const char from, const char to) { @@ -152,9 +158,10 @@ void wrbuf_printf(WRBUF b, const char *fmt, ...) va_end(ap); } -static void wrbuf_iconv_write_x(WRBUF b, yaz_iconv_t cd, const char *buf, - size_t size, int cdata) +int wrbuf_iconv_write_x(WRBUF b, yaz_iconv_t cd, const char *buf, + size_t size, int cdata) { + int ret = 0; if (cd) { char outbuf[128]; @@ -170,7 +177,10 @@ static void wrbuf_iconv_write_x(WRBUF b, yaz_iconv_t cd, const char *buf, { int e = yaz_iconv_error(cd); if (e != YAZ_ICONV_E2BIG) + { + ret = -1; break; + } } if (cdata) wrbuf_xmlputs_n(b, outbuf, outp - outbuf); @@ -185,6 +195,7 @@ static void wrbuf_iconv_write_x(WRBUF b, yaz_iconv_t cd, const char *buf, else wrbuf_write(b, buf, size); } + return ret; } void wrbuf_iconv_write(WRBUF b, yaz_iconv_t cd, const char *buf, size_t size)