X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=include%2Fyaz%2Fwrbuf.h;h=6cde6eeb4a95b776e967975cfadec58501122063;hb=f9ee3b9ec26306b6397c37434e8066f084d33b3a;hp=0f393a64f7c3252383abd9242d1d29a6e3109f34;hpb=055f23ee3692349a03f681ef1a0d5fd70c0cc770;p=yaz-moved-to-github.git diff --git a/include/yaz/wrbuf.h b/include/yaz/wrbuf.h index 0f393a6..6cde6ee 100644 --- a/include/yaz/wrbuf.h +++ b/include/yaz/wrbuf.h @@ -1,5 +1,5 @@ /* This file is part of the YAZ toolkit. - * Copyright (C) 1995-2010 Index Data. + * Copyright (C) 1995-2011 Index Data. * All rights reserved. * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: @@ -124,6 +124,19 @@ YAZ_EXPORT void wrbuf_printf(WRBUF b, const char *fmt, ...) __attribute__ ((format (printf, 2, 3))) #endif ; + +/** \brief general writer of string using iconv and cdata + \param b WRBUF + \param cd iconv handle (0 for no conversion) + \param buf buffer + \param size size of buffer + \param cdata non-zero for CDATA; 0 for cdata + \returns -1 if invalid sequence was encountered (truncation in effect) + \returns 0 if buffer could be converted and written +*/ +int wrbuf_iconv_write_x(WRBUF b, yaz_iconv_t cd, const char *buf, + size_t size, int cdata); + /** \brief iconv converts buffer and appends to WRBUF \param b WRBUF \param cd iconv handle @@ -202,7 +215,7 @@ YAZ_EXPORT int wrbuf_grow(WRBUF b, size_t minsize); YAZ_EXPORT const char *wrbuf_cstr(WRBUF b); #define wrbuf_putc(b, c) \ - (((b)->pos >= (b)->size ? wrbuf_grow(b, 1) : 0), \ + ((void) ((b)->pos >= (b)->size ? wrbuf_grow(b, 1) : 0), \ (b)->buf[(b)->pos++] = (c), 0) YAZ_END_CDECL