X-Git-Url: http://git.indexdata.com/?p=idzebra-moved-to-github.git;a=blobdiff_plain;f=data1%2Fd1_doespec.c;h=6600a8a621e441698ae23d044699bb8dc2fbfe6e;hp=c00cc90e114d3a632bd68a23f46b1c5b279e477f;hb=c3ff843e467932c6027a8b3b2ebda7b44612447e;hpb=1872e3fc60b482771bbd1cb4b0290b8d6a9ef5d0 diff --git a/data1/d1_doespec.c b/data1/d1_doespec.c index c00cc90..6600a8a 100644 --- a/data1/d1_doespec.c +++ b/data1/d1_doespec.c @@ -1,8 +1,5 @@ -/* $Id: d1_doespec.c,v 1.13 2007-04-16 08:44:31 adam Exp $ - Copyright (C) 1995-2007 - Index Data ApS - -This file is part of the Zebra server. +/* This file is part of the Zebra server. + Copyright (C) Index Data Zebra is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free @@ -22,9 +19,12 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA /** \file d1_doespec.c * \brief handle Z39.50 variant-1 specs - * + * * See http://www.loc.gov/z3950/agency/defns/variant1.html */ +#if HAVE_CONFIG_H +#include +#endif #include #include @@ -50,17 +50,17 @@ static int match_children_wildpath(data1_handle dh, data1_node *n, * set is the set to look for, universal set is the set that applies to a * triple with an unknown set. */ -static Z_Triple *find_triple(Z_Variant *var, const int *universal_oid, - const int *var_oid, int zclass, int type) +static Z_Triple *find_triple(Z_Variant *var, const Odr_oid *universal_oid, + const Odr_oid *var_oid, int zclass, int type) { int i; for (i = 0; i < var->num_triples; i++) { - const int *cur_oid = var->triples[i]->variantSetId; + const Odr_oid *cur_oid = var->triples[i]->variantSetId; if (!cur_oid) cur_oid = var->globalVariantSetId; - if (cur_oid && var_oid + if (cur_oid && var_oid && !oid_oidcmp(var_oid, cur_oid) && *var->triples[i]->type == type) return var->triples[i]; } @@ -107,8 +107,8 @@ static void mark_subtree(data1_node *n, int make_variantlist, int no_data, static void match_triple(data1_handle dh, Z_Variant *vreq, - const int *def_oid, - const int *var_oid, data1_node *n) + const Odr_oid *def_oid, + const Odr_oid *var_oid, data1_node *n) { data1_node **c; @@ -121,9 +121,9 @@ static void match_triple(data1_handle dh, Z_Variant *vreq, { int remove_flag = 0; Z_Triple *r; - + assert ((*c)->which == DATA1N_variant); - + if ((*c)->u.variant.type->zclass->zclass == 4 && (*c)->u.variant.type->type == 1) { @@ -160,7 +160,7 @@ static int match_node_and_attr (data1_node *c, const char *spec) data1_tag *tag = 0; if (c->u.tag.element) tag = c->u.tag.element->tag; - + *predicate = '\0'; sscanf(spec, "%63[^[]%c%63[^]]", elem, &dummy_ch, predicate); if (data1_matchstr(elem, tag ? tag->value.string : c->u.tag.tag)) @@ -190,7 +190,7 @@ static int match_node_and_attr (data1_node *c, const char *spec) } return 0; } - + static int match_children_here (data1_handle dh, data1_node *n, Z_Espec1 *e, int i, Z_ETagUnit **t, int num, @@ -237,7 +237,7 @@ static int match_children_here (data1_handle dh, data1_node *n, #if 1 if (!match_node_and_attr(c, str_val)) continue; -#else +#else if (data1_matchstr(str_val, tag ? tag->value.string : c->u.tag.tag)) continue; @@ -283,7 +283,7 @@ static int match_children_here (data1_handle dh, data1_node *n, Z_Variant *vreq = e->elements[i]->u.simpleElement->variantRequest; - const int *var_oid = yaz_oid_variant1(); + const Odr_oid *var_oid = yaz_oid_varset_variant_1; if (!vreq) vreq = e->defaultVariantRequest; @@ -294,7 +294,7 @@ static int match_children_here (data1_handle dh, data1_node *n, /* * 6,5: meta-data requested, variant list. */ - if (find_triple(vreq, e->defaultVariantSetId, + if (find_triple(vreq, e->defaultVariantSetId, var_oid, 6, 5)) show_variantlist = 1; /* @@ -360,7 +360,7 @@ int data1_doespec1 (data1_handle dh, data1_node *n, Z_Espec1 *e) n = data1_get_root_tag (dh, n); if (n && n->which == DATA1N_tag) n->u.tag.node_selected = 1; - + for (i = 0; i < e->num_elements; i++) { if (e->elements[i]->which != Z_ERequest_simpleElement) @@ -375,6 +375,7 @@ int data1_doespec1 (data1_handle dh, data1_node *n, Z_Espec1 *e) /* * Local variables: * c-basic-offset: 4 + * c-file-style: "Stroustrup" * indent-tabs-mode: nil * End: * vim: shiftwidth=4 tabstop=8 expandtab