X-Git-Url: http://git.indexdata.com/?p=yaz-moved-to-github.git;a=blobdiff_plain;f=ztest%2Fread-marc.c;h=cecbabcac0d891a763d2e2aeea60f19ac523bd12;hp=cc9ca29ca86402c557a957243e0e99c20035243e;hb=d940392c53c32ccf76fb287cc5b997b9e921a431;hpb=1121eeb134f61c6c2510143858db59045c1b6757 diff --git a/ztest/read-marc.c b/ztest/read-marc.c index cc9ca29..cecbabc 100644 --- a/ztest/read-marc.c +++ b/ztest/read-marc.c @@ -1,8 +1,6 @@ -/* - * Copyright (c) 2002, Index Data. +/* This file is part of the YAZ toolkit. + * Copyright (C) 1995-2008 Index Data * See the file LICENSE for details. - * - * $Id: read-marc.c,v 1.4 2002-12-16 13:13:53 adam Exp $ */ /* @@ -1537,7 +1535,7 @@ static int atoin (const char *buf, int n) int val = 0; while (--n >= 0) { - if (isdigit(*buf)) + if (isdigit(*(const unsigned char *) buf)) val = val*10 + (*buf - '0'); buf++; } @@ -1602,8 +1600,8 @@ char *dummy_marc_record (int num, ODR odr) char *dummy_xml_record (int num, ODR odr) { yaz_marc_t mt = yaz_marc_create(); - char *result; - int rlen; + const char *result; + size_t rlen; char *rec = dummy_marc_record (num, odr); int len; @@ -1613,7 +1611,19 @@ char *dummy_xml_record (int num, ODR odr) yaz_marc_xml(mt, YAZ_MARC_MARCXML); len = yaz_marc_decode_buf (mt, rec, -1, &result, &rlen); if (len > 1) - rec = (char *) odr_strdup(odr, result); + { + rec = (char *) odr_malloc(odr, rlen+1); + memcpy(rec, result, rlen); + rec[rlen] = '\0'; + } yaz_marc_destroy(mt); return rec; } +/* + * Local variables: + * c-basic-offset: 4 + * indent-tabs-mode: nil + * End: + * vim: shiftwidth=4 tabstop=8 expandtab + */ +