projects
/
yaz-moved-to-github.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fix: set the correct num elements on parsing error
[yaz-moved-to-github.git]
/
src
/
querytowrbuf.c
diff --git
a/src/querytowrbuf.c
b/src/querytowrbuf.c
index
ee975f4
..
3caf21b
100644
(file)
--- a/
src/querytowrbuf.c
+++ b/
src/querytowrbuf.c
@@
-1,5
+1,5
@@
/* This file is part of the YAZ toolkit.
/* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2009 Index Data
+ * Copyright (C) 1995-2010 Index Data
* See the file LICENSE for details.
*/
* See the file LICENSE for details.
*/
@@
-39,47
+39,44
@@
static void yaz_attribute_element_to_wrbuf(WRBUF b,
const Z_AttributeElement *element)
{
int i;
const Z_AttributeElement *element)
{
int i;
- char oid_name_str[OID_STR_MAX];
- const char *setname = 0;
- char *sep = " "; /* optional space after attrset name */
+
+ wrbuf_puts(b, "@attr ");
if (element->attributeSet)
{
if (element->attributeSet)
{
- setname = yaz_oid_to_string_buf(element->attributeSet,
- 0, oid_name_str);
- }
- if (!setname)
- {
- setname = "";
- sep = "";
+ char oid_name_str[OID_STR_MAX];
+ const char *setname = yaz_oid_to_string_buf(element->attributeSet,
+ 0, oid_name_str);
+ if (setname)
+ {
+ wrbuf_puts(b, setname);
+ wrbuf_puts(b, " ");
+ }
}
}
+ wrbuf_printf(b, ODR_INT_PRINTF "=", *element->attributeType);
switch (element->which)
{
case Z_AttributeValue_numeric:
switch (element->which)
{
case Z_AttributeValue_numeric:
- wrbuf_printf(b,"@attr %s%s" ODR_INT_PRINTF "=" ODR_INT_PRINTF " ",
- setname, sep,
- *element->attributeType, *element->value.numeric);
+ wrbuf_printf(b, ODR_INT_PRINTF, *element->value.numeric);
break;
case Z_AttributeValue_complex:
break;
case Z_AttributeValue_complex:
- wrbuf_printf(b,"@attr %s%s\""ODR_INT_PRINTF "=", setname, sep,
- *element->attributeType);
for (i = 0; i<element->value.complex->num_list; i++)
{
if (i)
for (i = 0; i<element->value.complex->num_list; i++)
{
if (i)
- wrbuf_printf(b,",");
+ wrbuf_printf(b, ",");
if (element->value.complex->list[i]->which ==
Z_StringOrNumeric_string)
if (element->value.complex->list[i]->which ==
Z_StringOrNumeric_string)
- wrbuf_printf (b, "%s",
- element->value.complex->list[i]->u.string);
+ wrbuf_printf(b, "%s",
+ element->value.complex->list[i]->u.string);
else if (element->value.complex->list[i]->which ==
Z_StringOrNumeric_numeric)
else if (element->value.complex->list[i]->which ==
Z_StringOrNumeric_numeric)
- wrbuf_printf (b, ODR_INT_PRINTF,
- *element->value.complex->list[i]->u.numeric);
+ wrbuf_printf(b, ODR_INT_PRINTF,
+ *element->value.complex->list[i]->u.numeric);
}
}
- wrbuf_printf(b, "\" ");
break;
default:
break;
default:
- wrbuf_printf (b, "@attr 1=unknown ");
+ wrbuf_printf (b, "@attr 1=unknown");
}
}
+ wrbuf_puts(b, " ");
}
static const char *complex_op_name(const Z_Operator *op)
}
static const char *complex_op_name(const Z_Operator *op)
@@
-233,7
+230,7
@@
void yaz_scan_to_wrbuf(WRBUF b, const Z_AttributesPlusTerm *zapt,
yaz_apt_to_wrbuf(b, zapt);
}
yaz_apt_to_wrbuf(b, zapt);
}
-void wrbuf_diags(WRBUF b, int num_diagnostics,Z_DiagRec **diags)
+void wrbuf_diags(WRBUF b, int num_diagnostics, Z_DiagRec **diags)
{
/* we only dump the first diag - that keeps the log cleaner. */
wrbuf_printf(b," ERROR ");
{
/* we only dump the first diag - that keeps the log cleaner. */
wrbuf_printf(b," ERROR ");