* Copyright (C) 1995-2007, Index Data ApS
* See the file LICENSE for details.
*
- * $Id: marcdisp.c,v 1.48 2007-03-19 14:40:07 adam Exp $
+ * $Id: marcdisp.c,v 1.50 2007-05-06 20:12:20 adam Exp $
*/
/**
static void marc_iconv_reset(yaz_marc_t mt, WRBUF wr)
{
- if (mt->iconv_cd)
- {
- char outbuf[12];
- size_t outbytesleft = sizeof(outbuf);
- char *outp = outbuf;
- size_t r = yaz_iconv(mt->iconv_cd, 0, 0, &outp, &outbytesleft);
- if (r != (size_t) (-1))
- wrbuf_write(wr, outbuf, outp - outbuf);
- }
+ wrbuf_iconv_reset(wr, mt->iconv_cd);
}
static int marc_exec_leader(const char *leader_spec, char *leader,
static struct yaz_marc_node *yaz_marc_add_node(yaz_marc_t mt)
{
- struct yaz_marc_node *n = nmem_malloc(mt->nmem, sizeof(*n));
+ struct yaz_marc_node *n = (struct yaz_marc_node *)
+ nmem_malloc(mt->nmem, sizeof(*n));
n->next = 0;
*mt->nodes_pp = n;
mt->nodes_pp = &n->next;
if (mt->subfield_pp)
{
- struct yaz_marc_subfield *n = nmem_malloc(mt->nmem, sizeof(*n));
+ struct yaz_marc_subfield *n = (struct yaz_marc_subfield *)
+ nmem_malloc(mt->nmem, sizeof(*n));
n->code_data = nmem_strdupn(mt->nmem, code_data, code_data_len);
n->next = 0;
/* mark subfield_pp to point to this one, so we append here next */
wrbuf_puts(wr, "(");
wrbuf_iconv_write(wr, mt->iconv_cd,
n->u.comment, strlen(n->u.comment));
+ marc_iconv_reset(mt, wr);
wrbuf_puts(wr, ")\n");
break;
case YAZ_MARC_LEADER:
}
/* write dummy FS (makes MARC-8 to become ASCII) */
wrbuf_iconv_putchar(wr_data_tmp, mt->iconv_cd, ' ');
+ marc_iconv_reset(mt, wr_data_tmp);
data_length += wrbuf_len(wr_data_tmp);
break;
case YAZ_MARC_CONTROLFIELD:
n->u.controlfield.data);
marc_iconv_reset(mt, wr_data_tmp);
wrbuf_iconv_putchar(wr_data_tmp, mt->iconv_cd, ' ');/* field sep */
+ marc_iconv_reset(mt, wr_data_tmp);
data_length += wrbuf_len(wr_data_tmp);
break;
case YAZ_MARC_COMMENT: