X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=src%2Fmarc_read_iso2709.c;h=00fedbb9ee1766861e7df7720861775a90e7a7b4;hb=00537b483d646bd04a204708ecbde708861f044e;hp=dcae48c6b0872b25aadaedeef382fd99caae3a0c;hpb=7e39a157bcf0419339fb279b9a64a8971b8a2151;p=yaz-moved-to-github.git diff --git a/src/marc_read_iso2709.c b/src/marc_read_iso2709.c index dcae48c..00fedbb 100644 --- a/src/marc_read_iso2709.c +++ b/src/marc_read_iso2709.c @@ -1,5 +1,5 @@ /* This file is part of the YAZ toolkit. - * Copyright (C) 1995-2010 Index Data + * Copyright (C) 1995-2012 Index Data * See the file LICENSE for details. */ @@ -18,7 +18,6 @@ #include #include -#include #include #include #include @@ -90,13 +89,13 @@ int yaz_marc_read_iso2709(yaz_marc_t mt, const char *buf, int bsize) } /* Check for digits in length+starting info */ while (--l >= 3) - if (!isdigit(*(const unsigned char *) (buf + entry_p+l))) + if (!yaz_isdigit(buf[entry_p + l])) break; if (l >= 3) { WRBUF hex = wrbuf_alloc(); /* Not all digits, so stop directory scan */ - wrbuf_write_escaped(hex, buf + entry_p, + wrbuf_write_escaped(hex, buf + entry_p, length_data_entry + length_starting + 3); yaz_marc_cprintf(mt, "Directory offset %d: Bad value for data" " length and/or length starting (%s)", entry_p, @@ -136,7 +135,7 @@ int yaz_marc_read_iso2709(yaz_marc_t mt, const char *buf, int bsize) if (data_length <= 0 || data_offset < 0) break; - + if (yaz_marc_get_debug(mt)) { yaz_marc_cprintf(mt, "Tag: %s. Directory offset %d: data-length %d," @@ -149,7 +148,7 @@ int yaz_marc_read_iso2709(yaz_marc_t mt, const char *buf, int bsize) entry_p0, end_offset, record_length); break; } - + if (memcmp (tag, "00", 2)) identifier_flag = 1; /* if not 00X assume subfields */ else if (indicator_length < 4 && indicator_length > 0) @@ -201,7 +200,7 @@ int yaz_marc_read_iso2709(yaz_marc_t mt, const char *buf, int bsize) { /* controlfield */ int i0 = i; - while (i < end_offset && + while (i < end_offset && buf[i] != ISO2709_RS && buf[i] != ISO2709_FS) i++; yaz_marc_add_controlfield(mt, tag, buf+i0, i-i0);