X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=util%2Fpquery.c;h=02251784c3626a026c4c50d334fb1d8be61971f2;hb=0038ea56f28bf86ed4e70e6f076fed78ad5b96e1;hp=b57b9a5eb1c2c3a9c845624291aa780d06155923;hpb=f94999cca65bd3464c1c6db8b5046e0a010b0c7f;p=yaz-moved-to-github.git diff --git a/util/pquery.c b/util/pquery.c index b57b9a5..0225178 100644 --- a/util/pquery.c +++ b/util/pquery.c @@ -4,7 +4,14 @@ * Sebastian Hammer, Adam Dickmeiss * * $Log: pquery.c,v $ - * Revision 1.20 1998-03-31 15:13:20 adam + * Revision 1.22 1999-04-20 09:56:49 adam + * Added 'name' paramter to encoder/decoder routines (typedef Odr_fun). + * Modified all encoders/decoders to reflect this change. + * + * Revision 1.21 1998/10/13 16:03:37 adam + * Better checking for invalid OID's in p_query_rpn. + * + * Revision 1.20 1998/03/31 15:13:20 adam * Development towards compiled ASN.1. * * Revision 1.19 1998/03/05 08:09:03 adam @@ -99,13 +106,15 @@ static Z_RPNStructure *rpn_structure (struct lex_info *li, ODR o, oid_proto, static enum oid_value query_oid_getvalbyname (struct lex_info *li) { + enum oid_value value; char buf[32]; if (li->lex_len > 31) return VAL_NONE; memcpy (buf, li->lex_buf, li->lex_len); buf[li->lex_len] = '\0'; - return oid_getvalbyname (buf); + value = oid_getvalbyname (buf); + return value; } static int compare_term (struct lex_info *li, const char *src, size_t off) @@ -208,7 +217,6 @@ static Z_AttributesPlusTerm *rpn_term (struct lex_info *li, ODR o, elements[i] = (Z_AttributeElement*)odr_malloc (o,sizeof(**elements)); elements[i]->attributeType = &attr_tmp[2*i]; -#ifdef Z_95 if (attr_set[i] == VAL_NONE) elements[i]->attributeSet = 0; else @@ -225,9 +233,6 @@ static Z_AttributesPlusTerm *rpn_term (struct lex_info *li, ODR o, } elements[i]->which = Z_AttributeValue_numeric; elements[i]->value.numeric = &attr_tmp[2*i+1]; -#else - elements[i]->attributeValue = &attr_tmp[2*i+1]; -#endif } } #ifdef ASN_COMPILED @@ -421,6 +426,8 @@ static Z_RPNStructure *rpn_structure (struct lex_info *li, ODR o, (size_t) (cp-li->lex_buf) > li->lex_len) { attr_set[num_attr] = query_oid_getvalbyname (li); + if (attr_set[num_attr] == VAL_NONE) + return NULL; lex (li); if (!(cp = strchr (li->lex_buf, '='))) @@ -495,7 +502,9 @@ Z_RPNQuery *p_query_rpn_mk (ODR o, struct lex_info *li, oid_proto proto, oset.oclass = CLASS_ATTSET; oset.value = topSet; - zq->attributeSetId = odr_oiddup (o, oid_ent_to_oid (&oset, oid)); + if (!oid_ent_to_oid (&oset, oid)) + return NULL; + zq->attributeSetId = odr_oiddup (o, oid); if (!(zq->RPNStructure = rpn_structure (li, o, proto, 0, 512, attr_array, attr_set)))