From: Adam Dickmeiss Date: Fri, 4 Dec 2009 10:59:54 +0000 (+0100) Subject: ZOOM: use size_t for scan hit counts and str size X-Git-Tag: v4.0.0~85 X-Git-Url: http://jsfdemo.indexdata.com/cgi-bin?a=commitdiff_plain;h=5207f60678397943900b4e5f41d563335bf745d1;p=yaz-moved-to-github.git ZOOM: use size_t for scan hit counts and str size Functions ZOOM_scanset_term and ZOOM_scanset_display_term have changed, so that occ (hit count) and len (string length) are now of type size_t pointer rather than int pointer. This is to be able to represent large hit counts and to also just to use the proper type for string length (strlen result). --- diff --git a/include/yaz/zoom.h b/include/yaz/zoom.h index e577d35..fc1a848 100644 --- a/include/yaz/zoom.h +++ b/include/yaz/zoom.h @@ -251,11 +251,11 @@ ZOOM_connection_scan1(ZOOM_connection c, ZOOM_query startterm); ZOOM_API(const char *) ZOOM_scanset_term(ZOOM_scanset scan, size_t pos, - int *occ, int *len); + size_t *occ, size_t *len); ZOOM_API(const char *) ZOOM_scanset_display_term(ZOOM_scanset scan, size_t pos, - int *occ, int *len); + size_t *occ, size_t *len); ZOOM_API(size_t) ZOOM_scanset_size(ZOOM_scanset scan); diff --git a/src/zoom-c.c b/src/zoom-c.c index 5179a84..4ce6e2b 100644 --- a/src/zoom-c.c +++ b/src/zoom-c.c @@ -2911,7 +2911,7 @@ ZOOM_API(size_t) } static void ZOOM_scanset_term_x(ZOOM_scanset scan, size_t pos, - int *occ, + size_t *occ, const char **value_term, size_t *value_len, const char **disp_term, size_t *disp_len) { @@ -2969,7 +2969,7 @@ static void ZOOM_scanset_term_x(ZOOM_scanset scan, size_t pos, ZOOM_API(const char *) ZOOM_scanset_term(ZOOM_scanset scan, size_t pos, - int *occ, int *len) + size_t *occ, size_t *len) { const char *value_term = 0; size_t value_len = 0; @@ -2985,7 +2985,7 @@ ZOOM_API(const char *) ZOOM_API(const char *) ZOOM_scanset_display_term(ZOOM_scanset scan, size_t pos, - int *occ, int *len) + size_t *occ, size_t *len) { const char *value_term = 0; size_t value_len = 0; diff --git a/zoom/zoomsh.c b/zoom/zoomsh.c index 1bff1d4..01c8e1a 100644 --- a/zoom/zoomsh.c +++ b/zoom/zoomsh.c @@ -12,8 +12,6 @@ #include #include -#include - #if HAVE_READLINE_READLINE_H #include #endif @@ -21,10 +19,7 @@ #include #endif -#include - #include -#include #include #define MAX_CON 100 @@ -382,8 +377,8 @@ static void cmd_search(ZOOM_connection *c, ZOOM_resultset *r, int start = ZOOM_options_get_int(options, "start", 0); int count = ZOOM_options_get_int(options, "count", 0); - printf("%s: %ld hits\n", ZOOM_connection_option_get(c[i], "host"), - (long) ZOOM_resultset_size(r[i])); + printf("%s: %lld hits\n", ZOOM_connection_option_get(c[i], "host"), + (long long int) ZOOM_resultset_size(r[i])); /* and display */ display_records(c[i], r[i], start, count, "render"); } @@ -439,12 +434,11 @@ static void cmd_scan(ZOOM_connection *c, ZOOM_resultset *r, size_t p, sz = ZOOM_scanset_size(s[i]); for (p = 0; p < sz; p++) { - int occ = 0; - int len = 0; + size_t occ = 0; + size_t len = 0; const char *term = ZOOM_scanset_display_term(s[i], p, &occ, &len); - - printf("%.*s %d\n", len, term, occ); + printf("%.*s %lld\n", (int) len, term, (long long int) occ); } ZOOM_scanset_destroy(s[i]); }