yaz_marc_xml(mt, marc_type);
if (yaz_marc_decode_wrbuf(mt, buf, sz, wrbuf) > 0)
{
- if (len)
- *len = wrbuf_len(wrbuf);
+ *len = wrbuf_len(wrbuf);
ret_string = wrbuf_cstr(wrbuf);
}
yaz_marc_destroy(mt);
yaz_iconv_close(cd);
if (cd2)
yaz_iconv_close(cd2);
- if (len)
- *len = wrbuf_len(wrbuf);
+ *len = wrbuf_len(wrbuf);
return wrbuf_cstr(wrbuf);
}
sz = wrbuf_len(wrbuf);
yaz_iconv_close(cd);
}
- if (len)
- *len = sz;
+ *len = sz;
return buf;
}
{
const char *res = return_record_wrbuf(wrbuf, len, npr, marctype, charset);
#if YAZ_HAVE_XML2
- if (*format == '1' && len)
+ if (*format == '1')
{
/* try to XML format res */
xmlDocPtr doc;
const char *expr, const char *type_spec)
{
#if YAZ_HAVE_XML2
- xmlDocPtr doc = xmlParseMemory(buf, strlen(buf));
+ xmlDocPtr doc = xmlParseMemory(buf, *len);
if (doc)
{
xmlChar *buf_out;
wrbuf_rewind(wrbuf);
wrbuf_write(wrbuf, (const char *) buf_out, len_out);
buf = wrbuf_cstr(wrbuf);
- if (len)
- *len = len_out;
+ *len = len_out;
}
xmlFreeDoc(doc);
xmlFree(buf_out);
char charset[40];
char format[3];
const char *cp = type_spec;
+ int len0;
+
+ if (!len)
+ len = &len0;
for (i = 0; cp[i] && cp[i] != ';' && cp[i] != ' ' && i < sizeof(type)-1;
i++)
}
if (!strcmp(type, "database"))
{
- if (len)
- *len = (npr->databaseName ? strlen(npr->databaseName) : 0);
+ *len = (npr->databaseName ? strlen(npr->databaseName) : 0);
ret = npr->databaseName;
}
else if (!strcmp(type, "schema"))
{
- if (len)
- *len = schema ? strlen(schema) : 0;
+ *len = schema ? strlen(schema) : 0;
ret = schema;
}
else if (!strcmp(type, "syntax"))
}
if (!desc)
desc = "none";
- if (len)
- *len = strlen(desc);
+ *len = strlen(desc);
ret = desc;
}
if (npr->which != Z_NamePlusRecord_databaseRecord)
}
else if (!strcmp(type, "ext"))
{
- if (len) *len = -1;
+ *len = -1;
ret = (const char *) npr->u.databaseRecord;
}
else if (!strcmp(type, "opac"))
format);
}
- if (base64_xpath)
+ if (base64_xpath && *len != -1)
{
char *type_spec = nmem_malloc(nmem,
strlen(type) + strlen(charset) + 11);