X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=src%2Fseshigh.c;h=7c018869602313dc586f888e30dbbed521d4c416;hb=3b792849c676d96918850e2f1e0af87a75278501;hp=46e62102c1786b364d31204d71938d1da93dfe78;hpb=c0858501c14e5b74a62656042dc6c8ad6a2a242c;p=yaz-moved-to-github.git diff --git a/src/seshigh.c b/src/seshigh.c index 46e6210..7c01886 100644 --- a/src/seshigh.c +++ b/src/seshigh.c @@ -2,7 +2,7 @@ * Copyright (C) 1995-2007, Index Data ApS * See the file LICENSE for details. * - * $Id: seshigh.c,v 1.125 2007-08-21 13:20:51 adam Exp $ + * $Id: seshigh.c,v 1.128 2007-09-11 08:37:53 adam Exp $ */ /** * \file seshigh.c @@ -767,10 +767,7 @@ static int srw_bend_fetch(association *assoc, int pos, record->recordData_buf = rr.record; record->recordData_len = rr.len; record->recordPosition = odr_intdup(o, pos); - if (rr.schema) - record->recordSchema = odr_strdup(o, rr.schema); - else - record->recordSchema = 0; + record->recordSchema = odr_strdup_null(o, rr.schema); } if (rr.errcode) { @@ -1801,8 +1798,8 @@ static void process_http_request(association *assoc, request *req) if (sr->which == Z_SRW_searchRetrieve_request) { Z_SRW_PDU *res = - yaz_srw_get(assoc->encode, Z_SRW_searchRetrieve_response); - + yaz_srw_get_pdu(assoc->encode, Z_SRW_searchRetrieve_response, + sr->srw_version); stylesheet = sr->u.request->stylesheet; if (num_diagnostic) { @@ -1819,7 +1816,8 @@ static void process_http_request(association *assoc, request *req) } else if (sr->which == Z_SRW_explain_request) { - Z_SRW_PDU *res = yaz_srw_get(o, Z_SRW_explain_response); + Z_SRW_PDU *res = yaz_srw_get_pdu(o, Z_SRW_explain_response, + sr->srw_version); stylesheet = sr->u.explain_request->stylesheet; if (num_diagnostic) { @@ -1833,7 +1831,8 @@ static void process_http_request(association *assoc, request *req) } else if (sr->which == Z_SRW_scan_request) { - Z_SRW_PDU *res = yaz_srw_get(o, Z_SRW_scan_response); + Z_SRW_PDU *res = yaz_srw_get_pdu(o, Z_SRW_scan_response, + sr->srw_version); stylesheet = sr->u.scan_request->stylesheet; if (num_diagnostic) { @@ -1847,7 +1846,8 @@ static void process_http_request(association *assoc, request *req) } else if (sr->which == Z_SRW_update_request) { - Z_SRW_PDU *res = yaz_srw_get(o, Z_SRW_update_response); + Z_SRW_PDU *res = yaz_srw_get_pdu(o, Z_SRW_update_response, + sr->srw_version); yaz_log(YLOG_DEBUG, "handling SRW UpdateRequest"); if (num_diagnostic) { @@ -2377,7 +2377,7 @@ static Z_APDU *process_initRequest(association *assoc, request *reqb) assoc->init->implementation_name, odr_prepend(assoc->encode, "GFS", resp->implementationName)); - version = odr_strdup(assoc->encode, "$Revision: 1.125 $"); + version = odr_strdup(assoc->encode, "$Revision: 1.128 $"); if (strlen(version) > 10) /* check for unexpanded CVS strings */ version[strlen(version)-2] = '\0'; resp->implementationVersion = odr_prepend(assoc->encode, @@ -2620,10 +2620,7 @@ static Z_Records *pack_records(association *a, char *setname, int start, if (!(thisrec = (Z_NamePlusRecord *) odr_malloc(a->encode, sizeof(*thisrec)))) return 0; - if (freq.basename) - thisrec->databaseName = odr_strdup(a->encode, freq.basename); - else - thisrec->databaseName = 0; + thisrec->databaseName = odr_strdup_null(a->encode, freq.basename); thisrec->which = Z_NamePlusRecord_databaseRecord; if (!freq.output_format) @@ -3051,7 +3048,9 @@ static Z_APDU *process_scanRequest(association *assoc, request *reqb, int *fd) /* For YAZ 2.0 and earlier it was the backend handler that initialized entries (member display_term did not exist) YAZ 2.0 and later sets 'entries' and initialize all members - including 'display_term'. + including 'display_term'. If YAZ 2.0 or later sees that + entries was modified - we assume that it is an old handler and + that 'display_term' is _not_ set. */ if (bsrr->num_entries > 0) { @@ -3110,8 +3109,13 @@ static Z_APDU *process_scanRequest(association *assoc, request *reqb, int *fd) odr_malloc(assoc->encode, sizeof(*t)); t->suggestedAttributes = 0; t->displayTerm = 0; - if (bsrr->entries[i].display_term) + if (save_entries == bsrr->entries && + bsrr->entries[i].display_term) { + /* the entries was _not_ set by the handler. So it's + safe to test for new member display_term. It is + NULL'ed by us. + */ t->displayTerm = odr_strdup(assoc->encode, bsrr->entries[i].display_term); }