Added debug logging to verify ZOOM_EVENT_RECV_SEARCH
[yaz-moved-to-github.git] / src / cqltransform.c
index 3846685..55c3366 100644 (file)
@@ -1,5 +1,5 @@
 /* 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.
  */
 
@@ -106,7 +106,7 @@ static int cql_transform_parse_tok_line(cql_transform_t ct,
             wrbuf_puts(type_str, yaz_tok_parse_string(tp));
             t = yaz_tok_move(tp);
         }
-        elem->attributeType = nmem_longintdup(ct->nmem, 0);
+        elem->attributeType = nmem_intdup(ct->nmem, 0);
         if (sscanf(wrbuf_cstr(type_str), ODR_INT_PRINTF, elem->attributeType)
             != 1)
         {
@@ -140,7 +140,7 @@ static int cql_transform_parse_tok_line(cql_transform_t ct,
         {
             elem->which = Z_AttributeValue_numeric;
             elem->value.numeric =
-                nmem_longintdup(ct->nmem, atoi(value_str));
+                nmem_intdup(ct->nmem, atoi(value_str));
         }
         else
         {
@@ -350,7 +350,7 @@ const char *cql_lookup_reverse(cql_transform_t ct,
                     
             }
             if (i == e->attr_list.num_attributes)
-                return e->pattern;
+                return e->pattern + clen;
         }
     }
     return 0;
@@ -435,7 +435,7 @@ int cql_pr_attr_uri(cql_transform_t ct, const char *category,
             int i;
             while (*cp1 && *cp1 != ' ')
                 cp1++;
-            if (cp1 - cp0 >= sizeof(buf))
+            if (cp1 - cp0 >= (ptrdiff_t) sizeof(buf))
                 break;
             memcpy(buf, cp0, cp1 - cp0);
             buf[cp1-cp0] = 0;
@@ -607,11 +607,11 @@ static int has_modifier(struct cql_node *cn, const char *name) {
 }
 
 
-void emit_term(cql_transform_t ct,
-               struct cql_node *cn,
-               const char *term, int length,
-               void (*pr)(const char *buf, void *client_data),
-               void *client_data)
+static void emit_term(cql_transform_t ct,
+                      struct cql_node *cn,
+                      const char *term, int length,
+                      void (*pr)(const char *buf, void *client_data),
+                      void *client_data)
 {
     int i;
     const char *ns = cn->u.st.index_uri;
@@ -748,11 +748,11 @@ void emit_term(cql_transform_t ct,
     xfree(z3958_mem);
 }
 
-void emit_terms(cql_transform_t ct,
-                struct cql_node *cn,
-                void (*pr)(const char *buf, void *client_data),
-                void *client_data,
-                const char *op)
+static void emit_terms(cql_transform_t ct,
+                       struct cql_node *cn,
+                       void (*pr)(const char *buf, void *client_data),
+                       void *client_data,
+                       const char *op)
 {
     struct cql_node *ne = cn->u.st.extra_terms;
     if (ne)
@@ -776,11 +776,11 @@ void emit_terms(cql_transform_t ct,
     }
 }
 
-void emit_wordlist(cql_transform_t ct,
-                   struct cql_node *cn,
-                   void (*pr)(const char *buf, void *client_data),
-                   void *client_data,
-                   const char *op)
+static void emit_wordlist(cql_transform_t ct,
+                          struct cql_node *cn,
+                          void (*pr)(const char *buf, void *client_data),
+                          void *client_data,
+                          const char *op)
 {
     const char *cp0 = cn->u.st.term;
     const char *cp1;