From 7a98e9bfbb9d5fe7d44822a9838e3becbdce9363 Mon Sep 17 00:00:00 2001 From: Adam Dickmeiss Date: Tue, 8 May 2007 08:22:35 +0000 Subject: [PATCH] For OIDs use Odr_oid type everywhere, i.e. do not assume Odr_oid=int. For OID class, use oid_class consistently. --- NEWS | 4 +++ client/admin.c | 4 +-- client/client.c | 71 ++++++++++++++------------------------------ client/tabcomplete.c | 6 ++-- doc/tools.xml | 42 ++++++++++++++------------ include/yaz/backend.h | 10 +++---- include/yaz/logrpn.h | 6 ++-- include/yaz/odr.h | 7 +++-- include/yaz/oid_db.h | 52 +++++++++++++++++++++++--------- include/yaz/oid_util.h | 37 ++++++----------------- include/yaz/otherinfo.h | 8 ++--- include/yaz/prt-ext.h | 8 ++--- include/yaz/querytowrbuf.h | 4 +-- include/yaz/retrieval.h | 10 +++---- src/grs1disp.c | 6 ++-- src/logrpn.c | 10 +++---- src/odr_oid.c | 4 +-- src/odr_util.c | 11 +++---- src/oid_db.c | 34 ++++++++++----------- src/oid_util.c | 14 ++++----- src/oidtoc.tcl | 6 ++-- src/otherinfo.c | 16 +++++----- src/pquery.c | 28 ++++++++--------- src/prt-ext.c | 8 ++--- src/querytowrbuf.c | 4 +-- src/retrieval.c | 12 ++++---- src/seshigh.c | 8 ++--- src/zoom-c.c | 22 +++++++------- ztest/ztest.c | 8 ++--- 29 files changed, 223 insertions(+), 237 deletions(-) diff --git a/NEWS b/NEWS index ff13dcb..68da2ec 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,7 @@ +For OIDs use Odr_oid type everywhere, i.e. do not assume Odr_oid=int. + +For OID class, use oid_class consistently. + Fixed external handling for SUTRS and Explain records (bug appeared in 3.0 series). diff --git a/client/admin.c b/client/admin.c index 9b2d870..16528ba 100644 --- a/client/admin.c +++ b/client/admin.c @@ -2,7 +2,7 @@ * Copyright (C) 1995-2007, Index Data ApS * See the file LICENSE for details. * - * $Id: admin.c,v 1.25 2007-04-16 21:53:08 adam Exp $ + * $Id: admin.c,v 1.26 2007-05-08 08:22:35 adam Exp $ */ #include @@ -47,7 +47,7 @@ int sendAdminES(int type, char* param1) Z_APDU *apdu = zget_APDU(out, Z_APDU_extendedServicesRequest ); Z_ExtendedServicesRequest *req = apdu->u.extendedServicesRequest; Z_External *r; - int *oid; + Odr_oid *oid; Z_ESAdminOriginPartToKeep *toKeep; Z_ESAdminOriginPartNotToKeep *notToKeep; printf ("Admin request\n"); diff --git a/client/client.c b/client/client.c index 20697e3..769c1c5 100644 --- a/client/client.c +++ b/client/client.c @@ -2,7 +2,7 @@ * Copyright (C) 1995-2007, Index Data ApS * See the file LICENSE for details. * - * $Id: client.c,v 1.337 2007-05-06 20:12:19 adam Exp $ + * $Id: client.c,v 1.338 2007-05-08 08:22:35 adam Exp $ */ /** \file client.c * \brief yaz-client program @@ -174,7 +174,7 @@ int rl_attempted_completion_over = 0; #define maxOtherInfosSupported 10 struct eoi { - int oid[OID_SIZE]; + Odr_oid oid[OID_SIZE]; char* value; } extraOtherInfos[maxOtherInfosSupported]; @@ -415,11 +415,9 @@ static int process_initResponse(Z_InitResponse *res) } else if (uif->which == Z_External_single) { - const int *oclc_oid = yaz_string_to_oid(yaz_oid_std(), - CLASS_GENERAL, - "OCLC-userInfo"); Odr_any *sat = uif->u.single_ASN1_type; - if (!oid_oidcmp(uif->direct_reference, oclc_oid)) + if (!oid_oidcmp(uif->direct_reference, + yaz_oid_userinfo_oclc_userinfo)) { Z_OCLC_UserInformation *oclc_ui; ODR decode = odr_createmem(ODR_DECODE); @@ -859,7 +857,7 @@ static void print_record(const unsigned char *buf, size_t len) static void display_record(Z_External *r) { - const int *oid = r->direct_reference; + const Odr_oid *oid = r->direct_reference; record_last = r; /* @@ -867,7 +865,7 @@ static void display_record(Z_External *r) */ if (oid) { - int oclass; + oid_class oclass; char oid_name_buf[OID_STR_MAX]; const char *oid_name = yaz_oid_to_string_buf(oid, &oclass, oid_name_buf); @@ -934,16 +932,7 @@ static void display_record(Z_External *r) } else { - const int *oidsuffix = oid_oidlen(oid) > 1 - ? oid + oid_oidlen(oid)-2 : 0; - if ( -#if AVOID_MARC_DECODE - /* primitive check for a marc OID 5.1-29 except 16 */ - oidsuffix[0] == 5 && oidsuffix[1] < 30 && oidsuffix[1] != 16 -#else - 1 -#endif - ) + if (oid && yaz_oid_is_iso2709(oid)) { const char *result; size_t rlen; @@ -1161,7 +1150,7 @@ static void display_diagrecs(Z_DiagRec **pp, int num) printf("Missing diagset\n"); else { - int oclass; + oid_class oclass; char diag_name_buf[OID_STR_MAX]; const char *diag_name = 0; diag_name = yaz_oid_to_string_buf @@ -1690,7 +1679,7 @@ static void print_oid(int iLevel, const char *pTag, Odr_oid *pOid) { if (pOid != NULL) { - int *pInt = pOid; + Odr_oid *pInt = pOid; print_level(iLevel); printf("%s:", pTag); @@ -1934,10 +1923,8 @@ static Z_External *create_external_itemRequest(void) } else { - const int *ill_oid = yaz_string_to_oid(yaz_oid_std(), - CLASS_GENERAL, "ISOILL-1"); r = (Z_External *) odr_malloc (out, sizeof(*r)); - r->direct_reference = odr_oiddup(out, ill_oid); + r->direct_reference = odr_oiddup(out, yaz_oid_general_isoill_1); r->indirect_reference = 0; r->descriptor = 0; r->which = Z_External_single; @@ -1987,13 +1974,10 @@ static Z_External *create_external_ILL_APDU(int which) } else { - const int *ill_oid = yaz_string_to_oid(yaz_oid_std(), - CLASS_GENERAL, "ISOILL-1"); - ill_request_buf = odr_getbuf (out, &ill_request_size, 0); r = (Z_External *) odr_malloc (out, sizeof(*r)); - r->direct_reference = odr_oiddup(out, ill_oid); + r->direct_reference = odr_oiddup(out, yaz_oid_general_isoill_1); r->indirect_reference = 0; r->descriptor = 0; r->which = Z_External_single; @@ -2017,10 +2001,7 @@ static Z_External *create_external_ILL_APDU(int which) static Z_External *create_ItemOrderExternal(const char *type, int itemno) { Z_External *r = (Z_External *) odr_malloc(out, sizeof(Z_External)); - const int *itemorder_oid = yaz_string_to_oid(yaz_oid_std(), - CLASS_EXTSERV, - "Item order"); - r->direct_reference = odr_oiddup(out, itemorder_oid); + r->direct_reference = odr_oiddup(out, yaz_oid_extserv_item_order); r->indirect_reference = 0; r->descriptor = 0; @@ -2068,8 +2049,6 @@ static Z_External *create_ItemOrderExternal(const char *type, int itemno) } else if (!strcmp(type, "xml") || !strcmp(type, "3")) { - const int *oid_xml = yaz_string_to_oid(yaz_oid_std(), - CLASS_RECSYN, "xml"); const char *xml_buf = "\n" " request\n" @@ -2077,7 +2056,7 @@ static Z_External *create_ItemOrderExternal(const char *type, int itemno) " 1212 \n" ""; r->u.itemOrder->u.esRequest->notToKeep->itemRequest = - z_ext_record_oid(out, oid_xml, xml_buf, strlen(xml_buf)); + z_ext_record_oid(out, yaz_oid_recsyn_xml, xml_buf, strlen(xml_buf)); } else r->u.itemOrder->u.esRequest->notToKeep->itemRequest = 0; @@ -2090,12 +2069,9 @@ static int send_itemorder(const char *type, int itemno) Z_APDU *apdu = zget_APDU(out, Z_APDU_extendedServicesRequest); Z_ExtendedServicesRequest *req = apdu->u.extendedServicesRequest; - const int *itemorder_oid = yaz_string_to_oid(yaz_oid_std(), - CLASS_EXTSERV, - "Item order"); req->referenceId = set_refid (out); - req->packageType = odr_oiddup(out, itemorder_oid); + req->packageType = odr_oiddup(out, yaz_oid_extserv_item_order); req->packageName = esPackageName; req->taskSpecificParameters = create_ItemOrderExternal(type, itemno); @@ -2233,11 +2209,9 @@ static int cmd_update_Z3950(int version, int action_no, const char *recid, Z_ExtendedServicesRequest *req = apdu->u.extendedServicesRequest; Z_External *r; Z_External *record_this = 0; - const int *oid_xml = yaz_string_to_oid(yaz_oid_std(), - CLASS_RECSYN, "xml"); - if (rec_buf) - record_this = z_ext_record_oid(out, oid_xml, rec_buf, rec_len); + record_this = z_ext_record_oid(out, yaz_oid_recsyn_xml, + rec_buf, rec_len); else { if (!record_last) @@ -2359,7 +2333,7 @@ static int cmd_xmles(const char *arg) { char *asn_buf = 0; int noread = 0; - int *oid; + Odr_oid *oid; char oid_str[51]; Z_APDU *apdu = zget_APDU(out, Z_APDU_extendedServicesRequest); Z_ExtendedServicesRequest *req = apdu->u.extendedServicesRequest; @@ -3633,8 +3607,8 @@ int cmd_register_oid(const char* args) { }; char oname_str[101], oclass_str[101], oid_str[101]; int i; - int oidclass = CLASS_GENERAL; - int oid[OID_SIZE]; + oid_class oidclass = CLASS_GENERAL; + Odr_oid oid[OID_SIZE]; if (sscanf (args, "%100[^ ] %100[^ ] %100s", oname_str,oclass_str, oid_str) < 1) { @@ -4144,7 +4118,7 @@ int cmd_set_otherinfo(const char* args) else { NMEM oid_tmp = nmem_create(); - const int *oid = + const Odr_oid *oid = yaz_string_to_oid_nmem(yaz_oid_std(), CLASS_GENERAL, oidstr, oid_tmp); oid_oidcpy(extraOtherInfos[otherinfoNo].oid, oid); @@ -4187,7 +4161,7 @@ int cmd_list_otherinfo(const char* args) if (extraOtherInfos[i].value) { char name_oid[OID_STR_MAX]; - int oclass; + oid_class oclass; const char *name = yaz_oid_to_string_buf(extraOtherInfos[i].oid, &oclass, name_oid); @@ -4204,7 +4178,7 @@ int cmd_list_otherinfo(const char* args) if (extraOtherInfos[i].value) { char name_oid[OID_STR_MAX]; - int oclass; + oid_class oclass; const char *name = yaz_oid_to_string_buf(extraOtherInfos[i].oid, &oclass, name_oid); @@ -4212,7 +4186,6 @@ int cmd_list_otherinfo(const char* args) i, name ? name : "null", extraOtherInfos[i].value); } - } } return 0; diff --git a/client/tabcomplete.c b/client/tabcomplete.c index 3bbb156..d9e6cb1 100644 --- a/client/tabcomplete.c +++ b/client/tabcomplete.c @@ -2,7 +2,7 @@ * Copyright (C) 1995-2007, Index Data ApS * See the file LICENSE for details. * - * $Id: tabcomplete.c,v 1.18 2007-04-12 13:52:57 adam Exp $ + * $Id: tabcomplete.c,v 1.19 2007-05-08 08:22:35 adam Exp $ */ #include @@ -64,8 +64,8 @@ typedef struct { of pointers into the oid owned data */ -void oid_loader(const int *oid, - int oclass, const char *name, void* data_) +void oid_loader(const Odr_oid *oid, + oid_class oclass, const char *name, void* data_) { oid_callback_t* data=(oid_callback_t*) data_; diff --git a/doc/tools.xml b/doc/tools.xml index b8ff153..3e711d0 100644 --- a/doc/tools.xml +++ b/doc/tools.xml @@ -1,4 +1,4 @@ - + Supporting Tools @@ -1541,27 +1541,30 @@ void cql_to_xml_stdio(struct cql_node *cn, FILE *f); The basic YAZ representation of an OID is an array of integers, - terminated with the value -1. There is a typedef - of this integer to Odr_oid but this is not consistenly - used everywhere. + terminated with the value -1. This integer is of type + Odr_oid. - An OID can either be declared as a automatic variable or we can - allocated using the ODR/NMEM memory utilities. It's + Fundamental OID operations and the type Odr_oid + are defined in yaz/oid_util.h. + + + An OID can either be declared as a automatic variable or it can + allocated using the memory utilities or ODR/NMEM. It's guaranteed that an OID can fit in OID_SIZE integers. Create OID on stack We can create an OID for the Bib-1 attribute set with: - int bib1[OID_SIZE]; - myoid[0] = 1; - myoid[1] = 2; - myoid[2] = 840; - myoid[3] = 10003; - myoid[4] = 3; - myoid[5] = 1; - myoid[6] = -1; + Odr_oid bib1[OID_SIZE]; + bib1[0] = 1; + bib1[1] = 2; + bib1[2] = 840; + bib1[3] = 10003; + bib1[4] = 3; + bib1[5] = 1; + bib1[6] = -1; @@ -1569,14 +1572,15 @@ void cql_to_xml_stdio(struct cql_node *cn, FILE *f); And OID may also be filled from a string-based representation using dots (.). This is achieved by function - int oid_dotstring_to_oid(const char *name, int *oid); + int oid_dotstring_to_oid(const char *name, Odr_oid *oid); + This functions returns 0 if name could be converted; -1 otherwise. Using oid_oiddotstring_to_oid - We can create the Bib-1 attribute set OID easier with: + We can fill the Bib-1 attribute set OID easier with: - int bib1[OID_SIZE]; + Odr_oid bib1[OID_SIZE]; oid_oiddotstring_to_oid("1.2.840.10003.3.1", bib1); @@ -1604,7 +1608,7 @@ void cql_to_xml_stdio(struct cql_node *cn, FILE *f); The function - char *oid_oid_to_dotstring(const int *oid, char *oidbuf) + char *oid_oid_to_dotstring(const Odr_oid *oid, char *oidbuf) does the reverse of oid_oiddotstring_to_oid. It converts an OID to the string-based representation using dots. @@ -1630,7 +1634,7 @@ void cql_to_xml_stdio(struct cql_node *cn, FILE *f); From YAZ version 3 and later, the oident system has been replaced by an OID database. OID database is a misnomer .. the old odient - was a database system too. + system was also a database. The OID database is really just a map between named Object Identifiers diff --git a/include/yaz/backend.h b/include/yaz/backend.h index d2847f0..dfa7f76 100644 --- a/include/yaz/backend.h +++ b/include/yaz/backend.h @@ -24,7 +24,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -/* $Id: backend.h,v 1.46 2007-05-02 12:37:15 adam Exp $ */ +/* $Id: backend.h,v 1.47 2007-05-08 08:22:35 adam Exp $ */ /** * \file backend.h @@ -78,7 +78,7 @@ typedef struct { char *setname; /* set name */ int start; int number; /* record number */ - int *format; /* format, transfer syntax (OID) */ + Odr_oid *format; /* format, transfer syntax (OID) */ Z_ReferenceId *referenceId;/* reference ID */ Z_RecordComposition *comp; /* Formatting instructions */ ODR stream; /* encoding stream - memory source if required */ @@ -96,7 +96,7 @@ typedef struct bend_fetch_rr { char *setname; /* set name */ int number; /* record number */ Z_ReferenceId *referenceId;/* reference ID */ - int *request_format; /* format, transfer syntax (OID) */ + Odr_oid *request_format; /* format, transfer syntax (OID) */ Z_RecordComposition *comp; /* Formatting instructions */ ODR stream; /* encoding stream - memory source if req */ ODR print; /* printing stream */ @@ -105,7 +105,7 @@ typedef struct bend_fetch_rr { int len; /* length of record or -1 if structured */ char *record; /* record */ int last_in_set; /* is it? */ - int *output_format; /* response format/syntax (OID) */ + Odr_oid *output_format; /* response format/syntax (OID) */ int errcode; /* 0==success */ char *errstring; /* system error string or NULL */ int surrogate_flag; /* surrogate diagnostic */ @@ -130,7 +130,7 @@ typedef enum { typedef struct bend_scan_rr { int num_bases; /* number of elements in databaselist */ char **basenames; /* databases to search */ - int *attributeset; + Odr_oid *attributeset; Z_ReferenceId *referenceId; /* reference ID */ Z_AttributesPlusTerm *term; ODR stream; /* encoding stream - memory source if required */ diff --git a/include/yaz/logrpn.h b/include/yaz/logrpn.h index a6d352f..86293d5 100644 --- a/include/yaz/logrpn.h +++ b/include/yaz/logrpn.h @@ -24,7 +24,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -/* $Id: logrpn.h,v 1.15 2007-04-12 13:52:57 adam Exp $ */ +/* $Id: logrpn.h,v 1.16 2007-05-08 08:22:35 adam Exp $ */ /** * \file logrpn.h @@ -42,10 +42,10 @@ YAZ_BEGIN_CDECL YAZ_EXPORT void log_rpn_query(Z_RPNQuery *rpn); YAZ_EXPORT void log_rpn_query_level(int loglevel, Z_RPNQuery *rpn); -YAZ_EXPORT void log_scan_term(Z_AttributesPlusTerm *zapt, const int *ast); +YAZ_EXPORT void log_scan_term(Z_AttributesPlusTerm *zapt, const Odr_oid *ast); YAZ_EXPORT void log_scan_term_level(int loglevel, Z_AttributesPlusTerm *zapt, - const int *ast); + const Odr_oid *ast); YAZ_EXPORT void yaz_log_zquery(Z_Query *q); YAZ_EXPORT void yaz_log_zquery_level(int loglevel, Z_Query *q); diff --git a/include/yaz/odr.h b/include/yaz/odr.h index 407d38c..b84ebcd 100644 --- a/include/yaz/odr.h +++ b/include/yaz/odr.h @@ -24,7 +24,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -/* $Id: odr.h,v 1.27 2007-04-12 13:52:57 adam Exp $ */ +/* $Id: odr.h,v 1.28 2007-05-08 08:22:35 adam Exp $ */ /** * \file odr.h @@ -40,6 +40,9 @@ #include #include +/* for definition of Odr_oid */ +#include + YAZ_BEGIN_CDECL #ifndef bool_t @@ -109,8 +112,6 @@ typedef struct odr_bitmask int top; } Odr_bitmask; -typedef int Odr_oid; /* terminate by -1 */ - #define ODR_S_SET 0 #define ODR_S_CUR 1 #define ODR_S_END 2 diff --git a/include/yaz/oid_db.h b/include/yaz/oid_db.h index 1fe57d9..c216c33 100644 --- a/include/yaz/oid_db.h +++ b/include/yaz/oid_db.h @@ -24,7 +24,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -/* $Id: oid_db.h,v 1.7 2007-05-07 12:06:09 adam Exp $ */ +/* $Id: oid_db.h,v 1.8 2007-05-08 08:22:35 adam Exp $ */ /** * \file oid_db.h @@ -42,6 +42,29 @@ YAZ_BEGIN_CDECL /** \brief OID database */ typedef struct yaz_oid_db *yaz_oid_db_t; + +typedef enum oid_class +{ + CLASS_NOP=0, + CLASS_APPCTX, + CLASS_ABSYN, + CLASS_ATTSET, + CLASS_TRANSYN, + CLASS_DIAGSET, + CLASS_RECSYN, + CLASS_RESFORM, + CLASS_ACCFORM, + CLASS_EXTSERV, + CLASS_USERINFO, + CLASS_ELEMSPEC, + CLASS_VARSET, + CLASS_SCHEMA, + CLASS_TAGSET, + CLASS_GENERAL, + CLASS_NEGOT +} oid_class; + + /** \brief returns standard OID database \retval OID database handle */ @@ -59,8 +82,8 @@ yaz_oid_db_t yaz_oid_std(void); any named OID in dot-notation (1.2.8). */ YAZ_EXPORT -const int *yaz_string_to_oid(yaz_oid_db_t oid_db, - int oclass, const char *name); +const Odr_oid *yaz_string_to_oid(yaz_oid_db_t oid_db, + oid_class oclass, const char *name); /** \brief creates NMEM malloc'ed OID from string @@ -71,8 +94,8 @@ const int *yaz_string_to_oid(yaz_oid_db_t oid_db, \returns raw OID or NULL if name is unknown (bad) */ YAZ_EXPORT -int *yaz_string_to_oid_nmem(yaz_oid_db_t oid_db, - int oclass, const char *name, NMEM nmem); +Odr_oid *yaz_string_to_oid_nmem(yaz_oid_db_t oid_db, + oid_class oclass, const char *name, NMEM nmem); /** \brief creates ODR malloc'ed OID from string \param oid_db OID database @@ -82,8 +105,8 @@ int *yaz_string_to_oid_nmem(yaz_oid_db_t oid_db, \returns raw OID or NULL if name is unknown (bad) */ YAZ_EXPORT -int *yaz_string_to_oid_odr(yaz_oid_db_t oid_db, - int oclass, const char *name, ODR odr); +Odr_oid *yaz_string_to_oid_odr(yaz_oid_db_t oid_db, + oid_class oclass, const char *name, ODR odr); /** \brief maps raw OID to string \param oid_db OID database @@ -93,7 +116,7 @@ int *yaz_string_to_oid_odr(yaz_oid_db_t oid_db, */ YAZ_EXPORT const char *yaz_oid_to_string(yaz_oid_db_t oid_db, - const int *oid, int *oclass); + const Odr_oid *oid, oid_class *oclass); /** \brief maps any OID to string (named or dot-notation) @@ -103,7 +126,8 @@ const char *yaz_oid_to_string(yaz_oid_db_t oid_db, \returns OID string (named or dot notatition) */ YAZ_EXPORT -const char *yaz_oid_to_string_buf(const int *oid, int *oclass, char *buf); +const char *yaz_oid_to_string_buf(const Odr_oid *oid, + oid_class *oclass, char *buf); /** \brief traverses OIDs in a database \param oid_db OID database @@ -111,8 +135,8 @@ const char *yaz_oid_to_string_buf(const int *oid, int *oclass, char *buf); \param client_data data to be passed to func (custom defined) */ YAZ_EXPORT void yaz_oid_trav(yaz_oid_db_t oid_db, - void (*func)(const int *oid, - int oclass, const char *name, + void (*func)(const Odr_oid *oid, + oid_class oclass, const char *name, void *client_data), void *client_data); @@ -122,7 +146,7 @@ YAZ_EXPORT void yaz_oid_trav(yaz_oid_db_t oid_db, \retval 0 OID is not a MARC type */ YAZ_EXPORT -int yaz_oid_is_iso2709(const int *oid); +int yaz_oid_is_iso2709(const Odr_oid *oid); /** \brief adds new OID entry to database \param oid_db database @@ -134,7 +158,7 @@ int yaz_oid_is_iso2709(const int *oid); */ YAZ_EXPORT int yaz_oid_add(yaz_oid_db_t oid_db, int oclass, const char *name, - const int *new_oid); + const Odr_oid *new_oid); /** \brief creates empty OID database @@ -151,7 +175,7 @@ void yaz_oid_db_destroy(yaz_oid_db_t oid_db); struct yaz_oid_entry { int oclass; - const int *oid; + const Odr_oid *oid; char *name; }; diff --git a/include/yaz/oid_util.h b/include/yaz/oid_util.h index d655639..42b8c07 100644 --- a/include/yaz/oid_util.h +++ b/include/yaz/oid_util.h @@ -24,7 +24,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -/* $Id: oid_util.h,v 1.3 2007-05-07 12:04:06 adam Exp $ */ +/* $Id: oid_util.h,v 1.4 2007-05-08 08:22:35 adam Exp $ */ /** * \file oid_util.h @@ -40,6 +40,8 @@ YAZ_BEGIN_CDECL #define OID_SIZE 20 #define OID_STR_MAX 256 +typedef short Odr_oid; /* terminate by -1 */ + typedef enum oid_proto { PROTO_NOP=0, @@ -50,33 +52,12 @@ typedef enum oid_proto PROTO_HTTP } oid_proto; -typedef enum oid_class -{ - CLASS_NOP=0, - CLASS_APPCTX, - CLASS_ABSYN, - CLASS_ATTSET, - CLASS_TRANSYN, - CLASS_DIAGSET, - CLASS_RECSYN, - CLASS_RESFORM, - CLASS_ACCFORM, - CLASS_EXTSERV, - CLASS_USERINFO, - CLASS_ELEMSPEC, - CLASS_VARSET, - CLASS_SCHEMA, - CLASS_TAGSET, - CLASS_GENERAL, - CLASS_NEGOT -} oid_class; - -YAZ_EXPORT void oid_oidcpy(int *t, const int *s); -YAZ_EXPORT void oid_oidcat(int *t, const int *s); -YAZ_EXPORT int oid_oidcmp(const int *o1, const int *o2); -YAZ_EXPORT int oid_oidlen(const int *o); -YAZ_EXPORT char *oid_oid_to_dotstring(const int *oid, char *oidbuf); -YAZ_EXPORT int oid_dotstring_to_oid(const char *name, int *oid); +YAZ_EXPORT void oid_oidcpy(Odr_oid *t, const Odr_oid *s); +YAZ_EXPORT void oid_oidcat(Odr_oid *t, const Odr_oid *s); +YAZ_EXPORT int oid_oidcmp(const Odr_oid *o1, const Odr_oid *o2); +YAZ_EXPORT int oid_oidlen(const Odr_oid *o); +YAZ_EXPORT char *oid_oid_to_dotstring(const Odr_oid *oid, char *oidbuf); +YAZ_EXPORT int oid_dotstring_to_oid(const char *name, Odr_oid *oid); YAZ_END_CDECL diff --git a/include/yaz/otherinfo.h b/include/yaz/otherinfo.h index 69ce341..ed41c91 100644 --- a/include/yaz/otherinfo.h +++ b/include/yaz/otherinfo.h @@ -24,7 +24,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -/* $Id: otherinfo.h,v 1.10 2007-04-12 17:50:26 adam Exp $ */ +/* $Id: otherinfo.h,v 1.11 2007-05-08 08:22:35 adam Exp $ */ /** * \file otherinfo.h @@ -43,18 +43,18 @@ void yaz_oi_APDU(Z_APDU *apdu, Z_OtherInformation ***oip); YAZ_EXPORT Z_OtherInformationUnit *yaz_oi_update ( Z_OtherInformation **otherInformationP, ODR odr, - const int *oid, int categoryValue, int delete_flag); + const Odr_oid *oid, int categoryValue, int delete_flag); YAZ_EXPORT void yaz_oi_set_string_oid ( Z_OtherInformation **otherInformation, ODR odr, - const int *oid, int categoryValue, + const Odr_oid *oid, int categoryValue, const char *str); YAZ_EXPORT char *yaz_oi_get_string_oid ( Z_OtherInformation **otherInformation, - const int *oid, int categoryValue, int delete_flag); + const Odr_oid *oid, int categoryValue, int delete_flag); YAZ_END_CDECL diff --git a/include/yaz/prt-ext.h b/include/yaz/prt-ext.h index 5ac3b04..04d8adb 100644 --- a/include/yaz/prt-ext.h +++ b/include/yaz/prt-ext.h @@ -24,7 +24,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -/* $Id: prt-ext.h,v 1.19 2007-05-04 12:23:54 adam Exp $ */ +/* $Id: prt-ext.h,v 1.20 2007-05-08 08:22:35 adam Exp $ */ /** * \file prt-ext.h @@ -50,7 +50,7 @@ YAZ_BEGIN_CDECL */ typedef struct Z_ext_typeent { - int oid[OID_SIZE]; /* the direct-reference OID */ + Odr_oid oid[OID_SIZE]; /* the direct-reference OID */ int what; /* discriminator value for the external CHOICE */ Odr_fun fun; /* decoder function */ } Z_ext_typeent; @@ -139,9 +139,9 @@ struct Z_External /** \brief codec for BER EXTERNAL */ YAZ_EXPORT int z_External(ODR o, Z_External **p, int opt, const char *name); /** \brief returns type information for OID (NULL if not known) */ -YAZ_EXPORT Z_ext_typeent *z_ext_getentbyref(const int *oid); +YAZ_EXPORT Z_ext_typeent *z_ext_getentbyref(const Odr_oid *oid); /** \brief encodes EXTERNAL record based on OID (NULL if not known) */ -YAZ_EXPORT Z_External *z_ext_record_oid(ODR o, const int *oid, +YAZ_EXPORT Z_External *z_ext_record_oid(ODR o, const Odr_oid *oid, const char *buf, int len); /** \brief encodes EXTERNAL XML record */ YAZ_EXPORT Z_External *z_ext_record_xml(ODR o, const char *buf, int len); diff --git a/include/yaz/querytowrbuf.h b/include/yaz/querytowrbuf.h index 4d80c61..c89f8b0 100644 --- a/include/yaz/querytowrbuf.h +++ b/include/yaz/querytowrbuf.h @@ -24,7 +24,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -/* $Id: querytowrbuf.h,v 1.6 2007-04-12 13:52:57 adam Exp $ */ +/* $Id: querytowrbuf.h,v 1.7 2007-05-08 08:22:35 adam Exp $ */ /** * \file querytowrbuf.h * \brief Query to WRBUF (to strings) @@ -41,7 +41,7 @@ YAZ_BEGIN_CDECL YAZ_EXPORT void yaz_query_to_wrbuf(WRBUF b, const Z_Query *q); YAZ_EXPORT void yaz_scan_to_wrbuf(WRBUF b, const Z_AttributesPlusTerm *zapt, - const int *attribute_set); + const Odr_oid *attribute_set); YAZ_EXPORT void yaz_rpnquery_to_wrbuf(WRBUF b, const Z_RPNQuery *rpn); YAZ_EXPORT void wrbuf_diags(WRBUF b, int num_diagnostics,Z_DiagRec **diags); diff --git a/include/yaz/retrieval.h b/include/yaz/retrieval.h index e7463d2..a6ce256 100644 --- a/include/yaz/retrieval.h +++ b/include/yaz/retrieval.h @@ -24,7 +24,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -/* $Id: retrieval.h,v 1.9 2007-02-08 10:51:23 adam Exp $ */ +/* $Id: retrieval.h,v 1.10 2007-05-08 08:22:35 adam Exp $ */ /** * \file retrieval.h @@ -37,7 +37,7 @@ #include #include #include - +#include #include YAZ_BEGIN_CDECL @@ -106,11 +106,11 @@ int yaz_retrieval_configure(yaz_retrieval_t p, const xmlNode *node); */ YAZ_EXPORT int yaz_retrieval_request(yaz_retrieval_t p, - const char *schema, int *syntax, - const char **match_schema, int **match_syntax, + const char *schema, Odr_oid *syntax, + const char **match_schema, Odr_oid **match_syntax, yaz_record_conv_t *rc, const char **backend_schema, - int **backend_syntax); + Odr_oid **backend_syntax); /** returns error string (for last error) \param p record conversion handle diff --git a/src/grs1disp.c b/src/grs1disp.c index 43a5fa5..9195ea0 100644 --- a/src/grs1disp.c +++ b/src/grs1disp.c @@ -2,7 +2,7 @@ * Copyright (C) 1995-2007, Index Data ApS * See the file LICENSE for details. * - * $Id: grs1disp.c,v 1.7 2007-04-12 13:52:57 adam Exp $ + * $Id: grs1disp.c,v 1.8 2007-05-08 08:22:36 adam Exp $ */ /** @@ -77,12 +77,12 @@ static void display_grs1(WRBUF w, Z_GenericRecord *r, int level) } else if (t->content->which == Z_ElementData_oid) { - int *ip = t->content->u.oid; + Odr_oid *ip = t->content->u.oid; if (ip) { char oid_name_str[OID_STR_MAX]; - int oclass; + oid_class oclass; const char *oid_name = yaz_oid_to_string_buf(ip, &oclass, oid_name_str); diff --git a/src/logrpn.c b/src/logrpn.c index 085b311..9972020 100644 --- a/src/logrpn.c +++ b/src/logrpn.c @@ -2,7 +2,7 @@ * Copyright (C) 1995-2007, Index Data ApS * All rights reserved. * - * $Id: logrpn.c,v 1.17 2007-05-06 20:12:20 adam Exp $ + * $Id: logrpn.c,v 1.18 2007-05-08 08:22:36 adam Exp $ */ /** @@ -181,7 +181,7 @@ static void attrStr (int type, int value, char *str) * zlog_attributes: print attributes of term */ static void zlog_attributes(Z_AttributesPlusTerm *t, int depth, - const int *ast, int loglevel) + const Odr_oid *ast, int loglevel) { int of, i; char str[80]; @@ -268,7 +268,7 @@ static char *prox_unit_name(Z_ProximityOperator *op) } static void zlog_structure(Z_RPNStructure *zs, int depth, - const int *ast, int loglevel) + const Odr_oid *ast, int loglevel) { if (zs->which == Z_RPNStructure_complex) { @@ -349,7 +349,7 @@ void log_rpn_query(Z_RPNQuery *rpn) } void log_scan_term_level(int loglevel, - Z_AttributesPlusTerm *zapt, const int *ast) + Z_AttributesPlusTerm *zapt, const Odr_oid *ast) { int depth = 0; if (!loglevel) @@ -364,7 +364,7 @@ void log_scan_term_level(int loglevel, zlog_attributes(zapt, depth+2, ast, loglevel); } -void log_scan_term(Z_AttributesPlusTerm *zapt, const int *ast) +void log_scan_term(Z_AttributesPlusTerm *zapt, const Odr_oid *ast) { log_scan_term_level (YLOG_LOG, zapt, ast); } diff --git a/src/odr_oid.c b/src/odr_oid.c index 361fa2b..a9dc76c 100644 --- a/src/odr_oid.c +++ b/src/odr_oid.c @@ -2,7 +2,7 @@ * Copyright (C) 1995-2007, Index Data ApS * See the file LICENSE for details. * - * $Id: odr_oid.c,v 1.10 2007-04-12 13:52:57 adam Exp $ + * $Id: odr_oid.c,v 1.11 2007-05-08 08:22:36 adam Exp $ */ /** * \file odr_oid.c @@ -52,7 +52,7 @@ int odr_oid(ODR o, Odr_oid **p, int opt, const char *name) return 1; } if (o->direction == ODR_DECODE) - *p = (int *)odr_malloc(o, OID_SIZE * sizeof(**p)); + *p = (Odr_oid *)odr_malloc(o, OID_SIZE * sizeof(**p)); return ber_oidc(o, *p, OID_SIZE); } /* diff --git a/src/odr_util.c b/src/odr_util.c index c28c586..b42ee79 100644 --- a/src/odr_util.c +++ b/src/odr_util.c @@ -2,7 +2,7 @@ * Copyright (C) 1995-2007, Index Data ApS * See the file LICENSE for details. * - * $Id: odr_util.c,v 1.12 2007-04-12 20:47:28 adam Exp $ + * $Id: odr_util.c,v 1.13 2007-05-08 08:22:36 adam Exp $ */ /** * \file odr_util.c @@ -50,7 +50,8 @@ Odr_oid *odr_oiddup_nmem(NMEM nmem, const Odr_oid *o) if (!o) return 0; - if (!(r = (int *)nmem_malloc(nmem, (oid_oidlen(o) + 1) * sizeof(int)))) + if (!(r = (Odr_oid *) + nmem_malloc(nmem, (oid_oidlen(o) + 1) * sizeof(Odr_oid)))) return 0; oid_oidcpy(r, o); return r; @@ -63,12 +64,12 @@ Odr_oid *odr_oiddup(ODR odr, const Odr_oid *o) Odr_oid *odr_getoidbystr_nmem(NMEM nmem, const char *str) { - int oid[OID_SIZE]; - int *ret; + Odr_oid oid[OID_SIZE]; + Odr_oid *ret; if (oid_dotstring_to_oid(str, oid)) return 0; - ret = (int *)nmem_malloc(nmem, sizeof(*ret)*(oid_oidlen(oid) + 1)); + ret = (Odr_oid *)nmem_malloc(nmem, sizeof(*ret)*(oid_oidlen(oid) + 1)); oid_oidcpy(ret, oid); return ret; } diff --git a/src/oid_db.c b/src/oid_db.c index f1ec588..8318018 100644 --- a/src/oid_db.c +++ b/src/oid_db.c @@ -2,7 +2,7 @@ * Copyright (C) 1995-2007, Index Data ApS * See the file LICENSE for details. * - * $Id: oid_db.c,v 1.7 2007-05-06 20:12:20 adam Exp $ + * $Id: oid_db.c,v 1.8 2007-05-08 08:22:36 adam Exp $ */ /** @@ -38,8 +38,8 @@ yaz_oid_db_t yaz_oid_std(void) return standard_db; } -const int *yaz_string_to_oid(yaz_oid_db_t oid_db, - int oclass, const char *name) +const Odr_oid *yaz_string_to_oid(yaz_oid_db_t oid_db, + oid_class oclass, const char *name) { for (; oid_db; oid_db = oid_db->next) { @@ -61,23 +61,23 @@ const int *yaz_string_to_oid(yaz_oid_db_t oid_db, return 0; } -int *yaz_string_to_oid_nmem(yaz_oid_db_t oid_list, - int oclass, const char *name, NMEM nmem) +Odr_oid *yaz_string_to_oid_nmem(yaz_oid_db_t oid_list, + oid_class oclass, const char *name, NMEM nmem) { - const int *oid = yaz_string_to_oid(oid_list, oclass, name); + const Odr_oid *oid = yaz_string_to_oid(oid_list, oclass, name); if (oid) return odr_oiddup_nmem(nmem, oid); return odr_getoidbystr_nmem(nmem, name); } -int *yaz_string_to_oid_odr(yaz_oid_db_t oid_list, - int oclass, const char *name, ODR o) +Odr_oid *yaz_string_to_oid_odr(yaz_oid_db_t oid_list, + oid_class oclass, const char *name, ODR o) { return yaz_string_to_oid_nmem(oid_list, oclass, name, odr_getmem(o)); } const char *yaz_oid_to_string(yaz_oid_db_t oid_db, - const int *oid, int *oclass) + const Odr_oid *oid, oid_class *oclass) { if (!oid) return 0; @@ -97,7 +97,7 @@ const char *yaz_oid_to_string(yaz_oid_db_t oid_db, return 0; } -const char *yaz_oid_to_string_buf(const int *oid, int *oclass, char *buf) +const char *yaz_oid_to_string_buf(const Odr_oid *oid, oid_class *oclass, char *buf) { const char *p = yaz_oid_to_string(standard_db, oid, oclass); if (p) @@ -107,7 +107,7 @@ const char *yaz_oid_to_string_buf(const int *oid, int *oclass, char *buf) return oid_oid_to_dotstring(oid, buf); } -int yaz_oid_is_iso2709(const int *oid) +int yaz_oid_is_iso2709(const Odr_oid *oid) { if (oid_oidlen(oid) == 6 && oid[0] == 1 && oid[1] == 2 && oid[2] == 840 && oid[3] == 10003 && oid[4] == 5 @@ -117,13 +117,13 @@ int yaz_oid_is_iso2709(const int *oid) } int yaz_oid_add(yaz_oid_db_t oid_db, int oclass, const char *name, - const int *new_oid) + const Odr_oid *new_oid) { - const int *oid = yaz_string_to_oid(oid_db, oclass, name); + const Odr_oid *oid = yaz_string_to_oid(oid_db, oclass, name); if (!oid) { struct yaz_oid_entry *ent; - int *alloc_oid; + Odr_oid *alloc_oid; while (oid_db->next) oid_db = oid_db->next; @@ -134,7 +134,7 @@ int yaz_oid_add(yaz_oid_db_t oid_db, int oclass, const char *name, oid_db->xmalloced = 1; oid_db->entries = ent = (struct yaz_oid_entry *) xmalloc(2 * sizeof(*ent)); - alloc_oid = (int *) + alloc_oid = (Odr_oid *) xmalloc(sizeof(*alloc_oid) * (oid_oidlen(new_oid)+1)); oid_oidcpy(alloc_oid, new_oid); ent[0].oid = alloc_oid; @@ -177,8 +177,8 @@ void yaz_oid_db_destroy(yaz_oid_db_t oid_db) } void yaz_oid_trav(yaz_oid_db_t oid_db, - void (*func)(const int *oid, - int oclass, const char *name, + void (*func)(const Odr_oid *oid, + oid_class oclass, const char *name, void *client_data), void *client_data) { diff --git a/src/oid_util.c b/src/oid_util.c index 93d724b..c630ebf 100644 --- a/src/oid_util.c +++ b/src/oid_util.c @@ -2,7 +2,7 @@ * Copyright (C) 1995-2007, Index Data ApS * See the file LICENSE for details. * - * $Id: oid_util.c,v 1.3 2007-04-13 07:04:42 adam Exp $ + * $Id: oid_util.c,v 1.4 2007-05-08 08:22:36 adam Exp $ */ /** @@ -21,19 +21,19 @@ #include #include -void oid_oidcpy(int *t, const int *s) +void oid_oidcpy(Odr_oid *t, const Odr_oid *s) { while ((*(t++) = *(s++)) > -1); } -void oid_oidcat(int *t, const int *s) +void oid_oidcat(Odr_oid *t, const Odr_oid *s) { while (*t > -1) t++; while ((*(t++) = *(s++)) > -1); } -int oid_oidcmp(const int *o1, const int *o2) +int oid_oidcmp(const Odr_oid *o1, const Odr_oid *o2) { while (*o1 == *o2 && *o1 > -1) { @@ -48,7 +48,7 @@ int oid_oidcmp(const int *o1, const int *o2) return -1; } -int oid_oidlen(const int *o) +int oid_oidlen(const Odr_oid *o) { int len = 0; @@ -58,7 +58,7 @@ int oid_oidlen(const int *o) } -char *oid_oid_to_dotstring(const int *oid, char *oidbuf) +char *oid_oid_to_dotstring(const Odr_oid *oid, char *oidbuf) { char tmpbuf[20]; int i; @@ -74,7 +74,7 @@ char *oid_oid_to_dotstring(const int *oid, char *oidbuf) return oidbuf; } -int oid_dotstring_to_oid(const char *name, int *oid) +int oid_dotstring_to_oid(const char *name, Odr_oid *oid) { int i = 0; int val = 0; diff --git a/src/oidtoc.tcl b/src/oidtoc.tcl index c57a56e..2cbe66e 100644 --- a/src/oidtoc.tcl +++ b/src/oidtoc.tcl @@ -2,7 +2,7 @@ # Copyright (c) Index Data 2006-2007 # See the file LICENSE for details. # -# $Id: oidtoc.tcl,v 1.6 2007-05-07 13:18:32 adam Exp $ +# $Id: oidtoc.tcl,v 1.7 2007-05-08 08:22:36 adam Exp $ # # Converts a CSV file with Object identifiers to C @@ -123,11 +123,11 @@ proc oid_to_c {srcdir input cname hname} { set v [constant_var $oid] - puts -nonewline $cfile "YAZ_EXPORT const int $v\[\] = \{" + puts -nonewline $cfile "YAZ_EXPORT const Odr_oid $v\[\] = \{" puts -nonewline $cfile [string map {. ,} [lindex $oid 1]] puts $cfile ",-1\};" - puts $hfile "OID_EXPORT extern const int $v\[\];" + puts $hfile "OID_EXPORT extern const Odr_oid $v\[\];" } puts $cfile "YAZ_EXPORT struct yaz_oid_entry yaz_oid_standard_entries\[\] =" diff --git a/src/otherinfo.c b/src/otherinfo.c index 7aac192..de6e94f 100644 --- a/src/otherinfo.c +++ b/src/otherinfo.c @@ -2,7 +2,7 @@ * Copyright (C) 1995-2007, Index Data ApS * See the file LICENSE for details. * - * $Id: otherinfo.c,v 1.7 2007-04-12 13:52:57 adam Exp $ + * $Id: otherinfo.c,v 1.8 2007-05-08 08:22:36 adam Exp $ */ /** * \file otherinfo.c @@ -73,7 +73,7 @@ void yaz_oi_APDU(Z_APDU *apdu, Z_OtherInformation ***oip) Z_OtherInformationUnit *yaz_oi_update ( Z_OtherInformation **otherInformationP, ODR odr, - const int *oid, int categoryValue, int delete_flag) + const Odr_oid *oid, int categoryValue, int delete_flag) { int i; Z_OtherInformation *otherInformation; @@ -138,12 +138,10 @@ Z_OtherInformationUnit *yaz_oi_update ( { otherInformation->list[i]->category = (Z_InfoCategory*) odr_malloc (odr, sizeof(Z_InfoCategory)); - otherInformation->list[i]->category->categoryTypeId = (int*) + otherInformation->list[i]->category->categoryTypeId = (Odr_oid*) odr_oiddup (odr, oid); - otherInformation->list[i]->category->categoryValue = (int*) - odr_malloc (odr, sizeof(int)); - *otherInformation->list[i]->category->categoryValue = - categoryValue; + otherInformation->list[i]->category->categoryValue = + odr_intdup(odr, categoryValue); } else otherInformation->list[i]->category = 0; @@ -157,7 +155,7 @@ Z_OtherInformationUnit *yaz_oi_update ( void yaz_oi_set_string_oid ( Z_OtherInformation **otherInformation, ODR odr, - const int *oid, int categoryValue, + const Odr_oid *oid, int categoryValue, const char *str) { Z_OtherInformationUnit *oi = @@ -170,7 +168,7 @@ void yaz_oi_set_string_oid ( char *yaz_oi_get_string_oid ( Z_OtherInformation **otherInformation, - const int *oid, int categoryValue, int delete_flag) + const Odr_oid *oid, int categoryValue, int delete_flag) { Z_OtherInformationUnit *oi; diff --git a/src/pquery.c b/src/pquery.c index de99f0c..dcb0cb5 100644 --- a/src/pquery.c +++ b/src/pquery.c @@ -2,7 +2,7 @@ * Copyright (C) 1995-2007, Index Data ApS * See the file LICENSE for details. * - * $Id: pquery.c,v 1.11 2007-04-16 21:53:09 adam Exp $ + * $Id: pquery.c,v 1.12 2007-05-08 08:22:36 adam Exp $ */ /** * \file pquery.c @@ -34,13 +34,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 +186,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 +242,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 +352,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 +362,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 +487,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 +564,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 +627,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); @@ -689,10 +689,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); diff --git a/src/prt-ext.c b/src/prt-ext.c index 5c18d68..3770d36 100644 --- a/src/prt-ext.c +++ b/src/prt-ext.c @@ -2,7 +2,7 @@ * Copyright (C) 1995-2007, Index Data ApS * See the file LICENSE for details. * - * $Id: prt-ext.c,v 1.12 2007-05-05 10:26:31 adam Exp $ + * $Id: prt-ext.c,v 1.13 2007-05-08 08:22:36 adam Exp $ */ /** @@ -56,7 +56,7 @@ static Z_ext_typeent type_table[] = {{-1}, 0, 0} }; -Z_ext_typeent *z_ext_getentbyref(const int *oid) +Z_ext_typeent *z_ext_getentbyref(const Odr_oid *oid) { Z_ext_typeent *p; @@ -239,12 +239,12 @@ int z_External(ODR o, Z_External **p, int opt, const char *name) odr_sequence_end(o); } -Z_External *z_ext_record_oid(ODR o, const int *oid, const char *buf, int len) +Z_External *z_ext_record_oid(ODR o, const Odr_oid *oid, const char *buf, int len) { Z_External *thisext; char oid_str_buf[OID_STR_MAX]; const char *oid_str; - int oclass; + oid_class oclass; if (!oid) return 0; diff --git a/src/querytowrbuf.c b/src/querytowrbuf.c index 56aa42b..2cfd081 100644 --- a/src/querytowrbuf.c +++ b/src/querytowrbuf.c @@ -2,7 +2,7 @@ * Copyright (C) 1995-2007, Index Data ApS * All rights reserved. * - * $Id: querytowrbuf.c,v 1.10 2007-05-06 20:12:20 adam Exp $ + * $Id: querytowrbuf.c,v 1.11 2007-05-08 08:22:36 adam Exp $ */ /** \file querytowrbuf.c @@ -225,7 +225,7 @@ void yaz_query_to_wrbuf(WRBUF b, const Z_Query *q) } void yaz_scan_to_wrbuf(WRBUF b, const Z_AttributesPlusTerm *zapt, - const int *attrbute_set) + const Odr_oid *attrbute_set) { /* should print attr set here */ wrbuf_printf(b, "RPN "); diff --git a/src/retrieval.c b/src/retrieval.c index 329f45e..982afc9 100644 --- a/src/retrieval.c +++ b/src/retrieval.c @@ -2,7 +2,7 @@ * Copyright (C) 2005-2007, Index Data ApS * See the file LICENSE for details. * - * $Id: retrieval.c,v 1.20 2007-05-06 20:12:20 adam Exp $ + * $Id: retrieval.c,v 1.21 2007-05-08 08:22:36 adam Exp $ */ /** * \file retrieval.c @@ -55,12 +55,12 @@ struct yaz_retrieval_elem { /** \brief schema name , short-hand such as "dc" */ const char *name; /** \brief record syntax */ - int *syntax; + Odr_oid *syntax; /** \brief backend name */ const char *backend_name; /** \brief backend syntax */ - int *backend_syntax; + Odr_oid *backend_syntax; /** \brief record conversion */ yaz_record_conv_t record_conv; @@ -275,11 +275,11 @@ int yaz_retrieval_configure(yaz_retrieval_t p, const xmlNode *ptr) } int yaz_retrieval_request(yaz_retrieval_t p, - const char *schema, int *syntax, - const char **match_schema, int **match_syntax, + const char *schema, Odr_oid *syntax, + const char **match_schema, Odr_oid **match_syntax, yaz_record_conv_t *rc, const char **backend_schema, - int **backend_syntax) + Odr_oid **backend_syntax) { struct yaz_retrieval_elem *el = p->list; int syntax_matches = 0; diff --git a/src/seshigh.c b/src/seshigh.c index 4b8b89e..1c4040c 100644 --- a/src/seshigh.c +++ b/src/seshigh.c @@ -2,7 +2,7 @@ * Copyright (C) 1995-2007, Index Data ApS * See the file LICENSE for details. * - * $Id: seshigh.c,v 1.118 2007-05-06 20:12:20 adam Exp $ + * $Id: seshigh.c,v 1.119 2007-05-08 08:22:36 adam Exp $ */ /** * \file seshigh.c @@ -584,7 +584,7 @@ static int retrieve_fetch(association *assoc, bend_fetch_rr *rr) #if YAZ_HAVE_XML2 yaz_record_conv_t rc = 0; const char *match_schema = 0; - int *match_syntax = 0; + Odr_oid *match_syntax = 0; if (assoc->server) { @@ -2358,7 +2358,7 @@ static Z_APDU *process_initRequest(association *assoc, request *reqb) assoc->init->implementation_name, odr_prepend(assoc->encode, "GFS", resp->implementationName)); - version = odr_strdup(assoc->encode, "$Revision: 1.118 $"); + version = odr_strdup(assoc->encode, "$Revision: 1.119 $"); if (strlen(version) > 10) /* check for unexpanded CVS strings */ version[strlen(version)-2] = '\0'; resp->implementationVersion = odr_prepend(assoc->encode, @@ -2472,7 +2472,7 @@ static Z_Records *pack_records(association *a, char *setname, int start, int *num, Z_RecordComposition *comp, int *next, int *pres, Z_ReferenceId *referenceId, - int *oid, int *errcode) + Odr_oid *oid, int *errcode) { int recno, total_length = 0, toget = *num, dumped_records = 0; Z_Records *records = diff --git a/src/zoom-c.c b/src/zoom-c.c index 4d55399..f16b0d1 100644 --- a/src/zoom-c.c +++ b/src/zoom-c.c @@ -2,7 +2,7 @@ * Copyright (C) 1995-2007, Index Data ApS * See the file LICENSE for details. * - * $Id: zoom-c.c,v 1.129 2007-05-06 20:12:20 adam Exp $ + * $Id: zoom-c.c,v 1.130 2007-05-08 08:22:36 adam Exp $ */ /** * \file zoom-c.c @@ -47,9 +47,9 @@ static char *cql2pqf(ZOOM_connection c, const char *cql); * This wrapper is just for logging failed lookups. It would be nicer * if it could cause failure when a lookup fails, but that's hard. */ -static int *zoom_yaz_str_to_z3950oid(ZOOM_connection c, +static Odr_oid *zoom_yaz_str_to_z3950oid(ZOOM_connection c, int oid_class, const char *str) { - int *res = yaz_string_to_oid_odr(yaz_oid_std(), oid_class, str, + Odr_oid *res = yaz_string_to_oid_odr(yaz_oid_std(), oid_class, str, c->odr_out); if (res == 0) yaz_log(YLOG_WARN, "%p OID lookup (%d, '%s') failed", @@ -1225,7 +1225,7 @@ static void otherInfo_attach(ZOOM_connection c, Z_APDU *a, ODR out) for (i = 0; i<200; i++) { size_t len; - int *oid; + Odr_oid *oid; Z_OtherInformation **oi; char buf[80]; const char *val; @@ -1341,7 +1341,7 @@ static zoom_ret ZOOM_connection_send_init(ZOOM_connection c) odr_prepend(c->odr_out, "ZOOM-C", ireq->implementationName)); - version = odr_strdup(c->odr_out, "$Revision: 1.129 $"); + version = odr_strdup(c->odr_out, "$Revision: 1.130 $"); if (strlen(version) > 10) /* check for unexpanded CVS strings */ version[strlen(version)-2] = '\0'; ireq->implementationVersion = @@ -1666,7 +1666,7 @@ static zoom_ret ZOOM_connection_send_search(ZOOM_connection c) static void response_default_diag(ZOOM_connection c, Z_DefaultDiagFormat *r) { - int oclass; + oid_class oclass; char *addinfo = 0; switch (r->which) @@ -1889,7 +1889,7 @@ ZOOM_API(int) if (diag_rec->which == Z_DiagRec_defaultFormat) { Z_DefaultDiagFormat *ddf = diag_rec->u.defaultFormat; - int oclass; + oid_class oclass; error = *ddf->condition; switch (ddf->which) @@ -2003,7 +2003,7 @@ ZOOM_API(const char *) if (!strcmp(type, "render")) { Z_External *r = (Z_External *) npr->u.databaseRecord; - const int *oid = r->direct_reference; + const Odr_oid *oid = r->direct_reference; /* render bibliographic record .. */ if (r->which == Z_External_OPAC) @@ -2051,7 +2051,7 @@ ZOOM_API(const char *) else if (!strcmp(type, "xml")) { Z_External *r = (Z_External *) npr->u.databaseRecord; - const int *oid = r->direct_reference; + const Odr_oid *oid = r->direct_reference; /* render bibliographic record .. */ if (r->which == Z_External_OPAC) @@ -2887,7 +2887,7 @@ ZOOM_API(void) ZOOM_options_set(scan->options, key, val); } -static Z_APDU *create_es_package(ZOOM_package p, const int *oid) +static Z_APDU *create_es_package(ZOOM_package p, const Odr_oid *oid) { const char *str; Z_APDU *apdu = zget_APDU(p->odr_out, Z_APDU_extendedServicesRequest); @@ -3115,7 +3115,7 @@ static Z_APDU *create_update_package(ZOOM_package p) const char *record_buf = ZOOM_options_get(p->options, "record"); const char *syntax_str = ZOOM_options_get(p->options, "syntax"); int action_no = -1; - int *syntax_oid = 0; + Odr_oid *syntax_oid = 0; if (!syntax_str) syntax_str = "xml"; diff --git a/ztest/ztest.c b/ztest/ztest.c index 2ce7b90..cda0bab 100644 --- a/ztest/ztest.c +++ b/ztest/ztest.c @@ -2,7 +2,7 @@ * Copyright (C) 1995-2007, Index Data ApS * See the file LICENSE for details. * - * $Id: ztest.c,v 1.90 2007-05-02 12:36:35 adam Exp $ + * $Id: ztest.c,v 1.91 2007-05-08 08:22:37 adam Exp $ */ /* @@ -138,7 +138,7 @@ int ztest_esrequest (void *handle, bend_esrequest_rr *rr) if (r->direct_reference) { char oid_name_str[OID_STR_MAX]; - int oclass; + oid_class oclass; const char *oid_name = yaz_oid_to_string_buf(r->direct_reference, &oclass, oid_name_str); @@ -460,10 +460,10 @@ int ztest_present (void *handle, bend_present_rr *rr) int ztest_fetch(void *handle, bend_fetch_rr *r) { char *cp; - int oclass; + oid_class oclass; char oid_str_buf[OID_STR_MAX]; const char *oid_str = 0; - const int *oid = r->request_format; + const Odr_oid *oid = r->request_format; r->last_in_set = 0; r->basename = "Default"; -- 1.7.10.4