From: Adam Dickmeiss Date: Mon, 29 Aug 2011 10:33:30 +0000 (+0200) Subject: cql2ccl: fix handling of \\ X-Git-Tag: v4.2.13~7 X-Git-Url: http://sru.miketaylor.org.uk/cgi-bin?a=commitdiff_plain;h=f7a3b7f177753fbe82a172efc1b61d59141991ae;p=yaz-moved-to-github.git cql2ccl: fix handling of \\ --- diff --git a/src/cql2ccl.c b/src/cql2ccl.c index 54b16e7..99c90c4 100644 --- a/src/cql2ccl.c +++ b/src/cql2ccl.c @@ -4,7 +4,7 @@ */ /** * \file cql2ccl.c - * \brief Implements CQL to XCQL conversion. + * \brief Implements CQL to CCL conversion. */ #if HAVE_CONFIG_H #include @@ -45,13 +45,10 @@ static void pr_term(struct cql_node *cn, } cp++; if (*cp == '\"' || *cp == '\\') - pr("\\\"", client_data); - else - { - x[0] = *cp; - x[1] = '\0'; - pr(x, client_data); - } + pr("\\", client_data); + x[0] = *cp; + x[1] = '\0'; + pr(x, client_data); } else if (*cp == '*') { @@ -214,7 +211,7 @@ static int bool(struct cql_node *cn, if (!strcmp(n->u.st.relation, "<=")) distance = atoi(n->u.st.term); else if (!strcmp(n->u.st.relation, "<")) - distance = atoi(n->u.st.term) - 1; + distance = atoi(n->u.st.term) - 1; else return -1; } diff --git a/test/test_cql2ccl.c b/test/test_cql2ccl.c index cd1547b..6426d87 100644 --- a/test/test_cql2ccl.c +++ b/test/test_cql2ccl.c @@ -77,8 +77,9 @@ static void tst(void) YAZ_CHECK(tst_query("a b", "\"a\" \"b\"")); YAZ_CHECK(tst_query("ab bc", "\"ab\" \"bc\"")); - YAZ_CHECK(tst_query("\\\\", "\"\\\"\"")); - YAZ_CHECK(tst_query("\\\"", "\"\\\"\"")); + YAZ_CHECK(tst_query("\\\\", "\"\\\\\"")); + YAZ_CHECK(tst_query("\\\"", "\"\\\"\"")); + YAZ_CHECK(tst_query("\\x" , "\"x\"")); YAZ_CHECK(tst_query("\\*", "\"*\"")); YAZ_CHECK(tst_query("\"\\*\"", "\"*\""));