projects
/
yaz-moved-to-github.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
b43711e
)
MARC reader: more verbose if dir parsing fails
author
Adam Dickmeiss
<adam@indexdata.dk>
Mon, 2 Aug 2010 10:18:18 +0000
(12:18 +0200)
committer
Adam Dickmeiss
<adam@indexdata.dk>
Mon, 2 Aug 2010 10:18:18 +0000
(12:18 +0200)
src/marc_read_iso2709.c
patch
|
blob
|
history
diff --git
a/src/marc_read_iso2709.c
b/src/marc_read_iso2709.c
index
7edf8be
..
dcae48c
100644
(file)
--- a/
src/marc_read_iso2709.c
+++ b/
src/marc_read_iso2709.c
@@
-74,18
+74,34
@@
int yaz_marc_read_iso2709(yaz_marc_t mt, const char *buf, int bsize)
}
if (yaz_marc_get_debug(mt))
{
}
if (yaz_marc_get_debug(mt))
{
- yaz_marc_cprintf(mt, "Directory offset %d: Tag %.3s",
- entry_p, buf+entry_p);
+ WRBUF hex = wrbuf_alloc();
+
+ wrbuf_puts(hex, "Tag ");
+ wrbuf_write_escaped(hex, buf + entry_p, 3);
+ wrbuf_puts(hex, ", length ");
+ wrbuf_write_escaped(hex, buf + entry_p + 3,
+ length_data_entry);
+ wrbuf_puts(hex, ", starting ");
+ wrbuf_write_escaped(hex, buf + entry_p + 3 + length_data_entry,
+ length_starting);
+ yaz_marc_cprintf(mt, "Directory offset %d: %s",
+ entry_p, wrbuf_cstr(hex));
+ wrbuf_destroy(hex);
}
}
- /* Check for digits in length info */
+ /* Check for digits in length+starting info */
while (--l >= 3)
if (!isdigit(*(const unsigned char *) (buf + entry_p+l)))
break;
if (l >= 3)
{
while (--l >= 3)
if (!isdigit(*(const unsigned char *) (buf + entry_p+l)))
break;
if (l >= 3)
{
+ WRBUF hex = wrbuf_alloc();
/* Not all digits, so stop directory scan */
/* Not all digits, so stop directory scan */
+ wrbuf_write_escaped(hex, buf + entry_p,
+ length_data_entry + length_starting + 3);
yaz_marc_cprintf(mt, "Directory offset %d: Bad value for data"
yaz_marc_cprintf(mt, "Directory offset %d: Bad value for data"
- " length and/or length starting", entry_p);
+ " length and/or length starting (%s)", entry_p,
+ wrbuf_cstr(hex));
+ wrbuf_destroy(hex);
break;
}
entry_p += 3 + length_data_entry + length_starting;
break;
}
entry_p += 3 + length_data_entry + length_starting;