X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=ztest%2Fztest.c;h=7d2f90b9c2a2cdc03c63f69b814071bcbbbcba11;hb=2ce9902d5541bf71521587a073a9c09d36d4c3da;hp=c95c4718abf5feeb6b68f268f0fffde1182ed4b4;hpb=6e3d70edfadd110351b71466c51632e288e31773;p=yaz-moved-to-github.git diff --git a/ztest/ztest.c b/ztest/ztest.c index c95c471..7d2f90b 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. */ @@ -38,9 +38,9 @@ int ztest_delete(void *handle, bend_delete_rr *rr); Only terms that looks a numeric is used.. Returns -1 if no sub tree has a hit count term */ -static int get_term_hit(Z_RPNStructure *s) +static Odr_int get_term_hit(Z_RPNStructure *s) { - int h = -1; + Odr_int h = -1; switch(s->which) { case Z_RPNStructure_simple: @@ -51,7 +51,12 @@ static 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') - h = atoi_n((const char *) oct->buf, oct->len); + { + WRBUF hits_str = wrbuf_alloc(); + wrbuf_write(hits_str, (const char *) oct->buf, oct->len); + h = odr_atoi(wrbuf_cstr(hits_str)); + wrbuf_destroy(hits_str); + } } } break; @@ -73,9 +78,9 @@ static int get_term_hit(Z_RPNStructure *s) have a way to trigger a certain hit count. Good for testing of client applications etc */ -static int get_hit_count(Z_Query *q) +static Odr_int get_hit_count(Z_Query *q) { - int h = -1; + Odr_int h = -1; if (q->which == Z_Query_type_1 || q->which == Z_Query_type_101) h = get_term_hit(q->u.type_1->RPNStructure); if (h == -1) @@ -83,7 +88,7 @@ static 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 @@ -716,7 +721,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';