X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=util%2Fpquery.c;h=7b3375729a95db8a89d16058554b57f9b8425ddf;hb=4090fc5c7b77769020633d09cf63b325aceaf49a;hp=505f1317ee5fc4821b63348d7032c4cddff72765;hpb=07f19b4ed398c181a0ea8a9fb581f8098de6eec2;p=yaz-moved-to-github.git diff --git a/util/pquery.c b/util/pquery.c index 505f131..7b33757 100644 --- a/util/pquery.c +++ b/util/pquery.c @@ -4,7 +4,18 @@ * Sebastian Hammer, Adam Dickmeiss * * $Log: pquery.c,v $ - * Revision 1.14 1997-09-22 12:33:41 adam + * Revision 1.17 1997-11-24 11:33:57 adam + * Using function odr_nullval() instead of global ODR_NULLVAL when + * appropriate. + * + * Revision 1.16 1997/09/29 13:19:00 adam + * Added function, oid_ent_to_oid, to replace the function + * oid_getoidbyent, which is not thread safe. + * + * Revision 1.15 1997/09/29 07:13:43 adam + * Changed type of a few variables to avoid warnings. + * + * Revision 1.14 1997/09/22 12:33:41 adam * Fixed bug introduced by previous commit. * * Revision 1.13 1997/09/17 12:10:42 adam @@ -65,7 +76,7 @@ static oid_value p_query_dfset = VAL_NONE; struct lex_info { const char *query_buf; const char *lex_buf; - int lex_len; + size_t lex_len; int query_look; char *left_sep; char *right_sep; @@ -88,7 +99,7 @@ static int query_oid_getvalbyname (struct lex_info *li) return oid_getvalbyname (buf); } -static int compare_term (struct lex_info *li, const char *src, int off) +static int compare_term (struct lex_info *li, const char *src, size_t off) { size_t len=strlen(src); @@ -192,13 +203,14 @@ static Z_AttributesPlusTerm *rpn_term (struct lex_info *li, ODR o, else { oident attrid; + int oid[OID_SIZE]; attrid.proto = PROTO_Z3950; attrid.oclass = CLASS_ATTSET; attrid.value = attr_set[i]; zapt->attributeList[i]->attributeSet = - odr_oiddup (o, oid_getoidbyent (&attrid)); + odr_oiddup (o, oid_ent_to_oid (&attrid, oid)); } zapt->attributeList[i]->which = Z_AttributeValue_numeric; zapt->attributeList[i]->value.numeric = &attr_tmp[2*i+1]; @@ -208,7 +220,7 @@ static Z_AttributesPlusTerm *rpn_term (struct lex_info *li, ODR o, } } else - zapt->attributeList = ODR_NULLVAL; + zapt->attributeList = odr_nullval(); zapt->term = term; term->which = Z_Term_general; term->u.general = term_octet; @@ -315,15 +327,15 @@ static Z_Complex *rpn_complex (struct lex_info *li, ODR o, oid_proto proto, { case 'a': zo->which = Z_Operator_and; - zo->u.and = ODR_NULLVAL; + zo->u.and = odr_nullval(); break; case 'o': zo->which = Z_Operator_or; - zo->u.and = ODR_NULLVAL; + zo->u.and = odr_nullval(); break; case 'n': zo->which = Z_Operator_and_not; - zo->u.and = ODR_NULLVAL; + zo->u.and = odr_nullval(); break; case 'p': zo->which = Z_Operator_prox; @@ -382,7 +394,7 @@ static Z_RPNStructure *rpn_structure (struct lex_info *li, ODR o, if (num_attr >= max_attr) return NULL; if (!(cp = strchr (li->lex_buf, '=')) || - (cp-li->lex_buf) > li->lex_len) + (size_t) (cp-li->lex_buf) > li->lex_len) { attr_set[num_attr] = query_oid_getvalbyname (li); lex (li); @@ -438,6 +450,7 @@ Z_RPNQuery *p_query_rpn_mk (ODR o, struct lex_info *li, oid_proto proto, oid_value attr_set[512]; oid_value topSet = VAL_NONE; oident oset; + int oid[OID_SIZE]; zq = odr_malloc (o, sizeof(*zq)); lex (li); @@ -458,7 +471,7 @@ 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_getoidbyent (&oset)); + zq->attributeSetId = odr_oiddup (o, oid_ent_to_oid (&oset, oid)); if (!(zq->RPNStructure = rpn_structure (li, o, proto, 0, 512, attr_array, attr_set))) @@ -491,6 +504,7 @@ Z_AttributesPlusTerm *p_query_scan_mk (struct lex_info *li, const char *cp; oid_value topSet = VAL_NONE; oident oset; + int oid[OID_SIZE]; lex (li); if (li->query_look == 'r') @@ -508,7 +522,7 @@ Z_AttributesPlusTerm *p_query_scan_mk (struct lex_info *li, oset.oclass = CLASS_ATTSET; oset.value = topSet; - *attributeSetP = odr_oiddup (o, oid_getoidbyent (&oset)); + *attributeSetP = odr_oiddup (o, oid_ent_to_oid (&oset, oid)); while (li->query_look == 'l') { @@ -519,7 +533,7 @@ Z_AttributesPlusTerm *p_query_scan_mk (struct lex_info *li, return NULL; if (!(cp = strchr (li->lex_buf, '=')) || - (cp-li->lex_buf) > li->lex_len) + (size_t) (cp-li->lex_buf) > li->lex_len) { attr_set[num_attr] = query_oid_getvalbyname (li); lex (li);