X-Git-Url: http://git.indexdata.com/?p=yaz-moved-to-github.git;a=blobdiff_plain;f=ztest%2Fztest.c;h=0cf54d14bf8e580dbbe2d3ba348bee6a3eb0a371;hp=8011e0f8d24aeae9875ea62d6d855a651b00b244;hb=16cec0c7730f9ae5ce52a12a66d139e02cb806c0;hpb=c82f99e98f3b27c06d68eac02871a9b92486a89d diff --git a/ztest/ztest.c b/ztest/ztest.c index 8011e0f..0cf54d1 100644 --- a/ztest/ztest.c +++ b/ztest/ztest.c @@ -1,5 +1,5 @@ /* This file is part of the YAZ toolkit. - * Copyright (C) 1995-2009 Index Data + * Copyright (C) 1995-2010 Index Data * See the file LICENSE for details. */ @@ -52,14 +52,9 @@ static Odr_int get_term_hit(Z_RPNStructure *s) Odr_oct *oct = apt->term->u.general; if (oct->len > 0 && oct->buf[0] >= '0' && oct->buf[0] <= '9') { - char *endptr; WRBUF hits_str = wrbuf_alloc(); wrbuf_write(hits_str, (const char *) oct->buf, oct->len); -#ifdef WIN32 - h = _strtoui64(wrbuf_cstr(hits_str), &endptr, 10); -#else - h = strtoll(wrbuf_cstr(hits_str), &endptr, 10); -#endif + h = odr_atoi(wrbuf_cstr(hits_str)); wrbuf_destroy(hits_str); } } @@ -93,7 +88,7 @@ static Odr_int get_hit_count(Z_Query *q) return h; } -/** \brief checks if it's a dummy Slow database.. +/** \brief checks if it's a dummy Slow database \param basename database name to check \param association backend association (or NULL if not available) \retval 1 is slow database @@ -133,9 +128,11 @@ int ztest_search(void *handle, bend_search_rr *rr) rr->errcode = YAZ_BIB1_COMBI_OF_SPECIFIED_DATABASES_UNSUPP; return 0; } - /* Throw Database unavailable if other than Default or Slow */ + /* Allow Default, db.* and Slow */ if (!yaz_matchstr(rr->basenames[0], "Default")) ; /* Default is OK in our test */ + else if (!strncmp(rr->basenames[0], "db", 2)) + ; /* db.* is OK in our test */ else if (check_slow(rr->basenames[0], rr->association)) { rr->estimated_hit_count = 1; @@ -726,7 +723,7 @@ int ztest_scan(void *handle, bend_scan_rr *q) return 0; } len = q->term->term->u.general->len; - if (len >= sizeof(term)) + if (len >= (int ) sizeof(term)) len = sizeof(term)-1; memcpy(term, q->term->term->u.general->buf, len); term[len] = '\0';