From: Adam Dickmeiss Date: Thu, 19 Jul 2001 13:27:58 +0000 (+0000) Subject: Function yaz_record handles MARC records that have identifers in 00X. X-Git-Tag: PRE_TSRM_MERGE_PATCH~75 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=863062a8bea08c5f4dfaae67ddfdfe2baa304126;p=php Function yaz_record handles MARC records that have identifers in 00X. --- diff --git a/ext/yaz/php_yaz.c b/ext/yaz/php_yaz.c index 7d4a704be8..03daba8da2 100644 --- a/ext/yaz/php_yaz.c +++ b/ext/yaz/php_yaz.c @@ -1494,6 +1494,7 @@ static Z_GenericRecord *marc_to_grs1(const char *buf, ODR o, Odr_oid *oid) int end_offset; int i; char tag_str[4]; + int identifier_flag = 1; memcpy (tag_str, buf+entry_p, 3); entry_p += 3; @@ -1544,8 +1545,16 @@ static Z_GenericRecord *marc_to_grs1(const char *buf, ODR o, Odr_oid *oid) entry_p += length_starting; i = data_offset + base_address; end_offset = i+data_length-1; + + if (indicator_length == 2) + { + if (buf[i + indicator_length] != ISO2709_IDFS) + identifier_flag = 0; + } + else if (!memcmp (tag_str, "00", 2)) + identifier_flag = 0; - if (memcmp (tag_str, "00", 2) && indicator_length) + if (identifier_flag && indicator_length) { /* indicator */ tag->tagValue->u.string = odr_malloc(o, indicator_length+1);