X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=include%2Fyaz%2Fwrbuf.h;h=6cde6eeb4a95b776e967975cfadec58501122063;hb=f9ee3b9ec26306b6397c37434e8066f084d33b3a;hp=46b38f56c0248aef61faa2abe7fa151790c1f4a2;hpb=2db517d64ac08da1f812f33812cf58f6aeb905e3;p=yaz-moved-to-github.git diff --git a/include/yaz/wrbuf.h b/include/yaz/wrbuf.h index 46b38f5..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: @@ -53,6 +53,8 @@ YAZ_EXPORT WRBUF wrbuf_alloc(void); /** \brief destroy WRBUF and its buffer \param b WRBUF + + For YAZ 4.0.2 WRBUF b may be NULL. */ YAZ_EXPORT void wrbuf_destroy(WRBUF b); @@ -122,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 @@ -200,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