From 31f6b164fd451ef9254545a38e7b6ffc1543854f Mon Sep 17 00:00:00 2001 From: Adam Dickmeiss Date: Tue, 1 Dec 2009 22:24:02 +0100 Subject: [PATCH] Use Odr_int type for hit counts Use the Odr_int type for hit counts. This is part of YAZ 3.0.47 and later and so configure checks for that. --- configure.ac | 2 +- src/client.c | 4 ++-- src/client.h | 2 +- src/http_command.c | 11 ++++++----- src/logic.c | 2 +- src/pazpar2.h | 8 ++++---- 6 files changed, 15 insertions(+), 14 deletions(-) diff --git a/configure.ac b/configure.ac index a639532..1f708b8 100644 --- a/configure.ac +++ b/configure.ac @@ -21,7 +21,7 @@ AC_LANG(C) AC_C_INLINE -YAZ_INIT([static icu threads],[3.0.46]) +YAZ_INIT([static icu threads],[3.0.47]) if test -z "$YAZLIB"; then AC_MSG_ERROR([YAZ development libraries missing]) fi diff --git a/src/client.c b/src/client.c index e70a08e..97c03af 100644 --- a/src/client.c +++ b/src/client.c @@ -72,7 +72,7 @@ struct client { struct session *session; char *pquery; // Current search char *cqlquery; // used for SRU targets only - int hits; + Odr_int hits; int record_offset; int maxrecs; int startrecs; @@ -785,7 +785,7 @@ struct client *client_next_in_session(struct client *cl) } -int client_get_hits(struct client *cl) +Odr_int client_get_hits(struct client *cl) { return cl->hits; } diff --git a/src/client.h b/src/client.h index 35a28d9..eabaa83 100644 --- a/src/client.h +++ b/src/client.h @@ -79,7 +79,7 @@ int client_is_active(struct client *cl); struct client *client_next_in_session(struct client *cl); int client_parse_query(struct client *cl, const char *query); -int client_get_hits(struct client *cl); +Odr_int client_get_hits(struct client *cl); int client_get_num_records(struct client *cl); int client_get_diagnostic(struct client *cl); void client_set_diagnostic(struct client *cl, int diagnostic); diff --git a/src/http_command.c b/src/http_command.c index 752c329..9989ac8 100644 --- a/src/http_command.c +++ b/src/http_command.c @@ -379,7 +379,8 @@ static void targets_termlist(WRBUF wrbuf, struct session *se, int num, wrbuf_xmlputs(wrbuf, ht[i].name); wrbuf_puts(wrbuf, "\n"); - wrbuf_printf(wrbuf, "%d\n", ht[i].hits); + wrbuf_printf(wrbuf, "" ODR_INT_PRINTF "\n", + ht[i].hits); wrbuf_puts(wrbuf, ""); wrbuf_xmlputs(wrbuf, ht[i].state); @@ -496,7 +497,7 @@ static void cmd_bytarget(struct http_channel *c) wrbuf_puts(c->wrbuf, "\n"); } - wrbuf_printf(c->wrbuf, "%d\n", ht[i].hits); + wrbuf_printf(c->wrbuf, "" ODR_INT_PRINTF "\n", ht[i].hits); wrbuf_printf(c->wrbuf, "%d\n", ht[i].diagnostic); wrbuf_printf(c->wrbuf, "%d\n", ht[i].records); @@ -747,7 +748,7 @@ static void show_records(struct http_channel *c, int active) int startn = 0; int numn = 20; int total; - int total_hits; + Odr_int total_hits; int i; if (!s) @@ -775,7 +776,7 @@ static void show_records(struct http_channel *c, int active) wrbuf_puts(c->wrbuf, HTTP_COMMAND_RESPONSE_PREFIX "\nOK\n"); wrbuf_printf(c->wrbuf, "%d\n", active); wrbuf_printf(c->wrbuf, "%d\n", total); - wrbuf_printf(c->wrbuf, "%d\n", total_hits); + wrbuf_printf(c->wrbuf, "" ODR_INT_PRINTF "\n", total_hits); wrbuf_printf(c->wrbuf, "%d\n", startn); wrbuf_printf(c->wrbuf, "%d\n", numn); @@ -936,7 +937,7 @@ static void cmd_stat(struct http_channel *c) wrbuf_rewind(c->wrbuf); wrbuf_puts(c->wrbuf, HTTP_COMMAND_RESPONSE_PREFIX ""); wrbuf_printf(c->wrbuf, "%d\n", clients); - wrbuf_printf(c->wrbuf, "%d\n", stat.num_hits); + wrbuf_printf(c->wrbuf, "" ODR_INT_PRINTF "\n", stat.num_hits); wrbuf_printf(c->wrbuf, "%d\n", stat.num_records); wrbuf_printf(c->wrbuf, "%d\n", stat.num_clients); wrbuf_printf(c->wrbuf, "%d\n", stat.num_no_connection); diff --git a/src/logic.c b/src/logic.c index c07d303..57f36b4 100644 --- a/src/logic.c +++ b/src/logic.c @@ -719,7 +719,7 @@ struct record_cluster *show_single(struct session *s, const char *id, } struct record_cluster **show(struct session *s, struct reclist_sortparms *sp, - int start, int *num, int *total, int *sumhits, + int start, int *num, int *total, Odr_int *sumhits, NMEM nmem_show) { struct record_cluster **recs = nmem_malloc(nmem_show, *num diff --git a/src/pazpar2.h b/src/pazpar2.h index 158e2fb..6c4faae 100644 --- a/src/pazpar2.h +++ b/src/pazpar2.h @@ -110,7 +110,7 @@ struct session { struct relevance *relevance; struct reclist *reclist; struct session_watchentry watchlist[SESSION_WATCH_MAX + 1]; - int total_hits; + Odr_int total_hits; int total_records; int total_merged; int number_of_warnings_unknown_elements; @@ -126,14 +126,14 @@ struct statistics { int num_idle; int num_failed; int num_error; - int num_hits; + Odr_int num_hits; int num_records; }; struct hitsbytarget { char *id; const char *name; - int hits; + Odr_int hits; int diagnostic; int records; const char *state; @@ -151,7 +151,7 @@ enum pazpar2_error_code search(struct session *s, const char *query, const char *startrecs, const char *maxrecs, const char *filter, const char **addinfo); struct record_cluster **show(struct session *s, struct reclist_sortparms *sp, int start, - int *num, int *total, int *sumhits, NMEM nmem_show); + int *num, int *total, Odr_int *sumhits, NMEM nmem_show); struct record_cluster *show_single(struct session *s, const char *id, struct record_cluster **prev_r, struct record_cluster **next_r); -- 1.7.10.4