* Copyright (c) 1995-2003, Index Data
* See the file LICENSE for details.
*
- * $Id: seshigh.c,v 1.155 2003-04-29 21:20:33 adam Exp $
+ * $Id: seshigh.c,v 1.160 2003-07-16 21:02:06 adam Exp $
*/
/*
odr_setbuf(assoc->decode, assoc->input_buffer, res, 0);
if (!z_GDU(assoc->decode, &req->gdu_request, 0, 0))
{
- yaz_log(LOG_LOG, "ODR error on incoming PDU: %s [near byte %d] ",
+ yaz_log(LOG_LOG, "ODR error on incoming PDU: %s [element %s] "
+ "[near byte %d] ",
odr_errmsg(odr_geterror(assoc->decode)),
+ odr_getelement(assoc->decode),
odr_offset(assoc->decode));
if (assoc->decode->error != OHTTP)
{
}
else
{
+ int number = srw_req->maximumRecords ? *srw_req->maximumRecords : 0;
+ int start = srw_req->startRecord ? *srw_req->startRecord : 1;
+
+ yaz_log(LOG_LOG, "Request to pack %d+%d out of %d",
+ start, number, rr.hits);
+
srw_res->numberOfRecords = odr_intdup(assoc->encode, rr.hits);
- if (srw_req->maximumRecords && *srw_req->maximumRecords > 0)
+ if (number > 0)
{
- int number = *srw_req->maximumRecords;
- int start = 1;
int i;
- if (srw_req->startRecord)
- start = *srw_req->startRecord;
-
- yaz_log(LOG_DEBUG, "srw_bend_search. start=%d max=%d",
- start, *srw_req->maximumRecords);
-
- if (start <= rr.hits)
+ if (start > rr.hits)
+ {
+ yaz_log(LOG_LOG, "Request out or range");
+ }
+ else
{
int j = 0;
int packing = Z_SRW_recordPacking_string;
const char *p1 = strchr(path, '=');
if (!p1)
break;
- if (p1 - path == nlen && !memcmp(path, name, nlen))
+ if ((size_t)(p1 - path) == nlen && !memcmp(path, name, nlen))
{
size_t i = 0;
char *ret;
}
if (!z_GDU(assoc->encode, &res, 0, 0))
{
- yaz_log(LOG_WARN, "ODR error when encoding response: %s",
- odr_errmsg(odr_geterror(assoc->decode)));
+ yaz_log(LOG_WARN, "ODR error when decoding PDU: %s [element %s]",
+ odr_errmsg(odr_geterror(assoc->decode)),
+ odr_getelement(assoc->decode));
return -1;
}
req->response = odr_getbuf(assoc->encode, &req->len_response,
res->num_diagnostics = 0;
res->diagnostics = 0;
}
+ res->resultCount = 0;
res->otherInfo = 0;
apdu->which = Z_APDU_sortResponse;