From: Adam Dickmeiss Date: Thu, 15 Nov 2001 21:59:40 +0000 (+0000) Subject: Client prevents "present request out of range". X-Git-Tag: YAZ.1.8.3~7 X-Git-Url: http://sru.miketaylor.org.uk/?a=commitdiff_plain;h=15f2d80b134fa41e213f6328440d1a25f80efd97;p=yaz-moved-to-github.git Client prevents "present request out of range". --- diff --git a/zoom/zoom-c.c b/zoom/zoom-c.c index 59ba765..436fae9 100644 --- a/zoom/zoom-c.c +++ b/zoom/zoom-c.c @@ -1,5 +1,5 @@ /* - * $Id: zoom-c.c,v 1.7 2001-11-15 13:16:02 adam Exp $ + * $Id: zoom-c.c,v 1.8 2001-11-15 21:59:40 adam Exp $ * * ZOOM layer for C, connections, result sets, queries. */ @@ -442,6 +442,12 @@ static void Z3950_resultset_retrieve (Z3950_resultset r, c = r->connection; if (!c) return; + if (start >= r->size) + return; + + if (start + count > r->size) + count = r->size - start; + task = Z3950_connection_add_task (c, Z3950_TASK_RETRIEVE); task->u.resultset = r; Z3950_resultset_addref (r); diff --git a/zoom/zoomtst6.c b/zoom/zoomtst6.c index 910866d..a5a215c 100644 --- a/zoom/zoomtst6.c +++ b/zoom/zoomtst6.c @@ -1,5 +1,5 @@ /* - * $Id: zoomtst6.c,v 1.4 2001-11-15 08:58:29 adam Exp $ + * $Id: zoomtst6.c,v 1.5 2001-11-15 21:59:40 adam Exp $ * * Asynchronous multi-target client doing two searches */ @@ -16,7 +16,7 @@ static void display_records (const char *tname, Z3950_resultset r) int pos; printf ("%s: %d hits\n", tname, Z3950_resultset_size(r)); /* go through all records at target */ - for (pos = 0; pos < 20; pos++) + for (pos = 0; pos < 2; pos++) { Z3950_record rec = Z3950_resultset_record (r, pos); @@ -86,6 +86,14 @@ int main(int argc, char **argv) for (i = 0; i