]> granicus.if.org Git - php/commitdiff
Function yaz_record handles MARC records that have identifers in 00X.
authorAdam Dickmeiss <dickmeiss@php.net>
Thu, 19 Jul 2001 13:27:58 +0000 (13:27 +0000)
committerAdam Dickmeiss <dickmeiss@php.net>
Thu, 19 Jul 2001 13:27:58 +0000 (13:27 +0000)
ext/yaz/php_yaz.c

index 7d4a704be8e830f23f34b8d3a1e4345bd73d7537..03daba8da2d3f67050d8b6fdbf342e904b57c30b 100644 (file)
@@ -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);