Until this point only certain OIDs would trigger ISO2709 decoding.
With this change all octet aligned records will be run though
the MARC parser. If it's not MARC, an error will only occur if it is
a known MARC OID. If not, all bets are off. It's probably not MARC
if it doesn't parse.
print_xml_record(octet_buf, octet_len);
}
print_xml_record(octet_buf, octet_len);
}
- else if (yaz_oid_is_iso2709(oid))
{
const char *result;
size_t rlen;
{
const char *result;
size_t rlen;
- printf("bad MARC. Dumping as it is:\n");
+ if (yaz_oid_is_iso2709(oid))
+ printf("bad MARC. Dumping as it is:\n");
print_record(octet_buf, octet_len);
}
yaz_marc_destroy(mt);
if (cd)
yaz_iconv_close(cd);
}
print_record(octet_buf, octet_len);
}
yaz_marc_destroy(mt);
if (cd)
yaz_iconv_close(cd);
}
- else
- {
- print_record(octet_buf, octet_len);
- }
marc_file_write(octet_buf, r->u.octet_aligned->len);
}
else if (oid && !oid_oidcmp(oid, yaz_oid_recsyn_sutrs))
marc_file_write(octet_buf, r->u.octet_aligned->len);
}
else if (oid && !oid_oidcmp(oid, yaz_oid_recsyn_sutrs))
charset);
else if (r->which == Z_External_octet)
{
charset);
else if (r->which == Z_External_octet)
{
- if (yaz_oid_is_iso2709(oid))
- {
- const char *ret_buf = return_marc_record(
- wrbuf, marctype, len,
- (const char *) r->u.octet_aligned->buf,
- r->u.octet_aligned->len,
- charset);
- if (ret_buf)
- return ret_buf;
- /* bad ISO2709. Return fail unless raw (ISO2709) is wanted */
- if (marctype != YAZ_MARC_ISO2709)
- return 0;
- }
+ const char *ret_buf = return_marc_record(
+ wrbuf, marctype, len,
+ (const char *) r->u.octet_aligned->buf,
+ r->u.octet_aligned->len,
+ charset);
+ if (ret_buf)
+ return ret_buf;
+ /* not ISO2709. Return fail unless raw (ISO2709) is wanted */
+ if (yaz_oid_is_iso2709(oid) && marctype != YAZ_MARC_ISO2709)
+ return 0;
return return_string_record(wrbuf, len,
(const char *) r->u.octet_aligned->buf,
r->u.octet_aligned->len,
return return_string_record(wrbuf, len,
(const char *) r->u.octet_aligned->buf,
r->u.octet_aligned->len,