From: Adam Dickmeiss Date: Mon, 21 Jul 2008 18:00:57 +0000 (+0200) Subject: Fixed record offset in handling of raw records X-Git-Tag: v1.1.0~144 X-Git-Url: http://sru.miketaylor.org.uk/?a=commitdiff_plain;h=1e5689c5a9f91720b5fc779d9c7485f37b3dfdac;p=pazpar2-moved-to-github.git Fixed record offset in handling of raw records --- diff --git a/src/client.c b/src/client.c index c978474..603ee21 100644 --- a/src/client.c +++ b/src/client.c @@ -430,23 +430,27 @@ void client_record_response(struct client *cl) } else { - ZOOM_record rec; - int offset = cl->records; + ZOOM_record rec = 0; const char *msg, *addinfo; - - if ((rec = ZOOM_resultset_record(resultset, offset))) + + yaz_log(YLOG_LOG, "show_raw=%p show_raw->active=%d", + cl->show_raw, cl->show_raw ? cl->show_raw->active : 0); + if (cl->show_raw && cl->show_raw->active) { - yaz_log(YLOG_LOG, "Record with offset %d", offset); - - yaz_log(YLOG_LOG, "show_raw=%p show_raw->active=%d", - cl->show_raw, cl->show_raw ? cl->show_raw->active : 0); - if (cl->show_raw && cl->show_raw->active) + if ((rec = ZOOM_resultset_record(resultset, + cl->show_raw->position-1))) { cl->show_raw->active = 0; ingest_raw_record(cl, rec); } - else + } + else + { + int offset = cl->records; + if ((rec = ZOOM_resultset_record(resultset, offset))) { + yaz_log(YLOG_LOG, "Record with offset %d", offset); + cl->records++; if (ZOOM_record_error(rec, &msg, &addinfo, 0)) yaz_log(YLOG_WARN, "Record error %s (%s): %s (rec #%d)", @@ -479,7 +483,7 @@ void client_record_response(struct client *cl) } } - else + if (!rec) yaz_log(YLOG_WARN, "Expected record, but got NULL"); } }