From: Adam Dickmeiss Date: Thu, 18 Jun 2009 13:47:48 +0000 (+0200) Subject: Merge branch 'master' into longint X-Git-Tag: v3.0.47~2 X-Git-Url: http://git.indexdata.com/?p=yaz-moved-to-github.git;a=commitdiff_plain;h=e709ab8b395212d2d3d12ad215a3aa2272654c62;hp=8356ea58313ee1f350226172cf99bfb0b7c5583c Merge branch 'master' into longint --- diff --git a/client/client.c b/client/client.c index 0cf0cad..732acfc 100644 --- a/client/client.c +++ b/client/client.c @@ -760,7 +760,7 @@ int cmd_authentication(const char *arg) } else if (r == 1) { - auth = nmem_malloc(nmem_auth, sizeof(*auth)); + auth = (Z_IdAuthentication *) nmem_malloc(nmem_auth, sizeof(*auth)); if (!strcmp(args[0], "-")) { auth->which = Z_IdAuthentication_anonymous; @@ -776,9 +776,10 @@ int cmd_authentication(const char *arg) } else if (r == 2) { - auth = nmem_malloc(nmem_auth, sizeof(*auth)); + auth = (Z_IdAuthentication *) nmem_malloc(nmem_auth, sizeof(*auth)); auth->which = Z_IdAuthentication_idPass; - auth->u.idPass = nmem_malloc(nmem_auth, sizeof(*auth->u.idPass)); + auth->u.idPass = (Z_IdPass *) + nmem_malloc(nmem_auth, sizeof(*auth->u.idPass)); auth->u.idPass->groupId = NULL; auth->u.idPass->userId = !strcmp(args[0], "-") ? 0 : args[0]; auth->u.idPass->password = !strcmp(args[1], "-") ? 0 : args[1]; @@ -787,9 +788,10 @@ int cmd_authentication(const char *arg) } else if (r == 3) { - auth = nmem_malloc(nmem_auth, sizeof(*auth)); + auth = (Z_IdAuthentication*) nmem_malloc(nmem_auth, sizeof(*auth)); auth->which = Z_IdAuthentication_idPass; - auth->u.idPass = nmem_malloc(nmem_auth, sizeof(*auth->u.idPass)); + auth->u.idPass = (Z_IdPass *) + nmem_malloc(nmem_auth, sizeof(*auth->u.idPass)); auth->u.idPass->groupId = args[1]; auth->u.idPass->userId = args[0]; auth->u.idPass->password = args[2]; diff --git a/src/cql.y b/src/cql.y index c6151a2..25a4287 100644 --- a/src/cql.y +++ b/src/cql.y @@ -53,7 +53,7 @@ %} %pure_parser -%token DOTTERM TERM AND OR NOT PROX GE LE NE EXACT +%token DOTTERM TERM AND OR NOT PROX GE LE NE EXACT SORTBY %% @@ -61,12 +61,20 @@ top: { $$.rel = cql_node_mk_sc(((CQL_parser) parm)->nmem, "cql.serverChoice", "=", 0); ((CQL_parser) parm)->top = 0; -} cqlQuery1 { +} cqlQuery1 sortby { cql_node_destroy($$.rel); ((CQL_parser) parm)->top = $2.cql; } ; +sortby: /* empty */ +| SORTBY sortSpec; + +sortSpec: sortSpec singleSpec +| singleSpec; + +singleSpec: index modifiers ; + cqlQuery1: cqlQuery | cqlQuery error { cql_node_destroy($1.cql); @@ -203,6 +211,7 @@ searchTerm: | OR | NOT | PROX +| SORTBY ; %% @@ -358,6 +367,11 @@ int yylex(YYSTYPE *lval, void *vp) lval->buf = "prox"; return PROX; } + if (!cql_strcmp(lval->buf, "sortby")) + { + lval->buf = "sortby"; + return SORTBY; + } if (!cql_strcmp(lval->buf, "all")) relation_like = 1; if (!cql_strcmp(lval->buf, "any")) diff --git a/src/xmalloc.c b/src/xmalloc.c index 7042079..d4e2300 100644 --- a/src/xmalloc.c +++ b/src/xmalloc.c @@ -348,7 +348,7 @@ char *xstrndup_f(const char *s, size_t n, const char *file, int line) if (l < n) return xstrdup_f(s, file, line); { - char *a = xmalloc_f(n+1, file, line); + char *a = (char*) xmalloc_f(n+1, file, line); memcpy(a, s, n); a[n] = '\0'; return a; diff --git a/test/tstxmalloc.c b/test/tstxmalloc.c index 4d5f8e5..c43e265 100644 --- a/test/tstxmalloc.c +++ b/test/tstxmalloc.c @@ -16,9 +16,9 @@ void tst(void) { char *p = 0; - p = xmalloc(10); + p = (char *) xmalloc(10); YAZ_CHECK(p); - p = xrealloc(p, 20); + p = (char *) xrealloc(p, 20); YAZ_CHECK(p); xfree(p);