From 7571b40f44e348f1b7d14f8747c9168bbd538444 Mon Sep 17 00:00:00 2001 From: Adam Dickmeiss Date: Thu, 3 Dec 2009 09:37:05 +0100 Subject: [PATCH] yaz-ztest: fake hits based on Odr_int (not int) --- ztest/ztest.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/ztest/ztest.c b/ztest/ztest.c index c95c471..3bb4886 100644 --- a/ztest/ztest.c +++ b/ztest/ztest.c @@ -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,13 @@ 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); + { + char *endptr; + WRBUF hits_str = wrbuf_alloc(); + wrbuf_write(hits_str, (const char *) oct->buf, oct->len); + h = strtoll(wrbuf_cstr(hits_str), &endptr, 10); + wrbuf_destroy(hits_str); + } } } break; @@ -73,9 +79,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) -- 1.7.10.4