X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=src%2Fmarc_read_line.c;h=ff5f38e5f164c2c1dd811986027a9af27caf5a93;hb=5bc2ee09e4dff0f872ce738a5327bced915e3474;hp=b3bbe800aa053180ad9d406f7cf02ee1a7269cc8;hpb=ee6ab2ee3a9ee1a8c65d7272ec7fba1d886f5af0;p=yaz-moved-to-github.git diff --git a/src/marc_read_line.c b/src/marc_read_line.c index b3bbe80..ff5f38e 100644 --- a/src/marc_read_line.c +++ b/src/marc_read_line.c @@ -1,5 +1,5 @@ /* This file is part of the YAZ toolkit. - * Copyright (C) 1995-2008 Index Data + * Copyright (C) 1995-2012 Index Data * See the file LICENSE for details. */ @@ -19,7 +19,6 @@ #include #include #include -#include #include #include @@ -92,7 +91,7 @@ static int yaz_marc_line_gets(int (*getbyte)(void *client_data), return 1; } - + int yaz_marc_read_line(yaz_marc_t mt, int (*getbyte)(void *client_data), void (*ungetbyte)(int b, void *client_data), @@ -128,7 +127,7 @@ int yaz_marc_read_line(yaz_marc_t mt, } else if (line[0] == '(') /* annotation, skip it */ ; - else if (line_len == 24 && atoi_n_check(line, 5, &val) && val >= 24) + else if (line_len == 24 && atoi_n_check(line, 5, &val)) { /* deal with header lines: 00366nam 22001698a 4500 */ @@ -144,7 +143,7 @@ int yaz_marc_read_line(yaz_marc_t mt, &length_implementation); header_created = 1; } - else if (line_len > 5 && line[0] != ' ' && line[1] != ' ' + else if (line_len > 4 && line[0] != ' ' && line[1] != ' ' && line[2] != ' ' && line[3] == ' ' ) { /* deal with data/control lines: 245 12 ........ */ @@ -196,7 +195,7 @@ int yaz_marc_read_line(yaz_marc_t mt, { const char *next; size_t len; - + assert(cp[0] == marker_ch); cp++; next = cp; @@ -231,7 +230,6 @@ int yaz_marc_read_line(yaz_marc_t mt, cp++; } } - assert(len >= 0); yaz_marc_add_subfield(mt, cp, len); if (!next) break; @@ -253,6 +251,7 @@ int yaz_marc_read_line(yaz_marc_t mt, /* * Local variables: * c-basic-offset: 4 + * c-file-style: "Stroustrup" * indent-tabs-mode: nil * End: * vim: shiftwidth=4 tabstop=8 expandtab