Avoid using non-portable debian.h
[yaz-moved-to-github.git] / src / cqltransform.c
index ff42293..415a6cf 100644 (file)
@@ -191,9 +191,8 @@ static int cql_transform_parse_tok_line(cql_transform_t ct,
         {
             ODR pr = odr_createmem(ODR_PRINT);
             Z_AttributeList *alp = &(*pp)->attr_list;
-            odr_setprint(pr, yaz_log_file());
+            odr_setprint_noclose(pr, yaz_log_file());
             z_AttributeList(pr, &alp, 0, 0);
-            odr_setprint(pr, 0);
             odr_destroy(pr);
         }
     }
@@ -340,9 +339,13 @@ const char *cql_lookup_reverse(cql_transform_t ct,
                 for (j = 0; j < attributes->num_attributes; j++)
                 {
                     /* actual attribute */
-                    Z_AttributeElement *a_ae = attributes->attributes[j];
-                    int r = compare_attr(e_ae, a_ae);
-                    if (r == 0)
+                    Z_AttributeElement a_ae = *attributes->attributes[j];
+                    if (!compare_attr(e_ae, &a_ae))
+                        break;
+                    if (a_ae.attributeSet && &e_ae->attributeSet &&
+                        !oid_oidcmp(a_ae.attributeSet, yaz_oid_attset_bib_1))
+                        a_ae.attributeSet = 0;
+                    if (!compare_attr(e_ae, &a_ae))
                         break;
                 }
                 if (j == attributes->num_attributes)