From 3ee948d799b9207fd02662bcb66b1d8848da48f6 Mon Sep 17 00:00:00 2001 From: Adam Dickmeiss Date: Tue, 17 Apr 2007 07:55:02 +0000 Subject: [PATCH] Updated for YAZ 3. --- Makefile.PL | 4 ++-- SimpleServer.xs | 24 ++++++++++++------------ 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/Makefile.PL b/Makefile.PL index 0e7f1a1..7972e3b 100644 --- a/Makefile.PL +++ b/Makefile.PL @@ -1,6 +1,6 @@ use ExtUtils::MakeMaker; -## $Id: Makefile.PL,v 1.12 2006-08-08 16:25:37 mike Exp $ +## $Id: Makefile.PL,v 1.13 2007-04-17 07:55:02 adam Exp $ my $yazconf = "yaz-config"; my $yazver = `$yazconf --version`; @@ -18,7 +18,7 @@ SimpleServer module. chomp($yazver); my ($major, $minor, $trivial) = split(/\./, $yazver); # YAZ 2.1.14 is the first to propagate SRW/U addinfo correctly -my ($needMaj, $needMin, $needTriv) = (2, 1, 24); +my ($needMaj, $needMin, $needTriv) = (2, 1, 99); #print "major=$major, minor=$minor, trivial=$trivial\n"; die "You have YAZ version $major.$minor.$trivial; " . "you need $needMaj.$needMin.$needTriv or better." diff --git a/SimpleServer.xs b/SimpleServer.xs index 9fab581..54d61f8 100644 --- a/SimpleServer.xs +++ b/SimpleServer.xs @@ -1,5 +1,5 @@ /* - * $Id: SimpleServer.xs,v 1.56 2007-03-05 11:47:16 mike Exp $ + * $Id: SimpleServer.xs,v 1.57 2007-04-17 07:55:02 adam Exp $ * ---------------------------------------------------------------------- * * Copyright (c) 2000-2004, Index Data. @@ -461,7 +461,7 @@ int simpleserver_ExpandSortAttributes (HV *sort_spec, Z_SortAttributes *sattr) oid2str(sattr->id, attrset_wr); hv_store(sort_spec, "ATTRSET", 7, newSVpv(attrset_wr->buf, attrset_wr->pos), 0); - wrbuf_free(attrset_wr, 1); + wrbuf_destroy(attrset_wr); hv_store(sort_spec, "SORT_ATTR", 9, newRV( sv_2mortal( (SV*) list ) ), 0); @@ -518,7 +518,7 @@ int simpleserver_SortKeySpecToHash (HV *sort_spec, Z_SortKeySpec *spec) oid2str(zspec->schema.oid, elementSpec); hv_store(sort_spec, "ELEMENTSPEC_VALUE", 17, newSVpv(elementSpec->buf, elementSpec->pos), 0); - wrbuf_free(elementSpec, 1); + wrbuf_destroy(elementSpec); } else if (zspec->which == Z_Schema_uri) { @@ -759,7 +759,7 @@ int bend_search(void *handle, bend_search_rr *rr) sv_free( (SV*) aref); sv_free( (SV*) href); if (query) - wrbuf_free(query, 1); + wrbuf_destroy(query); PUTBACK; FREETMPS; LEAVE; @@ -850,7 +850,6 @@ int bend_fetch(void *handle, bend_fetch_rr *rr) char *ODR_basename; char *ODR_errstr; int *ODR_oid_buf; - oident *oid; WRBUF oid_dotted; Zfront_handle *zhandle = (Zfront_handle *)handle; CV* handler_cv = 0; @@ -870,8 +869,8 @@ int bend_fetch(void *handle, bend_fetch_rr *rr) if (rr->schema) hv_store(href, "SCHEMA", 6, newSVpv(rr->schema, 0), 0); temp = hv_store(href, "OFFSET", 6, newSViv(rr->number), 0); - if (rr->request_format_raw != 0) { - oid_dotted = oid2dotted(rr->request_format_raw); + if (rr->request_format != 0) { + oid_dotted = oid2dotted(rr->request_format); } else { /* Probably an SRU request: assume XML is required */ oid_dotted = wrbuf_alloc(); @@ -985,16 +984,17 @@ int bend_fetch(void *handle, bend_fetch_rr *rr) rr->basename = ODR_basename; ptr = SvPV(rep_form, length); + ODR_oid_buf = (int *)odr_malloc(rr->stream, (MAX_OID + 1) * sizeof(int)); - if (dotted2oid(ptr, ODR_oid_buf) == -1) /* Maximum number of OID elements exceeded */ + if (oid_dotstring_to_oid(ptr, ODR_oid_buf)) { printf("Net::Z3950::SimpleServer: WARNING: OID structure too long, max length is %d\n", MAX_OID); } - rr->output_format_raw = ODR_oid_buf; + rr->output_format = ODR_oid_buf; ptr = SvPV(record, length); - oid = oid_getentbyoid(ODR_oid_buf); - if (oid->value == VAL_GRS1) /* Treat GRS-1 records separately */ + /* Treat GRS-1 records separately */ + if (!oid_oidcmp(ODR_oid_buf, yaz_oid_recsyn_grs_1)) { rr->record = (char *) read_grs1(ptr, rr->stream); rr->len = -1; @@ -1020,7 +1020,7 @@ int bend_fetch(void *handle, bend_fetch_rr *rr) } rr->surrogate_flag = SvIV(sur_flag); - wrbuf_free(oid_dotted, 1); + wrbuf_destroy(oid_dotted); sv_free((SV*) href); sv_free(basename); sv_free(record); -- 1.7.10.4