X-Git-Url: http://git.indexdata.com/?p=yaz-moved-to-github.git;a=blobdiff_plain;f=src%2Fmarcdisp.c;h=a5084ce35a02b81b66b4101200cab5d713f60a6e;hp=06a4afefae5a97b945b1ed36506606d406261aac;hb=a5ac9b8b5662012c69c5e7e5287c5ffc0c7a1f25;hpb=ee6ab2ee3a9ee1a8c65d7272ec7fba1d886f5af0 diff --git a/src/marcdisp.c b/src/marcdisp.c index 06a4afe..a5084ce 100644 --- a/src/marcdisp.c +++ b/src/marcdisp.c @@ -18,6 +18,7 @@ #include #include +#include #include #include #include @@ -466,7 +467,7 @@ int yaz_marc_write_line(yaz_marc_t mt, WRBUF wr) the code is a single character .. However we've seen multibyte codes, so see how big it really is */ size_t using_code_len = - (identifier_length != 2) ? identifier_length - 1 + (identifier_length > 2) ? identifier_length - 1 : cdata_one_character(mt, s->code_data); @@ -615,7 +616,7 @@ static int yaz_marc_write_marcxml_ns1(yaz_marc_t mt, WRBUF wr, the code is a single character .. However we've seen multibyte codes, so see how big it really is */ size_t using_code_len = - (identifier_length != 2) ? identifier_length - 1 + (identifier_length > 2) ? identifier_length - 1 : cdata_one_character(mt, s->code_data); @@ -717,12 +718,12 @@ int yaz_marc_write_marcxchange(yaz_marc_t mt, WRBUF wr, } +#if YAZ_HAVE_XML2 int yaz_marc_write_xml(yaz_marc_t mt, xmlNode **root_ptr, const char *ns, const char *format, const char *type) { -#if YAZ_HAVE_XML2 struct yaz_marc_node *n; int identifier_length; const char *leader = 0; @@ -785,7 +786,7 @@ int yaz_marc_write_xml(yaz_marc_t mt, xmlNode **root_ptr, the code is a single character .. However we've seen multibyte codes, so see how big it really is */ size_t using_code_len = - (identifier_length != 2) ? identifier_length - 1 + (identifier_length > 2) ? identifier_length - 1 : cdata_one_character(mt, s->code_data); @@ -827,10 +828,8 @@ int yaz_marc_write_xml(yaz_marc_t mt, xmlNode **root_ptr, } wrbuf_destroy(wr_cdata); return 0; -#else - return -1; -#endif } +#endif int yaz_marc_write_iso2709(yaz_marc_t mt, WRBUF wr) { @@ -1052,7 +1051,7 @@ static int marc_exec_leader(const char *leader_spec, char *leader, size_t size) no = sscanf(cp, "%d=%20[^,]%n", &pos, val, &no_read); if (no < 2 || no_read < 3) return -1; - if (pos < 0 || pos >= size) + if (pos < 0 || (size_t) pos >= size) return -1; if (*val == '\'')