X-Git-Url: http://git.indexdata.com/?p=yaz-moved-to-github.git;a=blobdiff_plain;f=src%2Frpn2cql.c;h=18664428920ce8d867e216070e3c2670a8aeb7ae;hp=aef1cfd22def2c110b5a06ce7a06610baafbb49e;hb=b0be69c0a676f1702f12b2ea17cd73f9ebb08ea2;hpb=ed6736a60464a131d0edb37467c15cf010bc588f diff --git a/src/rpn2cql.c b/src/rpn2cql.c index aef1cfd..1866442 100644 --- a/src/rpn2cql.c +++ b/src/rpn2cql.c @@ -1,5 +1,5 @@ /* This file is part of the YAZ toolkit. - * Copyright (C) 1995-2011 Index Data + * Copyright (C) 1995-2012 Index Data * See the file LICENSE for details. */ /** @@ -192,11 +192,13 @@ static int rpn2cql_simple(cql_transform_t ct, Z_Term *term = apt->term; const char *sterm = 0; size_t lterm = 0; + Odr_int trunc = lookup_truncation(apt->attributes); + size_t i; wrbuf_rewind(w); ret = rpn2cql_attr(ct, apt->attributes, w); - switch(term->which) + switch (term->which) { case Z_Term_general: lterm = term->u.general->len; @@ -210,27 +212,16 @@ static int rpn2cql_simple(cql_transform_t ct, lterm = strlen(sterm); break; default: - ret = -1; cql_transform_set_error(ct, YAZ_BIB1_TERM_TYPE_UNSUPP, 0); + return -1; } - if (term) + if (trunc <= 3 || trunc == 100 || trunc == 102 || trunc == 104) { - size_t i; - int must_quote = 0; - Odr_int trunc = lookup_truncation(apt->attributes); - - if (trunc > 3 && trunc != 100 && trunc != 102) - { - cql_transform_set_error( - ct, YAZ_BIB1_UNSUPP_TRUNCATION_ATTRIBUTE, 0); - ret = -1; - } for (i = 0 ; i < lterm; i++) if (strchr(" ()=>u.complex->roperator; + Z_ProximityOperator *prox; int r; if (nested) @@ -301,7 +302,7 @@ static int rpn2cql_structure(cql_transform_t ct, break; case Z_Operator_prox: { pr(" prox", client_data); - Z_ProximityOperator *prox = op->u.prox; + prox = op->u.prox; /* No way to express Odr_bool *exclusion -- ignore it */ if (prox->distance) { char buf[21]; /* Enough for any 64-bit int */