X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=data1%2Fd1_read.c;h=4a96ec30eb4f5a3413397ff3eda4a065d9dd6ab7;hb=591f23727b1804a0fa57f7b3c8f02a73df39d8d2;hp=1c494d948df59a57e346cab8cc1f4a8a74444dae;hpb=52da039ed3c4af86925c563b9a63f1f1fee1a4d5;p=idzebra-moved-to-github.git diff --git a/data1/d1_read.c b/data1/d1_read.c index 1c494d9..4a96ec3 100644 --- a/data1/d1_read.c +++ b/data1/d1_read.c @@ -1,6 +1,6 @@ -/* $Id: d1_read.c,v 1.8 2004-07-26 13:51:42 adam Exp $ - Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002,2003,2004 - Index Data Aps +/* $Id: d1_read.c,v 1.15 2005-01-17 22:12:34 adam Exp $ + Copyright (C) 1995-2005 + Index Data ApS This file is part of the Zebra server. @@ -29,10 +29,8 @@ Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA #include #include -#include #include -#include -#include +#include data1_node *data1_get_root_tag (data1_handle dh, data1_node *n) { @@ -118,7 +116,7 @@ static void data1_init_node (data1_handle dh, data1_node *r, int type) r->u.preprocess.attributes = 0; break; default: - logf (LOG_WARN, "data_mk_node_type. bad type = %d\n", type); + yaz_log (YLOG_WARN, "data_mk_node_type. bad type = %d\n", type); } } @@ -194,7 +192,7 @@ data1_node *data1_mk_root (data1_handle dh, NMEM nmem, const char *name) data1_node *res; if (!absyn) { - yaz_log(LOG_WARN, "Unable to acquire abstract syntax " "for '%s'", + yaz_log(YLOG_WARN, "Unable to acquire abstract syntax " "for '%s'", name); /* It's now OK for a record not to have an absyn */ } @@ -470,8 +468,8 @@ data1_node *data1_add_taggeddata (data1_handle dh, data1_node *root, return data1_add_insert_taggeddata (dh, at, tagname, m, 1, 0); } -data1_node *data1_mk_tag_data_int (data1_handle dh, data1_node *at, - const char *tag, int num, +data1_node *data1_mk_tag_data_zint (data1_handle dh, data1_node *at, + const char *tag, zint num, NMEM nmem) { data1_node *node_data; @@ -481,11 +479,18 @@ data1_node *data1_mk_tag_data_int (data1_handle dh, data1_node *at, return 0; node_data->u.data.what = DATA1I_num; node_data->u.data.data = node_data->lbuf; - sprintf (node_data->u.data.data, "%d", num); + sprintf (node_data->u.data.data, ZINT_FORMAT, num); node_data->u.data.len = strlen (node_data->u.data.data); return node_data; } +data1_node *data1_mk_tag_data_int (data1_handle dh, data1_node *at, + const char *tag, int num, + NMEM nmem) +{ + return data1_mk_tag_data_zint(dh, at, tag, num, nmem); +} + data1_node *data1_mk_tag_data_oid (data1_handle dh, data1_node *at, const char *tag, Odr_oid *oid, NMEM nmem) @@ -779,7 +784,7 @@ data1_node *data1_read_nodex (data1_handle dh, NMEM m, } if (amp || c != '>') { - yaz_log(LOG_WARN, "d1: %d: Malformed tag", line); + yaz_log(YLOG_WARN, "d1: %d: Malformed tag", line); return 0; } else @@ -807,7 +812,7 @@ data1_node *data1_read_nodex (data1_handle dh, NMEM m, } if (i != level) { - yaz_log (LOG_WARN, "%d: no begin tag for %s", + yaz_log (YLOG_WARN, "%d: no begin tag for %s", line, tag); break; } @@ -832,7 +837,7 @@ data1_node *data1_read_nodex (data1_handle dh, NMEM m, if (sscanf(args, "%s %s %n", tclass, type, &val_offset) != 2) { - yaz_log(LOG_WARN, "Malformed variant triple at '%s'", tag); + yaz_log(YLOG_WARN, "Malformed variant triple at '%s'", tag); continue; } if (!(tp = @@ -1103,12 +1108,15 @@ int data1_iconv (data1_handle dh, NMEM m, data1_node *n, if (yaz_matchstr (tocode, fromcode)) { WRBUF wrbuf = wrbuf_alloc(); - yaz_iconv_t t = yaz_iconv_open (tocode, fromcode); + yaz_iconv_t t = yaz_iconv_open(tocode, fromcode); if (!t) + { + wrbuf_free(wrbuf, 1); return -1; - data1_iconv_s (dh, m, n, t, wrbuf, tocode); - yaz_iconv_close (t); - wrbuf_free (wrbuf, 1); + } + data1_iconv_s(dh, m, n, t, wrbuf, tocode); + yaz_iconv_close(t); + wrbuf_free(wrbuf, 1); } return 0; }