X-Git-Url: http://git.indexdata.com/?p=yaz-moved-to-github.git;a=blobdiff_plain;f=src%2Fpquery.c;h=23d7b64e03e1a2cdbd000bed86849420a5ac1fc1;hp=a9dbcc3bada58bab874e1f648e9db33c4fd865ca;hb=ee6ab2ee3a9ee1a8c65d7272ec7fba1d886f5af0;hpb=7a4064cd15f6c6b34c1180e1bc51f0d0e90da320 diff --git a/src/pquery.c b/src/pquery.c index a9dbcc3..23d7b64 100644 --- a/src/pquery.c +++ b/src/pquery.c @@ -1,8 +1,6 @@ -/* - * Copyright (C) 1995-2007, Index Data ApS +/* This file is part of the YAZ toolkit. + * Copyright (C) 1995-2008 Index Data * See the file LICENSE for details. - * - * $Id: pquery.c,v 1.10 2007-04-12 13:52:57 adam Exp $ */ /** * \file pquery.c @@ -34,13 +32,13 @@ struct yaz_pqf_parser { static Z_RPNStructure *rpn_structure(struct yaz_pqf_parser *li, ODR o, int num_attr, int max_attr, int *attr_list, char **attr_clist, - int **attr_set); + Odr_oid **attr_set); -static int *query_oid_getvalbyname(struct yaz_pqf_parser *li, ODR o) +static Odr_oid *query_oid_getvalbyname(struct yaz_pqf_parser *li, ODR o) { char buf[32]; - if (li->lex_len > 31) + if (li->lex_len >= sizeof(buf)-1) return 0; memcpy (buf, li->lex_buf, li->lex_len); buf[li->lex_len] = '\0'; @@ -186,7 +184,7 @@ static int escape_string(char *out_buf, const char *in, int len) static int p_query_parse_attr(struct yaz_pqf_parser *li, ODR o, int num_attr, int *attr_list, - char **attr_clist, int **attr_set) + char **attr_clist, Odr_oid **attr_set) { const char *cp; @@ -242,7 +240,7 @@ static int p_query_parse_attr(struct yaz_pqf_parser *li, ODR o, static Z_AttributesPlusTerm *rpn_term(struct yaz_pqf_parser *li, ODR o, int num_attr, int *attr_list, - char **attr_clist, int **attr_set) + char **attr_clist, Odr_oid **attr_set) { Z_AttributesPlusTerm *zapt; Odr_oct *term_octet; @@ -352,7 +350,7 @@ static Z_AttributesPlusTerm *rpn_term(struct yaz_pqf_parser *li, ODR o, static Z_Operand *rpn_simple(struct yaz_pqf_parser *li, ODR o, int num_attr, int *attr_list, char **attr_clist, - int **attr_set) + Odr_oid **attr_set) { Z_Operand *zo; @@ -362,7 +360,7 @@ static Z_Operand *rpn_simple(struct yaz_pqf_parser *li, ODR o, case 't': zo->which = Z_Operand_APT; if (!(zo->u.attributesPlusTerm = - rpn_term (li, o, num_attr, attr_list, attr_clist, attr_set))) + rpn_term(li, o, num_attr, attr_list, attr_clist, attr_set))) return 0; lex (li); break; @@ -487,7 +485,7 @@ static Z_ProximityOperator *rpn_proximity (struct yaz_pqf_parser *li, ODR o) static Z_Complex *rpn_complex(struct yaz_pqf_parser *li, ODR o, int num_attr, int max_attr, int *attr_list, char **attr_clist, - int **attr_set) + Odr_oid **attr_set) { Z_Complex *zc; Z_Operator *zo; @@ -564,7 +562,7 @@ static Z_RPNStructure *rpn_structure(struct yaz_pqf_parser *li, ODR o, int num_attr, int max_attr, int *attr_list, char **attr_clist, - int **attr_set) + Odr_oid **attr_set) { Z_RPNStructure *sz; @@ -627,8 +625,8 @@ Z_RPNQuery *p_query_rpn_mk(ODR o, struct yaz_pqf_parser *li, const char *qbuf) Z_RPNQuery *zq; int attr_array[1024]; char *attr_clist[512]; - int *attr_set[512]; - int *top_set = 0; + Odr_oid *attr_set[512]; + Odr_oid *top_set = 0; zq = (Z_RPNQuery *)odr_malloc (o, sizeof(*zq)); lex (li); @@ -645,8 +643,7 @@ Z_RPNQuery *p_query_rpn_mk(ODR o, struct yaz_pqf_parser *li, const char *qbuf) } if (!top_set) { - top_set = yaz_string_to_oid_odr(yaz_oid_std(), - CLASS_ATTSET, OID_STR_BIB1, o); + top_set = odr_oiddup(o, yaz_oid_attset_bib_1); } zq->attributeSetId = top_set; @@ -690,10 +687,10 @@ Z_AttributesPlusTerm *p_query_scan_mk(struct yaz_pqf_parser *li, { int attr_list[1024]; char *attr_clist[512]; - int *attr_set[512]; + Odr_oid *attr_set[512]; int num_attr = 0; int max_attr = 512; - int *top_set = 0; + Odr_oid *top_set = 0; Z_AttributesPlusTerm *apt; lex (li); @@ -710,8 +707,7 @@ Z_AttributesPlusTerm *p_query_scan_mk(struct yaz_pqf_parser *li, } if (!top_set) { - top_set = yaz_string_to_oid_odr(yaz_oid_std(), - CLASS_ATTSET, OID_STR_BIB1, o); + top_set = odr_oiddup(o, yaz_oid_attset_bib_1); } *attributeSetP = top_set;