Initial work for Doxygen based YAZ reference
[yaz-moved-to-github.git] / src / cqltransform.c
index 104c02b..5cca9a6 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: cqltransform.c,v 1.8 2004-03-15 21:39:06 adam Exp $
+/* $Id: cqltransform.c,v 1.11 2004-10-03 22:34:07 adam Exp $
    Copyright (C) 2002-2004
    Index Data Aps
 
@@ -7,6 +7,11 @@ This file is part of the YAZ toolkit.
 See the file LICENSE.
 */
 
+/**
+ * \file cqltransform.c
+ * \brief Implements CQL transform (CQL to RPN conversion).
+ */
+
 #include <stdlib.h>
 #include <string.h>
 #include <yaz/cql.h>
@@ -208,14 +213,14 @@ int cql_pr_attr(cql_transform_t ct, const char *category,
  * characters starting at `term', or a null pointer of there are
  * none -- like memchr().
  */
-static char *wcchar(const char *term, int length)
+static const char *wcchar(const char *term, int length)
 {
-    char *best = 0;
-    char *current;
+    const char *best = 0;
+    const char *current;
     char *whichp;
 
     for (whichp = "*?"; *whichp != '\0'; whichp++) {
-       current = memchr(term, *whichp, length);
+       current = (const char *) memchr(term, *whichp, length);
        if (current != 0 && (best == 0 || current < best))
            best = current;
     }
@@ -302,7 +307,7 @@ void emit_term(cql_transform_t ct,
            char *mem;
             cql_pr_attr(ct, "truncation", "z3958", 0,
                         pr, client_data, 28);
-           mem = xmalloc(length+1);
+           mem = (char *) xmalloc(length+1);
             for (i = 0; i < length; i++) {
                if (term[i] == '*')      mem[i] = '?';
                else if (term[i] == '?') mem[i] = '#';
@@ -312,16 +317,9 @@ void emit_term(cql_transform_t ct,
            term = mem;
         }
         else {
-           /* No masking characters.  If there's no "truncation.none"
-            * configuration element, that's an error which we
-            * indicate (rather tangentially) as 30 "Too many masking
-            * characters in term".  28 would be equally meaningful
-            * (or meaningless) but using a different value allows us
-            * to differentiate between this case and the previous
-            * one.
-            */
+           /* No masking characters.  Use "truncation.none" if given. */
             cql_pr_attr(ct, "truncation", "none", 0,
-                        pr, client_data, 30);
+                        pr, client_data, 0);
         }
     }