X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=src%2Fcqltransform.c;h=5cca9a6b0c02bfc531d5a919181a421abf643c14;hb=00a44ce036714ab57696ef7ca415e69422745706;hp=104c02bafaa6984154246d6eec2a5772859a6a50;hpb=00106dc85fcaa3b02f9a0d471ea90a594bf3a175;p=yaz-moved-to-github.git diff --git a/src/cqltransform.c b/src/cqltransform.c index 104c02b..5cca9a6 100644 --- a/src/cqltransform.c +++ b/src/cqltransform.c @@ -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 #include #include @@ -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); } }