From 044d170f0a963555486df54653cd2fdc5815928b Mon Sep 17 00:00:00 2001 From: Adam Dickmeiss Date: Wed, 11 Feb 1998 11:53:21 +0000 Subject: [PATCH] Changed code so that it compiles as C++. --- CHANGELOG | 6 ++ asn/proto.c | 261 +++++++++++++++++++++++++------------------------ asn/prt-acc.c | 35 ++++--- asn/prt-add.c | 17 ++-- asn/prt-arc.c | 17 ++-- asn/prt-dat.c | 48 +++++---- asn/prt-dia.c | 147 ++++++++++++++-------------- asn/prt-esp.c | 43 ++++---- asn/prt-exd.c | 49 +++++----- asn/prt-exp.c | 203 +++++++++++++++++++------------------- asn/prt-ext.c | 71 +++++++------- asn/prt-grs.c | 67 +++++++------ asn/prt-rsc.c | 9 +- asn/zget.c | 129 ++++++++++++------------ ccl/cclerrms.c | 8 +- ccl/cclfind.c | 17 ++-- ccl/cclqual.c | 13 ++- ccl/ccltoken.c | 15 +-- client/Makefile | 6 +- client/client.c | 47 ++++----- comstack/tcpip.c | 50 ++++++---- include/ccl.h | 7 +- include/odr.h | 9 +- include/prt-exd.h | 2 +- include/prt-exp.h | 2 +- include/prt-ext.h | 2 +- include/prt.h | 7 +- odr/ber_any.c | 7 +- odr/ber_oct.c | 7 +- odr/ber_tag.c | 7 +- odr/odr.c | 9 +- odr/odr_any.c | 7 +- odr/odr_bit.c | 7 +- odr/odr_bool.c | 7 +- odr/odr_choice.c | 13 ++- odr/odr_int.c | 7 +- odr/odr_mem.c | 9 +- odr/odr_oct.c | 9 +- odr/odr_oid.c | 7 +- odr/odr_seq.c | 11 ++- odr/odr_tag.c | 7 +- odr/odr_use.c | 11 ++- odr/odr_util.c | 9 +- retrieval/d1_absyn.c | 29 +++--- retrieval/d1_attset.c | 13 ++- retrieval/d1_espec.c | 63 ++++++------ retrieval/d1_expout.c | 57 ++++++----- retrieval/d1_grs.c | 43 ++++---- retrieval/d1_handle.c | 9 +- retrieval/d1_map.c | 19 ++-- retrieval/d1_marc.c | 11 ++- retrieval/d1_read.c | 11 ++- retrieval/d1_sumout.c | 11 ++- retrieval/d1_tagset.c | 11 ++- retrieval/d1_varset.c | 11 ++- rfc1006/Makefile | 8 +- server/eventl.c | 9 +- server/requestq.c | 7 +- server/seshigh.c | 140 +++++++++++++------------- server/session.h | 32 +++--- server/statserv.c | 9 +- util/marcdump.c | 7 +- util/nmem.c | 11 ++- util/nmemsdup.c | 7 +- util/pquery.c | 47 ++++----- util/wrbuf.c | 11 ++- util/xmalloc.c | 7 +- util/yaz-ccl.c | 33 ++++--- ztest/read-grs.c | 23 +++-- ztest/ztest.c | 18 ++-- 70 files changed, 1148 insertions(+), 930 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index b56d5ac..4845b03 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,5 +1,11 @@ Possible compatibility problems with earlier versions marked with '*'. +* Changed code so that it compiles under C++. The type definition +of Odr_fun which is a member of Odr_arm was changed. The result is, +that an explicit typecast is needed for the fun pointer when +using Odr_arm - as in: + {1, -1, -1, Z_IdAuthentication_idPass, (Odr_fun)z_IdPass}, + Updated TagSet-G and -M definitions (tagsetm.tag and tagsetg.tag). Implemented the new structured date and time definition as approved diff --git a/asn/proto.c b/asn/proto.c index 9bcdde7..3054cc2 100644 --- a/asn/proto.c +++ b/asn/proto.c @@ -4,7 +4,10 @@ * Sebastian Hammer, Adam Dickmeiss * * $Log: proto.c,v $ - * Revision 1.54 1996-11-11 13:14:46 adam + * Revision 1.55 1998-02-11 11:53:32 adam + * Changed code so that it compiles as C++. + * + * Revision 1.54 1996/11/11 13:14:46 adam * Fixed tagging bug in z_ProximityOperator. * * Revision 1.53 1996/10/09 15:54:55 quinn @@ -234,10 +237,10 @@ int z_OtherInformationUnit(ODR o, Z_OtherInformationUnit **p, int opt) {ODR_IMPLICIT, ODR_CONTEXT, 2, Z_OtherInfo_characterInfo, odr_visiblestring}, {ODR_IMPLICIT, ODR_CONTEXT, 3, Z_OtherInfo_binaryInfo, - odr_octetstring}, + (Odr_fun)odr_octetstring}, {ODR_IMPLICIT, ODR_CONTEXT, 4, Z_OtherInfo_externallyDefinedInfo, - z_External}, - {ODR_IMPLICIT, ODR_CONTEXT, 5, Z_OtherInfo_oid, odr_oid}, + (Odr_fun)z_External}, + {ODR_IMPLICIT, ODR_CONTEXT, 5, Z_OtherInfo_oid, (Odr_fun)odr_oid}, {-1, -1, -1, -1, 0} }; @@ -252,11 +255,11 @@ int z_OtherInformationUnit(ODR o, Z_OtherInformationUnit **p, int opt) int z_OtherInformation(ODR o, Z_OtherInformation **p, int opt) { if (o->direction == ODR_DECODE) - *p = odr_malloc(o, sizeof(**p)); + *p = (Z_OtherInformation *)odr_malloc(o, sizeof(**p)); else if (!*p) return opt; odr_implicit_settag(o, ODR_CONTEXT, 201); - if (odr_sequence_of(o, z_OtherInformationUnit, &(*p)->list, + if (odr_sequence_of(o, (Odr_fun)z_OtherInformationUnit, &(*p)->list, &(*p)->num_elements)) return 1; *p = 0; @@ -270,12 +273,12 @@ int z_StringOrNumeric(ODR o, Z_StringOrNumeric **p, int opt) {ODR_IMPLICIT, ODR_CONTEXT, 1, Z_StringOrNumeric_string, odr_visiblestring}, {ODR_IMPLICIT, ODR_CONTEXT, 2, Z_StringOrNumeric_numeric, - odr_integer}, + (Odr_fun)odr_integer}, {-1, -1, -1, -1, 0} }; if (o->direction == ODR_DECODE) - *p = odr_malloc(o, sizeof(**p)); + *p = (Z_StringOrNumeric *)odr_malloc(o, sizeof(**p)); else if (!*p) return opt; if (odr_choice(o, arm, &(*p)->u, &(*p)->which)) @@ -314,10 +317,10 @@ int z_IntUnit(ODR o, Z_IntUnit **p, int opt) int z_StringList(ODR o, Z_StringList **p, int opt) { if (o->direction == ODR_DECODE) - *p = odr_malloc(o, sizeof(**p)); + *p = (Z_StringList *)odr_malloc(o, sizeof(**p)); else if (!*p) return opt; - if (odr_sequence_of(o, z_InternationalString, &(*p)->strings, + if (odr_sequence_of(o, (Odr_fun)z_InternationalString, &(*p)->strings, &(*p)->num_strings)) return 1; *p = 0; @@ -361,14 +364,14 @@ int z_IdAuthentication(ODR o, Z_IdAuthentication **p, int opt) static Odr_arm arm[] = { {-1, -1, -1, Z_IdAuthentication_open, z_StrAuthentication}, - {-1, -1, -1, Z_IdAuthentication_idPass, z_IdPass}, - {-1, -1, -1, Z_IdAuthentication_anonymous, odr_null}, - {-1, -1, -1, Z_IdAuthentication_other, z_External}, + {-1, -1, -1, Z_IdAuthentication_idPass, (Odr_fun)z_IdPass}, + {-1, -1, -1, Z_IdAuthentication_anonymous, (Odr_fun)odr_null}, + {-1, -1, -1, Z_IdAuthentication_other, (Odr_fun)z_External}, {-1, -1, -1, -1, 0} }; if (o->direction == ODR_DECODE) - *p = odr_malloc(o, sizeof(**p)); + *p = (Z_IdAuthentication *)odr_malloc(o, sizeof(**p)); else if (!*p) return opt; @@ -511,12 +514,12 @@ int z_DatabaseSpecificUnit(ODR o, Z_DatabaseSpecificUnit **p, int opt) int z_DatabaseSpecific(ODR o, Z_DatabaseSpecific **p, int opt) { if (o->direction == ODR_DECODE) - *p = odr_malloc(o, sizeof(**p)); + *p = (Z_DatabaseSpecific *)odr_malloc(o, sizeof(**p)); else if (!*p) return opt; odr_implicit_settag(o, ODR_CONTEXT, 1); - if (odr_sequence_of(o, z_DatabaseSpecificUnit, &(*p)->elements, + if (odr_sequence_of(o, (Odr_fun)z_DatabaseSpecificUnit, &(*p)->elements, &(*p)->num_elements)) return 1; *p = 0; @@ -530,12 +533,12 @@ int z_ElementSetNames(ODR o, Z_ElementSetNames **p, int opt) {ODR_IMPLICIT, ODR_CONTEXT, 0, Z_ElementSetNames_generic, z_ElementSetName}, {ODR_IMPLICIT, ODR_CONTEXT, 1, Z_ElementSetNames_databaseSpecific, - z_DatabaseSpecific}, + (Odr_fun)z_DatabaseSpecific}, {-1, -1, -1, -1, 0} }; if (o->direction == ODR_DECODE) - *p = odr_malloc(o, sizeof(**p)); + *p = (Z_ElementSetNames *)odr_malloc(o, sizeof(**p)); else if (!*p) return opt && odr_ok(o); @@ -553,10 +556,10 @@ int z_ComplexAttribute(ODR o, Z_ComplexAttribute **p, int opt) return opt && odr_ok(o); return odr_implicit_settag(o, ODR_CONTEXT, 1) && - odr_sequence_of(o, z_StringOrNumeric, &(*p)->list, + odr_sequence_of(o, (Odr_fun)z_StringOrNumeric, &(*p)->list, &(*p)->num_list) && odr_implicit_settag(o, ODR_CONTEXT, 2) && - (odr_sequence_of(o, odr_integer, &(*p)->semanticAction, + (odr_sequence_of(o, (Odr_fun)odr_integer, &(*p)->semanticAction, &(*p)->num_semanticAction) || odr_ok(o)) && odr_sequence_end(o); } @@ -567,9 +570,9 @@ int z_AttributeElement(ODR o, Z_AttributeElement **p, int opt) static Odr_arm arm[] = { {ODR_IMPLICIT, ODR_CONTEXT, 121, Z_AttributeValue_numeric, - odr_integer}, + (Odr_fun)odr_integer}, {ODR_IMPLICIT, ODR_CONTEXT, 224, Z_AttributeValue_complex, - z_ComplexAttribute}, + (Odr_fun)z_ComplexAttribute}, {-1, -1, -1, -1, 0} }; #endif @@ -595,20 +598,20 @@ int z_Term(ODR o, Z_Term **p, int opt) { static Odr_arm arm[] = { - {ODR_IMPLICIT, ODR_CONTEXT, 45, Z_Term_general, odr_octetstring}, - {ODR_IMPLICIT, ODR_CONTEXT, 215, Z_Term_numeric, odr_integer}, + {ODR_IMPLICIT, ODR_CONTEXT, 45, Z_Term_general, (Odr_fun)odr_octetstring}, + {ODR_IMPLICIT, ODR_CONTEXT, 215, Z_Term_numeric, (Odr_fun)odr_integer}, {ODR_IMPLICIT, ODR_CONTEXT, 216, Z_Term_characterString, odr_visiblestring}, - {ODR_IMPLICIT, ODR_CONTEXT, 217, Z_Term_oid, odr_oid}, + {ODR_IMPLICIT, ODR_CONTEXT, 217, Z_Term_oid, (Odr_fun)odr_oid}, {ODR_IMPLICIT, ODR_CONTEXT, 218, Z_Term_dateTime, odr_cstring}, - {ODR_IMPLICIT, ODR_CONTEXT, 219, Z_Term_external, z_External}, + {ODR_IMPLICIT, ODR_CONTEXT, 219, Z_Term_external, (Odr_fun)z_External}, /* add intUnit here */ - {ODR_IMPLICIT, ODR_CONTEXT, 221, Z_Term_null, odr_null}, + {ODR_IMPLICIT, ODR_CONTEXT, 221, Z_Term_null, (Odr_fun)odr_null}, {-1, -1, -1, -1, 0} }; if (o->direction ==ODR_DECODE) - *p = odr_malloc(o, sizeof(**p)); + *p = (Z_Term *)odr_malloc(o, sizeof(**p)); else if (!*p) return opt; if (odr_choice(o, arm, &(*p)->u, &(*p)->which)) @@ -624,7 +627,7 @@ int z_AttributesPlusTerm(ODR o, Z_AttributesPlusTerm **p, int opt) return opt && odr_ok(o); return odr_implicit_settag(o, ODR_CONTEXT, 44) && - odr_sequence_of(o, z_AttributeElement, &(*p)->attributeList, + odr_sequence_of(o, (Odr_fun)z_AttributeElement, &(*p)->attributeList, &(*p)->num_attributes) && z_Term(o, &(*p)->term, 0) && odr_sequence_end(o); @@ -638,7 +641,7 @@ int z_ResultSetPlusAttributes(ODR o, Z_ResultSetPlusAttributes **p, int opt) return z_ResultSetId(o, &(*p)->resultSet, 0) && odr_implicit_settag(o, ODR_CONTEXT, 44) && - odr_sequence_of(o, z_AttributeElement, &(*p)->attributeList, + odr_sequence_of(o, (Odr_fun)z_AttributeElement, &(*p)->attributeList, &(*p)->num_attributes) && odr_sequence_end(o); } @@ -647,8 +650,8 @@ int z_ProximityOperator(ODR o, Z_ProximityOperator **p, int opt) { static Odr_arm arm[] = { - {ODR_IMPLICIT, ODR_CONTEXT, 1, Z_ProxCode_known, odr_integer}, - {ODR_IMPLICIT, ODR_CONTEXT, 2, Z_ProxCode_private, odr_integer}, + {ODR_IMPLICIT, ODR_CONTEXT, 1, Z_ProxCode_known, (Odr_fun)odr_integer}, + {ODR_IMPLICIT, ODR_CONTEXT, 2, Z_ProxCode_private, (Odr_fun)odr_integer}, {-1, -1, -1, -1, 0} }; @@ -669,10 +672,10 @@ int z_Operator(ODR o, Z_Operator **p, int opt) { static Odr_arm arm[] = { - {ODR_IMPLICIT, ODR_CONTEXT, 0, Z_Operator_and, odr_null}, - {ODR_IMPLICIT, ODR_CONTEXT, 1, Z_Operator_or, odr_null}, - {ODR_IMPLICIT, ODR_CONTEXT, 2, Z_Operator_and_not, odr_null}, - {ODR_IMPLICIT, ODR_CONTEXT, 3, Z_Operator_prox, z_ProximityOperator}, + {ODR_IMPLICIT, ODR_CONTEXT, 0, Z_Operator_and, (Odr_fun)odr_null}, + {ODR_IMPLICIT, ODR_CONTEXT, 1, Z_Operator_or, (Odr_fun)odr_null}, + {ODR_IMPLICIT, ODR_CONTEXT, 2, Z_Operator_and_not, (Odr_fun)odr_null}, + {ODR_IMPLICIT, ODR_CONTEXT, 3, Z_Operator_prox, (Odr_fun)z_ProximityOperator}, {-1, -1, -1, -1, 0} }; @@ -681,7 +684,7 @@ int z_Operator(ODR o, Z_Operator **p, int opt) if (!odr_constructed_begin(o, p, ODR_CONTEXT, 46)) return opt && odr_ok(o); if (o->direction == ODR_DECODE) - *p = odr_malloc(o, sizeof(**p)); + *p = (Z_Operator *)odr_malloc(o, sizeof(**p)); if (odr_choice(o, arm, &(*p)->u, &(*p)->which) && odr_constructed_end(o)) @@ -694,14 +697,14 @@ int z_Operand(ODR o, Z_Operand **p, int opt) { static Odr_arm arm[] = { - {-1, -1, -1, Z_Operand_APT, z_AttributesPlusTerm}, - {-1, -1, -1, Z_Operand_resultSetId, z_ResultSetId}, - {-1, -1, -1, Z_Operand_resultAttr, z_ResultSetPlusAttributes}, + {-1, -1, -1, Z_Operand_APT, (Odr_fun)z_AttributesPlusTerm}, + {-1, -1, -1, Z_Operand_resultSetId, (Odr_fun)z_ResultSetId}, + {-1, -1, -1, Z_Operand_resultAttr, (Odr_fun)z_ResultSetPlusAttributes}, {-1, -1, -1, -1, 0} }; if (o->direction == ODR_DECODE) - *p = odr_malloc(o, sizeof(**p)); + *p = (Z_Operand *)odr_malloc(o, sizeof(**p)); else if (!*p) return opt; if (odr_choice(o, arm, &(*p)->u, &(*p)->which)) @@ -727,13 +730,13 @@ int z_RPNStructure(ODR o, Z_RPNStructure **p, int opt) { static Odr_arm arm[] = { - {ODR_EXPLICIT, ODR_CONTEXT, 0, Z_RPNStructure_simple, z_Operand}, - {ODR_IMPLICIT, ODR_CONTEXT, 1, Z_RPNStructure_complex, z_Complex}, + {ODR_EXPLICIT, ODR_CONTEXT, 0, Z_RPNStructure_simple, (Odr_fun)z_Operand}, + {ODR_IMPLICIT, ODR_CONTEXT, 1, Z_RPNStructure_complex, (Odr_fun)z_Complex}, {-1 -1, -1, -1, 0} }; if (o->direction == ODR_DECODE) - *p = odr_malloc(o, sizeof(**p)); + *p = (Z_RPNStructure *)odr_malloc(o, sizeof(**p)); else if (!*p) return opt; if (odr_choice(o, arm, &(*p)->u, &(*p)->which)) @@ -758,14 +761,14 @@ int z_Query(ODR o, Z_Query **p, int opt) { static Odr_arm arm[] = { - {ODR_IMPLICIT, ODR_CONTEXT, 1, Z_Query_type_1, z_RPNQuery}, - {ODR_EXPLICIT, ODR_CONTEXT, 2, Z_Query_type_2, odr_octetstring}, - {ODR_IMPLICIT, ODR_CONTEXT, 101, Z_Query_type_101, z_RPNQuery}, + {ODR_IMPLICIT, ODR_CONTEXT, 1, Z_Query_type_1, (Odr_fun)z_RPNQuery}, + {ODR_EXPLICIT, ODR_CONTEXT, 2, Z_Query_type_2, (Odr_fun)odr_octetstring}, + {ODR_IMPLICIT, ODR_CONTEXT, 101, Z_Query_type_101, (Odr_fun)z_RPNQuery}, {-1, -1, -1, -1, 0} }; if (o->direction == ODR_DECODE) - *p = odr_malloc(o, sizeof(**p)); + *p = (Z_Query *)odr_malloc(o, sizeof(**p)); else if (!*p) return opt; if (odr_choice(o, arm, &(*p)->u, &(*p)->which)) @@ -848,13 +851,13 @@ int z_DiagRec(ODR o, Z_DiagRec **p, int opt) { static Odr_arm arm[] = { - {-1, -1, -1, Z_DiagRec_defaultFormat, z_DefaultDiagFormat}, - {-1, -1, -1, Z_DiagRec_externallyDefined, z_External}, + {-1, -1, -1, Z_DiagRec_defaultFormat, (Odr_fun)z_DefaultDiagFormat}, + {-1, -1, -1, Z_DiagRec_externallyDefined, (Odr_fun)z_External}, {-1, -1, -1, -1, 0} }; if (o->direction == ODR_DECODE) - *p = odr_malloc(o, sizeof(**p)); + *p = (Z_DiagRec *)odr_malloc(o, sizeof(**p)); else if (!*p) return opt; if (odr_choice(o, arm, &(*p)->u, &(*p)->which)) @@ -889,11 +892,11 @@ int z_DiagRec(ODR o, Z_DiagRec **p, int opt) int z_DiagRecs(ODR o, Z_DiagRecs **p, int opt) { if (o->direction == ODR_DECODE) - *p = odr_malloc(o, sizeof(**p)); + *p = (Z_DiagRecs *)odr_malloc(o, sizeof(**p)); else if (!*p) return opt; - if (odr_sequence_of(o, z_DiagRec, &(*p)->diagRecs, + if (odr_sequence_of(o, (Odr_fun)z_DiagRec, &(*p)->diagRecs, &(*p)->num_diagRecs)) return 1; *p = 0; @@ -905,9 +908,9 @@ int z_NamePlusRecord(ODR o, Z_NamePlusRecord **p, int opt) static Odr_arm arm[] = { {ODR_EXPLICIT, ODR_CONTEXT, 1, Z_NamePlusRecord_databaseRecord, - z_DatabaseRecord}, + (Odr_fun)z_DatabaseRecord}, {ODR_EXPLICIT, ODR_CONTEXT, 2, Z_NamePlusRecord_surrogateDiagnostic, - z_DiagRec}, + (Odr_fun)z_DiagRec}, {-1, -1, -1, -1, 0} }; @@ -925,10 +928,10 @@ int z_NamePlusRecord(ODR o, Z_NamePlusRecord **p, int opt) int z_NamePlusRecordList(ODR o, Z_NamePlusRecordList **p, int opt) { if (o->direction == ODR_DECODE) - *p = odr_malloc(o, sizeof(**p)); + *p = (Z_NamePlusRecordList *)odr_malloc(o, sizeof(**p)); else if (!*p) return opt; - if (odr_sequence_of(o, z_NamePlusRecord, &(*p)->records, + if (odr_sequence_of(o, (Odr_fun)z_NamePlusRecord, &(*p)->records, &(*p)->num_records)) return 1; *p = 0; @@ -939,15 +942,15 @@ int z_Records(ODR o, Z_Records **p, int opt) { static Odr_arm arm[] = { - {ODR_IMPLICIT, ODR_CONTEXT, 28, Z_Records_DBOSD, z_NamePlusRecordList}, - {ODR_IMPLICIT, ODR_CONTEXT, 130, Z_Records_NSD, z_DiagRec}, + {ODR_IMPLICIT, ODR_CONTEXT, 28, Z_Records_DBOSD, (Odr_fun)z_NamePlusRecordList}, + {ODR_IMPLICIT, ODR_CONTEXT, 130, Z_Records_NSD, (Odr_fun)z_DiagRec}, {ODR_IMPLICIT, ODR_CONTEXT, 205, Z_Records_multipleNSD, - z_DiagRecs}, + (Odr_fun)z_DiagRecs}, {-1, -1, -1, -1, 0} }; if (o->direction == ODR_DECODE) - *p = odr_malloc(o, sizeof(**p)); + *p = (Z_Records *)odr_malloc(o, sizeof(**p)); else if (!*p) return opt; if (odr_choice(o, arm, &(*p)->u, &(*p)->which)) @@ -963,9 +966,9 @@ int z_AccessControlRequest(ODR o, Z_AccessControlRequest **p, int opt) static Odr_arm arm[] = { {ODR_IMPLICIT, ODR_CONTEXT, 37, Z_AccessRequest_simpleForm, - odr_octetstring}, + (Odr_fun)odr_octetstring}, {ODR_EXPLICIT, ODR_CONTEXT, 0, Z_AccessRequest_externallyDefined, - z_External}, + (Odr_fun)z_External}, {-1, -1, -1, -1, 0} }; if (!odr_sequence_begin(o, p, sizeof(**p))) @@ -984,9 +987,9 @@ int z_AccessControlResponse(ODR o, Z_AccessControlResponse **p, int opt) static Odr_arm arm[] = { {ODR_IMPLICIT, ODR_CONTEXT, 38, Z_AccessResponse_simpleForm, - odr_octetstring}, + (Odr_fun)odr_octetstring}, {ODR_EXPLICIT, ODR_CONTEXT, 0, Z_AccessResponse_externallyDefined, - z_External}, + (Odr_fun)z_External}, {-1, -1, -1, -1, 0} }; if (!odr_sequence_begin(o, p, sizeof(**p))) @@ -1006,12 +1009,12 @@ int z_AccessControlResponse(ODR o, Z_AccessControlResponse **p, int opt) int z_AttributeList(ODR o, Z_AttributeList **p, int opt) { if (o->direction == ODR_DECODE) - *p = odr_malloc(o, sizeof(**p)); + *p = (Z_AttributeList *)odr_malloc(o, sizeof(**p)); else if (!*p) return opt; odr_implicit_settag(o, ODR_CONTEXT, 44); - if (odr_sequence_of(o, z_AttributeElement, &(*p)->attributes, + if (odr_sequence_of(o, (Odr_fun)z_AttributeElement, &(*p)->attributes, &(*p)->num_attributes)) return 1; *p = 0; @@ -1040,8 +1043,8 @@ int z_WillowAttributesPlusTerm(ODR o, Z_AttributesPlusTerm **p, int opt) if (!odr_implicit_settag(o, ODR_CONTEXT, 44)) return 0; if (o->direction == ODR_DECODE) - *p = odr_malloc(o, sizeof(**p)); - if (!odr_sequence_of(o, z_AttributeElement, &(*p)->attributeList, + *p = (Z_AttributesPlusTerm*)odr_malloc(o, sizeof(**p)); + if (!odr_sequence_of(o, (Odr_fun)z_AttributeElement, &(*p)->attributeList, &(*p)->num_attributes)) return 0; if (!odr_sequence_end(o) || !odr_sequence_end(o)) @@ -1057,14 +1060,14 @@ int z_WillowAttributesPlusTerm(ODR o, Z_AttributesPlusTerm **p, int opt) int z_AlternativeTerm(ODR o, Z_AlternativeTerm **p, int opt) { if (o->direction == ODR_DECODE) - *p = odr_malloc(o, sizeof(**p)); + *p = (Z_AlternativeTerm *)odr_malloc(o, sizeof(**p)); else if (!*p) { o->t_class = -1; return opt && odr_ok(o); } - if (odr_sequence_of(o, z_AttributesPlusTerm, &(*p)->terms, + if (odr_sequence_of(o, (Odr_fun)z_AttributesPlusTerm, &(*p)->terms, &(*p)->num_terms)) return 1; *p = 0; @@ -1088,7 +1091,7 @@ int z_ByDatabaseList(ODR o, Z_ByDatabaseList **p, int opt) { if (!odr_initmember(o, p, sizeof(**p))) return opt && odr_ok(o); - if (odr_sequence_of(o, z_ByDatabase, &(*p)->elements, &(*p)->num_elements)) + if (odr_sequence_of(o, (Odr_fun)z_ByDatabase, &(*p)->elements, &(*p)->num_elements)) return 1; *p = 0; return opt && odr_ok(o); @@ -1098,9 +1101,9 @@ int z_ScanOccurrences(ODR o, Z_ScanOccurrences **p, int opt) { Odr_arm arm[] = { - {ODR_EXPLICIT, ODR_CONTEXT, 2, Z_ScanOccurrences_global, odr_integer}, + {ODR_EXPLICIT, ODR_CONTEXT, 2, Z_ScanOccurrences_global, (Odr_fun)odr_integer}, {ODR_EXPLICIT, ODR_CONTEXT, 3, Z_ScanOccurrences_byDatabase, - z_ByDatabaseList}, + (Odr_fun)z_ByDatabaseList}, {-1, -1, -1, -1, 0} }; @@ -1129,7 +1132,7 @@ int z_OccurrenceByAttributes(ODR o, Z_OccurrenceByAttributes **p, int opt) { if (!odr_initmember(o, p, sizeof(**p))) return opt && odr_ok(o); - if (!odr_sequence_of(o, z_OccurrenceByAttributesElem, &(*p)->elements, + if (!odr_sequence_of(o, (Odr_fun)z_OccurrenceByAttributesElem, &(*p)->elements, &(*p)->num_elements)) return 1; *p = 0; @@ -1179,14 +1182,14 @@ int z_Entry(ODR o, Z_Entry **p, int opt) { static Odr_arm arm[] = { - {ODR_IMPLICIT, ODR_CONTEXT, 1, Z_Entry_termInfo, z_TermInfo}, + {ODR_IMPLICIT, ODR_CONTEXT, 1, Z_Entry_termInfo, (Odr_fun)z_TermInfo}, {ODR_EXPLICIT, ODR_CONTEXT, 2, Z_Entry_surrogateDiagnostic, - z_DiagRec}, + (Odr_fun)z_DiagRec}, {-1, -1, -1, -1, 0} }; if (o->direction == ODR_DECODE) - *p = odr_malloc(o, sizeof(**p)); + *p = (Z_Entry *)odr_malloc(o, sizeof(**p)); else if (!*p) return opt; @@ -1199,11 +1202,11 @@ int z_Entry(ODR o, Z_Entry **p, int opt) int z_Entries(ODR o, Z_Entries **p, int opt) { if (o->direction == ODR_DECODE) - *p = odr_malloc(o, sizeof(**p)); + *p = (Z_Entries *)odr_malloc(o, sizeof(**p)); else if (!*p) return opt; - if (odr_sequence_of(o, z_Entry, &(*p)->entries, + if (odr_sequence_of(o, (Odr_fun)z_Entry, &(*p)->entries, &(*p)->num_entries)) return 1; *p = 0; @@ -1214,14 +1217,14 @@ int z_ListEntries(ODR o, Z_ListEntries **p, int opt) { static Odr_arm arm[] = { - {ODR_IMPLICIT, ODR_CONTEXT, 1, Z_ListEntries_entries, z_Entries}, + {ODR_IMPLICIT, ODR_CONTEXT, 1, Z_ListEntries_entries, (Odr_fun)z_Entries}, {ODR_IMPLICIT, ODR_CONTEXT, 2, Z_ListEntries_nonSurrogateDiagnostics, - z_DiagRecs}, + (Odr_fun)z_DiagRecs}, {-1, -1, -1, -1, 0} }; if (o->direction == ODR_DECODE) - *p = odr_malloc(o, sizeof(**p)); + *p = (Z_ListEntries *)odr_malloc(o, sizeof(**p)); else if (!*p) return opt; @@ -1321,12 +1324,12 @@ int z_ElementSpec(ODR o, Z_ElementSpec **p, int opt) {ODR_IMPLICIT, ODR_CONTEXT, 1, Z_ElementSpec_elementSetName, odr_visiblestring}, {ODR_IMPLICIT, ODR_CONTEXT, 2, Z_ElementSpec_externalSpec, - z_External}, + (Odr_fun)z_External}, {-1, -1, -1, -1, 0} }; if (o->direction == ODR_DECODE) - *p = odr_malloc(o, sizeof(**p)); + *p = (Z_ElementSpec *)odr_malloc(o, sizeof(**p)); else if (!*p) return opt; @@ -1366,10 +1369,10 @@ int z_CompSpec(ODR o, Z_CompSpec **p, int opt) 1, 0) && odr_implicit(o, z_Specification, &(*p)->generic, ODR_CONTEXT, 2, 1) && odr_implicit_settag(o, ODR_CONTEXT, 3) && - (odr_sequence_of(o, z_DbSpecific, &(*p)->dbSpecific, + (odr_sequence_of(o, (Odr_fun)z_DbSpecific, &(*p)->dbSpecific, &(*p)->num_dbSpecific) || odr_ok(o)) && odr_implicit_settag(o, ODR_CONTEXT, 4) && - (odr_sequence_of(o, odr_oid, &(*p)->recordSyntax, + (odr_sequence_of(o, (Odr_fun)odr_oid, &(*p)->recordSyntax, &(*p)->num_recordSyntax) || odr_ok(o)) && odr_sequence_end(o); } @@ -1379,14 +1382,14 @@ int z_RecordComposition(ODR o, Z_RecordComposition **p, int opt) static Odr_arm arm[] = { {ODR_EXPLICIT, ODR_CONTEXT, 19, Z_RecordComp_simple, - z_ElementSetNames}, + (Odr_fun)z_ElementSetNames}, {ODR_IMPLICIT, ODR_CONTEXT, 209, Z_RecordComp_complex, - z_CompSpec}, + (Odr_fun)z_CompSpec}, {-1, -1, -1, -1, 0} }; if (o->direction == ODR_DECODE) - *p = odr_malloc(o, sizeof(**p)); + *p = (Z_RecordComposition *)odr_malloc(o, sizeof(**p)); else if (!*p) return opt; @@ -1424,7 +1427,7 @@ int z_PresentRequest(ODR o, Z_PresentRequest **p, int opt) 29, 0) && #ifdef Z_95 odr_implicit_settag(o, ODR_CONTEXT, 212) && - (odr_sequence_of(o, z_Range, &(*p)->additionalRanges, + (odr_sequence_of(o, (Odr_fun)z_Range, &(*p)->additionalRanges, &(*p)->num_ranges) || odr_ok(o)) && z_RecordComposition(o, &(*p)->recordComposition, 1) && #else @@ -1506,12 +1509,12 @@ int z_DeleteResultSetResponse(ODR o, Z_DeleteResultSetResponse **p, int opt) odr_implicit(o, z_DeleteSetStatus, &(*p)->deleteOperationStatus, ODR_CONTEXT, 0, 1) && odr_implicit_settag(o, ODR_CONTEXT, 1) && - (odr_sequence_of(o, z_ListStatus, &(*p)->deleteListStatuses, + (odr_sequence_of(o, (Odr_fun)z_ListStatus, &(*p)->deleteListStatuses, &(*p)->num_statuses) || odr_ok(o)) && odr_implicit(o, odr_integer, &(*p)->numberNotDeleted, ODR_CONTEXT, 34, 1) && odr_implicit_settag(o, ODR_CONTEXT, 35) && - (odr_sequence_of(o, z_ListStatus, &(*p)->bulkStatuses, + (odr_sequence_of(o, (Odr_fun)z_ListStatus, &(*p)->bulkStatuses, &(*p)->num_bulkStatuses) || odr_ok(o)) && odr_implicit(o, odr_visiblestring, &(*p)->deleteMessage, ODR_CONTEXT, 36, 1) && @@ -1532,7 +1535,7 @@ int z_Segment(ODR o, Z_Segment **p, int opt) odr_implicit(o, odr_integer, &(*p)->numberOfRecordsReturned, ODR_CONTEXT, 24, 0) && odr_implicit_settag(o, ODR_CONTEXT, 0) && - odr_sequence_of(o, z_NamePlusRecord, &(*p)->segmentRecords, + odr_sequence_of(o, (Odr_fun)z_NamePlusRecord, &(*p)->segmentRecords, &(*p)->num_segmentRecords) && z_OtherInformation(o, &(*p)->otherInfo, 1) && odr_sequence_end(o); @@ -1569,7 +1572,7 @@ int z_Permissions(ODR o, Z_Permissions **p, int opt) odr_implicit(o, z_InternationalString, &(*p)->userId, ODR_CONTEXT, 1, 0) && odr_implicit_settag(o, ODR_CONTEXT, 2) && - odr_sequence_of(o, odr_integer, &(*p)->allowableFunctions, + odr_sequence_of(o, (Odr_fun)odr_integer, &(*p)->allowableFunctions, &(*p)->num_allowableFunctions) && odr_sequence_end(o); } @@ -1602,7 +1605,7 @@ int z_ExtendedServicesResponse(ODR o, Z_ExtendedServicesResponse **p, int opt) z_ReferenceId(o, &(*p)->referenceId, 1) && odr_implicit(o, odr_integer, &(*p)->operationStatus, ODR_CONTEXT, 3, 0) && odr_implicit_settag(o, ODR_CONTEXT, 4) && - (odr_sequence_of(o, z_DiagRec, &(*p)->diagnostics, + (odr_sequence_of(o, (Odr_fun)z_DiagRec, &(*p)->diagnostics, &(*p)->num_diagnostics) || odr_ok(o)) && odr_implicit(o, z_External, &(*p)->taskPackage, ODR_CONTEXT, 5, 1) && z_OtherInformation(o, &(*p)->otherInfo, 1) && @@ -1627,9 +1630,9 @@ int z_SortKey(ODR o, Z_SortKey **p, int opt) { {ODR_IMPLICIT, ODR_CONTEXT, 0, Z_SortKey_sortField, z_InternationalString}, - {ODR_IMPLICIT, ODR_CONTEXT, 1, Z_SortKey_elementSpec, z_Specification}, + {ODR_IMPLICIT, ODR_CONTEXT, 1, Z_SortKey_elementSpec, (Odr_fun)z_Specification}, {ODR_IMPLICIT, ODR_CONTEXT, 2, Z_SortKey_sortAttributes, - z_SortAttributes}, + (Odr_fun)z_SortAttributes}, {-1, -1, -1, -1, 0} }; @@ -1655,7 +1658,7 @@ int z_SortDbSpecificList(ODR o, Z_SortDbSpecificList **p, int opt) { if (!odr_initmember(o, p, sizeof(**p))) return opt && odr_ok(o); - if (odr_sequence_of(o, z_SortDbSpecific, &(*p)->dbSpecific, + if (odr_sequence_of(o, (Odr_fun)z_SortDbSpecific, &(*p)->dbSpecific, &(*p)->num_dbSpecific)) return 1; *p = 0; @@ -1666,9 +1669,9 @@ int z_SortElement(ODR o, Z_SortElement **p, int opt) { static Odr_arm arm[] = { - {ODR_EXPLICIT, ODR_CONTEXT, 1, Z_SortElement_generic, z_SortKey}, + {ODR_EXPLICIT, ODR_CONTEXT, 1, Z_SortElement_generic, (Odr_fun)z_SortKey}, {ODR_IMPLICIT, ODR_CONTEXT, 2, Z_SortElement_databaseSpecific, - z_SortDbSpecificList}, + (Odr_fun)z_SortDbSpecificList}, {-1, -1, -1, -1, 0} }; @@ -1684,10 +1687,10 @@ int z_SortMissingValueAction(ODR o, Z_SortMissingValueAction **p, int opt) { static Odr_arm arm[] = { - {ODR_IMPLICIT, ODR_CONTEXT, 1, Z_SortMissingValAct_abort, odr_null}, - {ODR_IMPLICIT, ODR_CONTEXT, 2, Z_SortMissingValAct_null, odr_null}, + {ODR_IMPLICIT, ODR_CONTEXT, 1, Z_SortMissingValAct_abort, (Odr_fun)odr_null}, + {ODR_IMPLICIT, ODR_CONTEXT, 2, Z_SortMissingValAct_null, (Odr_fun)odr_null}, {ODR_IMPLICIT, ODR_CONTEXT, 3, Z_SortMissingValAct_valData, - odr_octetstring}, + (Odr_fun)odr_octetstring}, {-1, -1, -1, -1, 0} }; @@ -1732,7 +1735,7 @@ int z_SortKeySpecList(ODR o, Z_SortKeySpecList **p, int opt) { if (!odr_initmember(o, p, sizeof(**p))) return opt && odr_ok(o); - if (odr_sequence_of(o, z_SortKeySpec, &(*p)->specs, &(*p)->num_specs)) + if (odr_sequence_of(o, (Odr_fun)z_SortKeySpec, &(*p)->specs, &(*p)->num_specs)) return 1; *p = 0; return opt && odr_ok(o); @@ -1789,49 +1792,49 @@ int z_APDU(ODR o, Z_APDU **p, int opt) { static Odr_arm arm[] = { - {ODR_IMPLICIT, ODR_CONTEXT, 20, Z_APDU_initRequest, z_InitRequest}, - {ODR_IMPLICIT, ODR_CONTEXT, 21, Z_APDU_initResponse, z_InitResponse}, - {ODR_IMPLICIT, ODR_CONTEXT, 22, Z_APDU_searchRequest, z_SearchRequest}, + {ODR_IMPLICIT, ODR_CONTEXT, 20, Z_APDU_initRequest, (Odr_fun)z_InitRequest}, + {ODR_IMPLICIT, ODR_CONTEXT, 21, Z_APDU_initResponse, (Odr_fun)z_InitResponse}, + {ODR_IMPLICIT, ODR_CONTEXT, 22, Z_APDU_searchRequest, (Odr_fun)z_SearchRequest}, {ODR_IMPLICIT, ODR_CONTEXT, 23, Z_APDU_searchResponse, - z_SearchResponse}, + (Odr_fun)z_SearchResponse}, {ODR_IMPLICIT, ODR_CONTEXT, 24, Z_APDU_presentRequest, - z_PresentRequest}, + (Odr_fun)z_PresentRequest}, {ODR_IMPLICIT, ODR_CONTEXT, 25, Z_APDU_presentResponse, - z_PresentResponse}, + (Odr_fun)z_PresentResponse}, {ODR_IMPLICIT, ODR_CONTEXT, 26, Z_APDU_deleteResultSetRequest, - z_DeleteResultSetRequest}, + (Odr_fun)z_DeleteResultSetRequest}, {ODR_IMPLICIT, ODR_CONTEXT, 27, Z_APDU_deleteResultSetResponse, - z_DeleteResultSetResponse}, + (Odr_fun)z_DeleteResultSetResponse}, {ODR_IMPLICIT, ODR_CONTEXT, 28, Z_APDU_accessControlRequest, - z_AccessControlRequest}, + (Odr_fun)z_AccessControlRequest}, {ODR_IMPLICIT, ODR_CONTEXT, 29, Z_APDU_accessControlResponse, - z_AccessControlResponse}, + (Odr_fun)z_AccessControlResponse}, {ODR_IMPLICIT, ODR_CONTEXT, 30, Z_APDU_resourceControlRequest, - z_ResourceControlRequest}, + (Odr_fun)z_ResourceControlRequest}, {ODR_IMPLICIT, ODR_CONTEXT, 31, Z_APDU_resourceControlResponse, - z_ResourceControlResponse}, + (Odr_fun)z_ResourceControlResponse}, {ODR_IMPLICIT, ODR_CONTEXT, 32, Z_APDU_triggerResourceControlRequest, - z_TriggerResourceControlRequest}, + (Odr_fun)z_TriggerResourceControlRequest}, {ODR_IMPLICIT, ODR_CONTEXT, 33, Z_APDU_resourceReportRequest, - z_ResourceReportRequest}, + (Odr_fun)z_ResourceReportRequest}, {ODR_IMPLICIT, ODR_CONTEXT, 34, Z_APDU_resourceReportResponse, - z_ResourceReportResponse}, - {ODR_IMPLICIT, ODR_CONTEXT, 35, Z_APDU_scanRequest, z_ScanRequest}, - {ODR_IMPLICIT, ODR_CONTEXT, 36, Z_APDU_scanResponse, z_ScanResponse}, - {ODR_IMPLICIT, ODR_CONTEXT, 43, Z_APDU_sortRequest, z_SortRequest}, - {ODR_IMPLICIT, ODR_CONTEXT, 44, Z_APDU_sortResponse, z_SortResponse}, - {ODR_IMPLICIT, ODR_CONTEXT, 45, Z_APDU_segmentRequest, z_Segment}, + (Odr_fun)z_ResourceReportResponse}, + {ODR_IMPLICIT, ODR_CONTEXT, 35, Z_APDU_scanRequest, (Odr_fun)z_ScanRequest}, + {ODR_IMPLICIT, ODR_CONTEXT, 36, Z_APDU_scanResponse, (Odr_fun)z_ScanResponse}, + {ODR_IMPLICIT, ODR_CONTEXT, 43, Z_APDU_sortRequest, (Odr_fun)z_SortRequest}, + {ODR_IMPLICIT, ODR_CONTEXT, 44, Z_APDU_sortResponse, (Odr_fun)z_SortResponse}, + {ODR_IMPLICIT, ODR_CONTEXT, 45, Z_APDU_segmentRequest, (Odr_fun)z_Segment}, {ODR_IMPLICIT, ODR_CONTEXT, 46, Z_APDU_extendedServicesRequest, - z_ExtendedServicesRequest}, + (Odr_fun)z_ExtendedServicesRequest}, {ODR_IMPLICIT, ODR_CONTEXT, 47, Z_APDU_extendedServicesResponse, - z_ExtendedServicesResponse}, - {ODR_IMPLICIT, ODR_CONTEXT, 48, Z_APDU_close, z_Close}, + (Odr_fun)z_ExtendedServicesResponse}, + {ODR_IMPLICIT, ODR_CONTEXT, 48, Z_APDU_close, (Odr_fun)z_Close}, {-1, -1, -1, -1, 0} }; if (o->direction == ODR_DECODE) - *p = odr_malloc(o, sizeof(**p)); + *p = (Z_APDU *)odr_malloc(o, sizeof(**p)); odr_setlenlen(o, 5); if (!odr_choice(o, arm, &(*p)->u, &(*p)->which)) { diff --git a/asn/prt-acc.c b/asn/prt-acc.c index dfc024e..d30bcfd 100644 --- a/asn/prt-acc.c +++ b/asn/prt-acc.c @@ -4,7 +4,10 @@ * Sebastian Hammer, Adam Dickmeiss * * $Log: prt-acc.c,v $ - * Revision 1.6 1998-01-05 09:04:57 adam + * Revision 1.7 1998-02-11 11:53:32 adam + * Changed code so that it compiles as C++. + * + * Revision 1.6 1998/01/05 09:04:57 adam * Fixed bugs in encoders/decoders - Not operator (!) missing. * * Revision 1.5 1995/09/29 17:11:53 quinn @@ -55,14 +58,14 @@ int z_PromptId1(ODR o, Z_PromptId1 **p, int opt) static Odr_arm arm[] = { {ODR_IMPLICIT, ODR_CONTEXT, 1, Z_PromptId1_enumeratedPrompt, - z_EnumeratedPrompt1}, + (Odr_fun)z_EnumeratedPrompt1}, {ODR_IMPLICIT, ODR_CONTEXT, 2, Z_PromptId1_nonEnumeratedPrompt, odr_visiblestring}, {-1, -1, -1, -1, 0} }; if (o->direction == ODR_DECODE) - *p = odr_malloc(o, sizeof(**p)); + *p = (Z_PromptId1 *)odr_malloc(o, sizeof(**p)); else if (!*p) return opt; if (odr_choice(o, arm, &(*p)->u, &(*p)->which)) @@ -78,12 +81,12 @@ int z_PromptInfo1(ODR o, Z_PromptInfo1 **p, int opt) {ODR_IMPLICIT, ODR_CONTEXT, 1, Z_Challenge1_character, odr_visiblestring}, {ODR_IMPLICIT, ODR_CONTEXT, 2, Z_Challenge1_encrypted, - z_Encryption1}, + (Odr_fun)z_Encryption1}, {-1, -1, -1, -1, 0} }; if (o->direction == ODR_DECODE) - *p = odr_malloc(o, sizeof(**p)); + *p = (Z_PromptInfo1 *)odr_malloc(o, sizeof(**p)); else if (!*p) return opt; if (odr_choice(o, arm, &(*p)->u, &(*p)->which)) @@ -115,10 +118,10 @@ int z_ChallengeUnit1(ODR o, Z_ChallengeUnit1 **p, int opt) int z_Challenge1(ODR o, Z_Challenge1 **p, int opt) { if (o->direction == ODR_ENCODE) - *p = odr_malloc(o, sizeof(**p)); + *p = (Z_Challenge1 *)odr_malloc(o, sizeof(**p)); else if (!*p) return opt; - if (odr_sequence_of(o, z_ChallengeUnit1, &(*p)->list, + if (odr_sequence_of(o, (Odr_fun)z_ChallengeUnit1, &(*p)->list, &(*p)->num_challenges)) return 1; *p = 0; @@ -132,10 +135,10 @@ int z_ResponseUnit1(ODR o, Z_ResponseUnit1 **p, int opt) static Odr_arm arm[] = { {ODR_IMPLICIT, ODR_CONTEXT, 1, Z_Response1_string, odr_visiblestring}, - {ODR_IMPLICIT, ODR_CONTEXT, 2, Z_Response1_accept, odr_bool}, - {ODR_IMPLICIT, ODR_CONTEXT, 3, Z_Response1_acknowledge, odr_null}, - {ODR_EXPLICIT, ODR_CONTEXT, 4, Z_Response1_diagnostic, z_DiagRec}, - {ODR_IMPLICIT, ODR_CONTEXT, 5, Z_Response1_encrypted, z_Encryption1}, + {ODR_IMPLICIT, ODR_CONTEXT, 2, Z_Response1_accept, (Odr_fun)odr_bool}, + {ODR_IMPLICIT, ODR_CONTEXT, 3, Z_Response1_acknowledge, (Odr_fun)odr_null}, + {ODR_EXPLICIT, ODR_CONTEXT, 4, Z_Response1_diagnostic, (Odr_fun)z_DiagRec}, + {ODR_IMPLICIT, ODR_CONTEXT, 5, Z_Response1_encrypted, (Odr_fun)z_Encryption1}, {-1, -1, -1, -1, 0} }; @@ -152,10 +155,10 @@ int z_ResponseUnit1(ODR o, Z_ResponseUnit1 **p, int opt) int z_Response1(ODR o, Z_Response1 **p, int opt) { if (o->direction == ODR_ENCODE) - *p = odr_malloc(o, sizeof(**p)); + *p = (Z_Response1 *)odr_malloc(o, sizeof(**p)); else if (!*p) return opt; - if (odr_sequence_of(o, z_ResponseUnit1, &(*p)->list, + if (odr_sequence_of(o, (Odr_fun)z_ResponseUnit1, &(*p)->list, &(*p)->num_responses)) return 1; *p = 0; @@ -166,13 +169,13 @@ int z_PromptObject1(ODR o, Z_PromptObject1 **p, int opt) { static Odr_arm arm[] = { - {ODR_IMPLICIT, ODR_CONTEXT, 1, Z_PromptObject1_challenge, z_Challenge1}, - {ODR_IMPLICIT, ODR_CONTEXT, 2, Z_PromptObject1_response, z_Response1}, + {ODR_IMPLICIT, ODR_CONTEXT, 1, Z_PromptObject1_challenge, (Odr_fun)z_Challenge1}, + {ODR_IMPLICIT, ODR_CONTEXT, 2, Z_PromptObject1_response, (Odr_fun)z_Response1}, {-1, -1, -1, -1, 0} }; if (o->direction == ODR_DECODE) - *p = odr_malloc(o, sizeof(**p)); + *p = (Z_PromptObject1 *)odr_malloc(o, sizeof(**p)); else if (!*p) return opt; if (odr_choice(o, arm, &(*p)->u, &(*p)->which)) diff --git a/asn/prt-add.c b/asn/prt-add.c index eb23dbf..aaec199 100644 --- a/asn/prt-add.c +++ b/asn/prt-add.c @@ -4,7 +4,10 @@ * Sebastian Hammer, Adam Dickmeiss * * $Log: prt-add.c,v $ - * Revision 1.3 1998-01-05 09:04:57 adam + * Revision 1.4 1998-02-11 11:53:32 adam + * Changed code so that it compiles as C++. + * + * Revision 1.3 1998/01/05 09:04:57 adam * Fixed bugs in encoders/decoders - Not operator (!) missing. * * Revision 1.2 1997/04/30 08:52:02 quinn @@ -32,8 +35,8 @@ int z_ResultsByDBList (ODR o, Z_ResultsByDBList **p, int opt) int z_ResultsByDB_elem (ODR o, Z_ResultsByDB_elem **p, int opt) { static Odr_arm arm[] = { - {ODR_IMPLICIT, ODR_CONTEXT, 1, Z_ResultsByDB_all, odr_null}, - {ODR_IMPLICIT, ODR_CONTEXT, 2, Z_ResultsByDB_list, z_ResultsByDBList}, + {ODR_IMPLICIT, ODR_CONTEXT, 1, Z_ResultsByDB_all, (Odr_fun)odr_null}, + {ODR_IMPLICIT, ODR_CONTEXT, 2, Z_ResultsByDB_list, (Odr_fun)z_ResultsByDBList}, {-1, -1, -1, -1, 0} }; if (!odr_sequence_begin (o, p, sizeof(**p))) @@ -53,7 +56,7 @@ int z_ResultsByDB (ODR o, Z_ResultsByDB **p, int opt) { if (!odr_initmember (o, p, sizeof(**p))) return opt && odr_ok(o); - if (odr_sequence_of (o, z_ResultsByDB_elem, &(*p)->elements, + if (odr_sequence_of (o, (Odr_fun)z_ResultsByDB_elem, &(*p)->elements, &(*p)->num)) return 1; *p = 0; @@ -76,8 +79,8 @@ int z_QueryExpression (ODR o, Z_QueryExpression **p, int opt) { static Odr_arm arm[] = { {ODR_IMPLICIT, ODR_CONTEXT, 1, Z_QueryExpression_term, - z_QueryExpressionTerm}, - {ODR_EXPLICIT, ODR_CONTEXT, 2, Z_QueryExpression_query, z_Query}, + (Odr_fun)z_QueryExpressionTerm}, + {ODR_EXPLICIT, ODR_CONTEXT, 2, Z_QueryExpression_query, (Odr_fun)z_Query}, {-1, -1, -1, -1, 0} }; if (!odr_initmember(o, p, sizeof(**p))) @@ -116,7 +119,7 @@ int z_SearchInfoReport (ODR o, Z_SearchInfoReport **p, int opt) { if (!odr_initmember (o, p, sizeof(**p))) return opt && odr_ok(o); - if (odr_sequence_of (o, z_SearchInfoReport_elem, &(*p)->elements, + if (odr_sequence_of (o, (Odr_fun)z_SearchInfoReport_elem, &(*p)->elements, &(*p)->num)) return 1; *p = 0; diff --git a/asn/prt-arc.c b/asn/prt-arc.c index 654cabd..e7b6297 100644 --- a/asn/prt-arc.c +++ b/asn/prt-arc.c @@ -4,7 +4,10 @@ * Sebastian Hammer, Adam Dickmeiss * * $Log: prt-arc.c,v $ - * Revision 1.1 1996-06-10 08:55:20 quinn + * Revision 1.2 1998-02-11 11:53:32 adam + * Changed code so that it compiles as C++. + * + * Revision 1.1 1996/06/10 08:55:20 quinn * Added Summary, OPAC * * @@ -42,7 +45,7 @@ int z_BriefBib(ODR o, Z_BriefBib **p, int opt) odr_implicit(o, z_InternationalString, &(*p)->bibliographicLevel, ODR_CONTEXT, 5, 1) && odr_implicit_settag(o, ODR_CONTEXT, 6) && - (odr_sequence_of(o, z_FormatSpec, &(*p)->format, &(*p)->num_format) || + (odr_sequence_of(o, (Odr_fun)z_FormatSpec, &(*p)->format, &(*p)->num_format) || odr_ok(o)) && odr_implicit(o, z_InternationalString, &(*p)->publicationPlace, ODR_CONTEXT, 7, 1) && @@ -142,10 +145,10 @@ int z_HoldingsAndCircData(ODR o, Z_HoldingsAndCircData **p, int opt) odr_implicit(o, z_InternationalString, &(*p)->enumAndChron, ODR_CONTEXT, 17, 1) && odr_implicit_settag(o, ODR_CONTEXT, 18) && - (odr_sequence_of(o, z_Volume, &(*p)->volumes, &(*p)->num_volumes) || + (odr_sequence_of(o, (Odr_fun)z_Volume, &(*p)->volumes, &(*p)->num_volumes) || odr_ok(o)) && odr_implicit_settag(o, ODR_CONTEXT, 19) && - (odr_sequence_of(o, z_CircRecord, &(*p)->circulationData, + (odr_sequence_of(o, (Odr_fun)z_CircRecord, &(*p)->circulationData, &(*p)->num_circulationData) || odr_ok(o)) && odr_sequence_end(o); } @@ -155,9 +158,9 @@ int z_HoldingsRecord(ODR o, Z_HoldingsRecord **p, int opt) static Odr_arm arm[] = { {ODR_IMPLICIT, ODR_CONTEXT, 1, Z_HoldingsRecord_marcHoldingsRecord, - z_External}, + (Odr_fun)z_External}, {ODR_IMPLICIT, ODR_CONTEXT, 2, Z_HoldingsRecord_holdingsAndCirc, - z_HoldingsAndCircData}, + (Odr_fun)z_HoldingsAndCircData}, {-1, -1, -1, -1, 0} }; @@ -177,7 +180,7 @@ int z_OPACRecord(ODR o, Z_OPACRecord **p, int opt) odr_implicit(o, z_External, &(*p)->bibliographicRecord, ODR_CONTEXT, 1, 1) && odr_implicit_settag(o, ODR_CONTEXT, 2) && - (odr_sequence_of(o, z_HoldingsRecord, &(*p)->holdingsData, + (odr_sequence_of(o, (Odr_fun)z_HoldingsRecord, &(*p)->holdingsData, &(*p)->num_holdingsData) || odr_ok(o)) && odr_sequence_end(o); } diff --git a/asn/prt-dat.c b/asn/prt-dat.c index c10f5a3..44a830a 100644 --- a/asn/prt-dat.c +++ b/asn/prt-dat.c @@ -8,7 +8,10 @@ * Databasix Information Systems B.V., Utrecht, The Netherlands. * * $Log: prt-dat.c,v $ - * Revision 1.1 1998-02-10 15:31:46 adam + * Revision 1.2 1998-02-11 11:53:32 adam + * Changed code so that it compiles as C++. + * + * Revision 1.1 1998/02/10 15:31:46 adam * Implemented date and time structure. Changed the Update Extended * Service. * @@ -30,10 +33,10 @@ int z_Quarter(ODR o, Z_Quarter **p, int opt) { static Odr_arm arm[] = { - {ODR_IMPLICIT, ODR_CONTEXT, 1, Z_Quarter_first, odr_null}, - {ODR_IMPLICIT, ODR_CONTEXT, 2, Z_Quarter_second, odr_null}, - {ODR_IMPLICIT, ODR_CONTEXT, 3, Z_Quarter_third, odr_null}, - {ODR_IMPLICIT, ODR_CONTEXT, 4, Z_Quarter_fourth, odr_null}, + {ODR_IMPLICIT, ODR_CONTEXT, 1, Z_Quarter_first, (Odr_fun)odr_null}, + {ODR_IMPLICIT, ODR_CONTEXT, 2, Z_Quarter_second, (Odr_fun)odr_null}, + {ODR_IMPLICIT, ODR_CONTEXT, 3, Z_Quarter_third, (Odr_fun)odr_null}, + {ODR_IMPLICIT, ODR_CONTEXT, 4, Z_Quarter_fourth, (Odr_fun)odr_null}, {-1, -1, -1, -1, 0} }; @@ -49,10 +52,10 @@ int z_Season(ODR o, Z_Season **p, int opt) { static Odr_arm arm[] = { - {ODR_IMPLICIT, ODR_CONTEXT, 1, Z_Season_winter, odr_null}, - {ODR_IMPLICIT, ODR_CONTEXT, 2, Z_Season_spring, odr_null}, - {ODR_IMPLICIT, ODR_CONTEXT, 3, Z_Season_summer, odr_null}, - {ODR_IMPLICIT, ODR_CONTEXT, 4, Z_Season_autumn, odr_null}, + {ODR_IMPLICIT, ODR_CONTEXT, 1, Z_Season_winter, (Odr_fun)odr_null}, + {ODR_IMPLICIT, ODR_CONTEXT, 2, Z_Season_spring, (Odr_fun)odr_null}, + {ODR_IMPLICIT, ODR_CONTEXT, 3, Z_Season_summer, (Odr_fun)odr_null}, + {ODR_IMPLICIT, ODR_CONTEXT, 4, Z_Season_autumn, (Odr_fun)odr_null}, {-1, -1, -1, -1, 0} }; @@ -68,11 +71,16 @@ int z_PartOfYear(ODR o, Z_PartOfYear **p, int opt) { static Odr_arm arm[] = { - {ODR_IMPLICIT, ODR_CONTEXT, 1, Z_PartOfYear_monthAndDay, z_MonthAndDay}, - {ODR_IMPLICIT, ODR_CONTEXT, 2, Z_PartOfYear_julianDay, odr_integer}, - {ODR_IMPLICIT, ODR_CONTEXT, 3, Z_PartOfYear_weekNumber, odr_integer}, - {ODR_IMPLICIT, ODR_CONTEXT, 4, Z_PartOfYear_quarter, z_Quarter}, - {ODR_IMPLICIT, ODR_CONTEXT, 5, Z_PartOfYear_season, z_Season}, + {ODR_IMPLICIT, ODR_CONTEXT, 1, Z_PartOfYear_monthAndDay, + (Odr_fun) z_MonthAndDay}, + {ODR_IMPLICIT, ODR_CONTEXT, 2, Z_PartOfYear_julianDay, + (Odr_fun) odr_integer}, + {ODR_IMPLICIT, ODR_CONTEXT, 3, Z_PartOfYear_weekNumber, + (Odr_fun) odr_integer}, + {ODR_IMPLICIT, ODR_CONTEXT, 4, Z_PartOfYear_quarter, + (Odr_fun) z_Quarter}, + {ODR_IMPLICIT, ODR_CONTEXT, 5, Z_PartOfYear_season, + (Odr_fun) z_Season}, {-1, -1, -1, -1, 0} }; @@ -88,9 +96,9 @@ int z_Era(ODR o, Z_Era **p, int opt) { static Odr_arm arm[] = { - {ODR_IMPLICIT, ODR_CONTEXT, 1, Z_Era_decade, odr_null}, - {ODR_IMPLICIT, ODR_CONTEXT, 2, Z_Era_century, odr_null}, - {ODR_IMPLICIT, ODR_CONTEXT, 3, Z_Era_millennium, odr_null}, + {ODR_IMPLICIT, ODR_CONTEXT, 1, Z_Era_decade, (Odr_fun)odr_null}, + {ODR_IMPLICIT, ODR_CONTEXT, 2, Z_Era_century, (Odr_fun)odr_null}, + {ODR_IMPLICIT, ODR_CONTEXT, 3, Z_Era_millennium, (Odr_fun)odr_null}, {-1, -1, -1, -1, 0} }; @@ -127,9 +135,9 @@ int z_Zone(ODR o, Z_Zone **p, int opt) { static Odr_arm arm[] = { - {ODR_IMPLICIT, ODR_CONTEXT, 1, Z_Zone_local, odr_null}, - {ODR_IMPLICIT, ODR_CONTEXT, 2, Z_Zone_utc, odr_null}, - {ODR_IMPLICIT, ODR_CONTEXT, 3, Z_Zone_utcOffset, odr_integer}, + {ODR_IMPLICIT, ODR_CONTEXT, 1, Z_Zone_local, (Odr_fun)odr_null}, + {ODR_IMPLICIT, ODR_CONTEXT, 2, Z_Zone_utc, (Odr_fun)odr_null}, + {ODR_IMPLICIT, ODR_CONTEXT, 3, Z_Zone_utcOffset, (Odr_fun)odr_integer}, {-1, -1, -1, -1, 0} }; diff --git a/asn/prt-dia.c b/asn/prt-dia.c index 2ba2338..4393d7d 100644 --- a/asn/prt-dia.c +++ b/asn/prt-dia.c @@ -4,7 +4,10 @@ * Sebastian Hammer, Adam Dickmeiss * * $Log: prt-dia.c,v $ - * Revision 1.4 1996-01-22 09:46:34 quinn + * Revision 1.5 1998-02-11 11:53:32 adam + * Changed code so that it compiles as C++. + * + * Revision 1.4 1996/01/22 09:46:34 quinn * Added Sort PDU. Moved StringList to main protocol file. * * Revision 1.3 1995/09/29 17:11:54 quinn @@ -39,7 +42,7 @@ int z_BadSpec(ODR o, Z_BadSpec **p, int opt) odr_implicit(o, z_Specification, &(*p)->spec, ODR_CONTEXT, 1, 0) && odr_implicit(o, z_DatabaseName, &(*p)->db, ODR_CONTEXT, 2, 1) && odr_implicit_settag(o, ODR_CONTEXT, 3) && - (odr_sequence_of(o, z_Specification, &(*p)->goodOnes, + (odr_sequence_of(o, (Odr_fun)z_Specification, &(*p)->goodOnes, &(*p)->num_goodOnes) || odr_ok(o)) && odr_sequence_end(o); } @@ -85,7 +88,7 @@ int z_AttCombo(ODR o, Z_AttCombo **p, int opt) odr_implicit(o, z_AttributeList, &(*p)->unsupportedCombination, ODR_CONTEXT, 1, 0) && odr_implicit_settag(o, ODR_CONTEXT, 2) && - (odr_sequence_of(o, z_AttributeList, &(*p)->alternatives, + (odr_sequence_of(o, (Odr_fun)z_AttributeList, &(*p)->alternatives, &(*p)->num_alternatives) || odr_ok(o)) && odr_sequence_end(o); } @@ -104,20 +107,20 @@ int z_Proximity(ODR o, Z_Proximity **p, int opt) { static Odr_arm arm[] = { - {ODR_IMPLICIT, ODR_CONTEXT, 1, Z_Proximity_resultSets, odr_null}, + {ODR_IMPLICIT, ODR_CONTEXT, 1, Z_Proximity_resultSets, (Odr_fun)odr_null}, {ODR_IMPLICIT, ODR_CONTEXT, 2, Z_Proximity_badSet, - z_InternationalString}, - {ODR_IMPLICIT, ODR_CONTEXT, 3, Z_Proximity_relation, odr_integer}, - {ODR_IMPLICIT, ODR_CONTEXT, 4, Z_Proximity_unit, odr_integer}, - {ODR_IMPLICIT, ODR_CONTEXT, 5, Z_Proximity_distance, odr_integer}, - {ODR_EXPLICIT, ODR_CONTEXT, 6, Z_Proximity_attributes, z_AttributeList}, - {ODR_IMPLICIT, ODR_CONTEXT, 7, Z_Proximity_ordered, odr_null}, - {ODR_IMPLICIT, ODR_CONTEXT, 8, Z_Proximity_exclusion, odr_null}, + (Odr_fun)z_InternationalString}, + {ODR_IMPLICIT, ODR_CONTEXT, 3, Z_Proximity_relation, (Odr_fun)odr_integer}, + {ODR_IMPLICIT, ODR_CONTEXT, 4, Z_Proximity_unit, (Odr_fun)odr_integer}, + {ODR_IMPLICIT, ODR_CONTEXT, 5, Z_Proximity_distance, (Odr_fun)odr_integer}, + {ODR_EXPLICIT, ODR_CONTEXT, 6, Z_Proximity_attributes, (Odr_fun)z_AttributeList}, + {ODR_IMPLICIT, ODR_CONTEXT, 7, Z_Proximity_ordered, (Odr_fun)odr_null}, + {ODR_IMPLICIT, ODR_CONTEXT, 8, Z_Proximity_exclusion, (Odr_fun)odr_null}, {-1, -1, -1, -1, 0} }; if (o->direction == ODR_DECODE) - *p = odr_malloc(o, sizeof(**p)); + *p = (Z_Proximity *)odr_malloc(o, sizeof(**p)); else if (!*p) return opt; if (odr_choice(o, arm, &(*p)->u, &(*p)->which)) @@ -129,10 +132,10 @@ int z_Proximity(ODR o, Z_Proximity **p, int opt) int z_AttrListList(ODR o, Z_AttrListList **p, int opt) { if (o->direction == ODR_DECODE) - *p = odr_malloc(o, sizeof(**p)); + *p = (Z_AttrListList *)odr_malloc(o, sizeof(**p)); else if (!*p) return opt; - if (odr_sequence_of(o, z_AttributeList, &(*p)->lists, &(*p)->num_lists)) + if (odr_sequence_of(o, (Odr_fun)z_AttributeList, &(*p)->lists, &(*p)->num_lists)) return 1; *p = 0; return opt && odr_ok(o); @@ -142,18 +145,18 @@ int z_Scan(ODR o, Z_Scan **p, int opt) { static Odr_arm arm[] = { - {ODR_IMPLICIT, ODR_CONTEXT, 0, Z_ScanD_nonZeroStepSize, odr_null}, - {ODR_IMPLICIT, ODR_CONTEXT, 1, Z_ScanD_specifiedStepSize, odr_null}, - {ODR_IMPLICIT, ODR_CONTEXT, 3, Z_ScanD_termList1, odr_null}, - {ODR_IMPLICIT, ODR_CONTEXT, 4, Z_ScanD_termList2, z_AttrListList}, - {ODR_IMPLICIT, ODR_CONTEXT, 5, Z_ScanD_posInResponse, odr_integer}, - {ODR_IMPLICIT, ODR_CONTEXT, 6, Z_ScanD_resources, odr_null}, - {ODR_IMPLICIT, ODR_CONTEXT, 7, Z_ScanD_endOfList, odr_null}, + {ODR_IMPLICIT, ODR_CONTEXT, 0, Z_ScanD_nonZeroStepSize, (Odr_fun)odr_null}, + {ODR_IMPLICIT, ODR_CONTEXT, 1, Z_ScanD_specifiedStepSize, (Odr_fun)odr_null}, + {ODR_IMPLICIT, ODR_CONTEXT, 3, Z_ScanD_termList1, (Odr_fun)odr_null}, + {ODR_IMPLICIT, ODR_CONTEXT, 4, Z_ScanD_termList2, (Odr_fun)z_AttrListList}, + {ODR_IMPLICIT, ODR_CONTEXT, 5, Z_ScanD_posInResponse, (Odr_fun)odr_integer}, + {ODR_IMPLICIT, ODR_CONTEXT, 6, Z_ScanD_resources, (Odr_fun)odr_null}, + {ODR_IMPLICIT, ODR_CONTEXT, 7, Z_ScanD_endOfList, (Odr_fun)odr_null}, {-1, -1, -1, -1, 0} }; if (o->direction == ODR_DECODE) - *p = odr_malloc(o, sizeof(**p)); + *p = (Z_Scan *)odr_malloc(o, sizeof(**p)); else if (!*p) return opt; if (odr_choice(o, arm, &(*p)->u, &(*p)->which)) @@ -166,25 +169,25 @@ int z_Sort(ODR o, Z_Sort **p, int opt) { static Odr_arm arm[] = { - {ODR_IMPLICIT, ODR_CONTEXT, 0, Z_SortD_sequence, odr_null}, - {ODR_IMPLICIT, ODR_CONTEXT, 1, Z_SortD_noRsName, odr_null}, - {ODR_IMPLICIT, ODR_CONTEXT, 2, Z_SortD_tooMany, odr_integer}, - {ODR_IMPLICIT, ODR_CONTEXT, 3, Z_SortD_incompatible, odr_null}, - {ODR_IMPLICIT, ODR_CONTEXT, 4, Z_SortD_generic, odr_null}, - {ODR_IMPLICIT, ODR_CONTEXT, 5, Z_SortD_dbSpecific, odr_null}, + {ODR_IMPLICIT, ODR_CONTEXT, 0, Z_SortD_sequence, (Odr_fun)odr_null}, + {ODR_IMPLICIT, ODR_CONTEXT, 1, Z_SortD_noRsName, (Odr_fun)odr_null}, + {ODR_IMPLICIT, ODR_CONTEXT, 2, Z_SortD_tooMany, (Odr_fun)odr_integer}, + {ODR_IMPLICIT, ODR_CONTEXT, 3, Z_SortD_incompatible, (Odr_fun)odr_null}, + {ODR_IMPLICIT, ODR_CONTEXT, 4, Z_SortD_generic, (Odr_fun)odr_null}, + {ODR_IMPLICIT, ODR_CONTEXT, 5, Z_SortD_dbSpecific, (Odr_fun)odr_null}, #if 0 - {ODR_EXPLICIT, ODR_CONTEXT, 6, Z_SortD_sortElement, z_SortElement}, + {ODR_EXPLICIT, ODR_CONTEXT, 6, Z_SortD_sortElement, (Odr_fun)z_SortElement}, #endif - {ODR_IMPLICIT, ODR_CONTEXT, 7, Z_SortD_key, odr_integer}, - {ODR_IMPLICIT, ODR_CONTEXT, 8, Z_SortD_action, odr_null}, - {ODR_IMPLICIT, ODR_CONTEXT, 9, Z_SortD_illegal, odr_integer}, - {ODR_IMPLICIT, ODR_CONTEXT, 10, Z_SortD_inputTooLarge, z_StringList}, - {ODR_IMPLICIT, ODR_CONTEXT, 11, Z_SortD_aggregateTooLarge, odr_null}, + {ODR_IMPLICIT, ODR_CONTEXT, 7, Z_SortD_key, (Odr_fun)odr_integer}, + {ODR_IMPLICIT, ODR_CONTEXT, 8, Z_SortD_action, (Odr_fun)odr_null}, + {ODR_IMPLICIT, ODR_CONTEXT, 9, Z_SortD_illegal, (Odr_fun)odr_integer}, + {ODR_IMPLICIT, ODR_CONTEXT, 10, Z_SortD_inputTooLarge, (Odr_fun)z_StringList}, + {ODR_IMPLICIT, ODR_CONTEXT, 11, Z_SortD_aggregateTooLarge, (Odr_fun)odr_null}, {-1, -1, -1, -1, 0} }; if (o->direction == ODR_DECODE) - *p = odr_malloc(o, sizeof(**p)); + *p = (Z_Sort *)odr_malloc(o, sizeof(**p)); else if (!*p) return opt; if (odr_choice(o, arm, &(*p)->u, &(*p)->which)) @@ -197,12 +200,12 @@ int z_Segmentation(ODR o, Z_Segmentation **p, int opt) { static Odr_arm arm[] = { - {ODR_IMPLICIT, ODR_CONTEXT, 0, Z_SegmentationD_segments, odr_null}, + {ODR_IMPLICIT, ODR_CONTEXT, 0, Z_SegmentationD_segments, (Odr_fun)odr_null}, {-1, -1, -1, -1, 0} }; if (o->direction == ODR_DECODE) - *p = odr_malloc(o, sizeof(**p)); + *p = (Z_Segmentation *)odr_malloc(o, sizeof(**p)); else if (!*p) return opt; if (odr_choice(o, arm, &(*p)->u, &(*p)->which)) @@ -215,14 +218,14 @@ int z_ExtServices(ODR o, Z_ExtServices **p, int opt) { static Odr_arm arm[] = { - {ODR_IMPLICIT, ODR_CONTEXT, 0, Z_ExtServicesD_req, odr_integer}, - {ODR_IMPLICIT, ODR_CONTEXT, 1, Z_ExtServicesD_permission, odr_integer}, - {ODR_IMPLICIT, ODR_CONTEXT, 2, Z_ExtServicesD_immediate, odr_integer}, + {ODR_IMPLICIT, ODR_CONTEXT, 0, Z_ExtServicesD_req, (Odr_fun)odr_integer}, + {ODR_IMPLICIT, ODR_CONTEXT, 1, Z_ExtServicesD_permission, (Odr_fun)odr_integer}, + {ODR_IMPLICIT, ODR_CONTEXT, 2, Z_ExtServicesD_immediate, (Odr_fun)odr_integer}, {-1, -1, -1, -1, 0} }; if (o->direction == ODR_DECODE) - *p = odr_malloc(o, sizeof(**p)); + *p = (Z_ExtServices *)odr_malloc(o, sizeof(**p)); else if (!*p) return opt; if (odr_choice(o, arm, &(*p)->u, &(*p)->which)) @@ -234,10 +237,10 @@ int z_ExtServices(ODR o, Z_ExtServices **p, int opt) int z_OidList(ODR o, Z_OidList **p, int opt) { if (o->direction == ODR_DECODE) - *p = odr_malloc(o, sizeof(**p)); + *p = (Z_OidList *)odr_malloc(o, sizeof(**p)); else if (!*p) return opt; - if (odr_sequence_of(o, odr_oid, &(*p)->oids, &(*p)->num_oids)) + if (odr_sequence_of(o, (Odr_fun)odr_oid, &(*p)->oids, &(*p)->num_oids)) return 1; *p = 0; return opt && odr_ok(o); @@ -247,18 +250,18 @@ int z_AccessCtrl(ODR o, Z_AccessCtrl **p, int opt) { static Odr_arm arm[] = { - {ODR_IMPLICIT, ODR_CONTEXT, 1, Z_AccessCtrlD_noUser, odr_null}, - {ODR_IMPLICIT, ODR_CONTEXT, 2, Z_AccessCtrlD_refused, odr_null}, - {ODR_IMPLICIT, ODR_CONTEXT, 3, Z_AccessCtrlD_simple, odr_null}, - {ODR_IMPLICIT, ODR_CONTEXT, 4, Z_AccessCtrlD_oid, z_OidList}, - {ODR_IMPLICIT, ODR_CONTEXT, 5, Z_AccessCtrlD_alternative, z_OidList}, - {ODR_IMPLICIT, ODR_CONTEXT, 6, Z_AccessCtrlD_pwdInv, odr_null}, - {ODR_IMPLICIT, ODR_CONTEXT, 7, Z_AccessCtrlD_pwdExp, odr_null}, + {ODR_IMPLICIT, ODR_CONTEXT, 1, Z_AccessCtrlD_noUser, (Odr_fun)odr_null}, + {ODR_IMPLICIT, ODR_CONTEXT, 2, Z_AccessCtrlD_refused, (Odr_fun)odr_null}, + {ODR_IMPLICIT, ODR_CONTEXT, 3, Z_AccessCtrlD_simple, (Odr_fun)odr_null}, + {ODR_IMPLICIT, ODR_CONTEXT, 4, Z_AccessCtrlD_oid, (Odr_fun)z_OidList}, + {ODR_IMPLICIT, ODR_CONTEXT, 5, Z_AccessCtrlD_alternative, (Odr_fun)z_OidList}, + {ODR_IMPLICIT, ODR_CONTEXT, 6, Z_AccessCtrlD_pwdInv, (Odr_fun)odr_null}, + {ODR_IMPLICIT, ODR_CONTEXT, 7, Z_AccessCtrlD_pwdExp, (Odr_fun)odr_null}, {-1, -1, -1, -1, 0} }; if (o->direction == ODR_DECODE) - *p = odr_malloc(o, sizeof(**p)); + *p = (Z_AccessCtrl *)odr_malloc(o, sizeof(**p)); else if (!*p) return opt; if (odr_choice(o, arm, &(*p)->u, &(*p)->which)) @@ -274,7 +277,7 @@ int z_RecordSyntax(ODR o, Z_RecordSyntax **p, int opt) return odr_implicit(o, odr_oid, &(*p)->unsupportedSyntax, ODR_CONTEXT, 1, 0) && odr_implicit_settag(o, ODR_CONTEXT, 2) && - (odr_sequence_of(o, odr_oid, &(*p)->suggestedAlternatives, + (odr_sequence_of(o, (Odr_fun)odr_oid, &(*p)->suggestedAlternatives, &(*p)->num_suggestedAlternatives) || odr_ok(o)) && odr_sequence_end(o); } @@ -283,29 +286,29 @@ int z_DiagFormat(ODR o, Z_DiagFormat **p, int opt) { static Odr_arm arm[] = { - {ODR_IMPLICIT, ODR_CONTEXT, 1000, Z_DiagFormat_tooMany, z_TooMany}, - {ODR_IMPLICIT, ODR_CONTEXT, 1001, Z_DiagFormat_badSpec, z_BadSpec}, - {ODR_IMPLICIT, ODR_CONTEXT, 1002, Z_DiagFormat_dbUnavail, z_DbUnavail}, - {ODR_IMPLICIT, ODR_CONTEXT, 1003, Z_DiagFormat_unSupOp, odr_integer}, - {ODR_IMPLICIT, ODR_CONTEXT, 1004, Z_DiagFormat_attribute, z_Attribute}, - {ODR_IMPLICIT, ODR_CONTEXT, 1005, Z_DiagFormat_attCombo, z_AttCombo}, - {ODR_IMPLICIT, ODR_CONTEXT, 1006, Z_DiagFormat_term, z_DiagTerm}, - {ODR_EXPLICIT, ODR_CONTEXT, 1007, Z_DiagFormat_proximity, z_Proximity}, - {ODR_EXPLICIT, ODR_CONTEXT, 1008, Z_DiagFormat_scan, z_Scan}, - {ODR_EXPLICIT, ODR_CONTEXT, 1009, Z_DiagFormat_sort, z_Sort}, + {ODR_IMPLICIT, ODR_CONTEXT, 1000, Z_DiagFormat_tooMany, (Odr_fun)z_TooMany}, + {ODR_IMPLICIT, ODR_CONTEXT, 1001, Z_DiagFormat_badSpec, (Odr_fun)z_BadSpec}, + {ODR_IMPLICIT, ODR_CONTEXT, 1002, Z_DiagFormat_dbUnavail, (Odr_fun)z_DbUnavail}, + {ODR_IMPLICIT, ODR_CONTEXT, 1003, Z_DiagFormat_unSupOp, (Odr_fun)odr_integer}, + {ODR_IMPLICIT, ODR_CONTEXT, 1004, Z_DiagFormat_attribute, (Odr_fun)z_Attribute}, + {ODR_IMPLICIT, ODR_CONTEXT, 1005, Z_DiagFormat_attCombo, (Odr_fun)z_AttCombo}, + {ODR_IMPLICIT, ODR_CONTEXT, 1006, Z_DiagFormat_term, (Odr_fun)z_DiagTerm}, + {ODR_EXPLICIT, ODR_CONTEXT, 1007, Z_DiagFormat_proximity, (Odr_fun)z_Proximity}, + {ODR_EXPLICIT, ODR_CONTEXT, 1008, Z_DiagFormat_scan, (Odr_fun)z_Scan}, + {ODR_EXPLICIT, ODR_CONTEXT, 1009, Z_DiagFormat_sort, (Odr_fun)z_Sort}, {ODR_EXPLICIT, ODR_CONTEXT, 1010, Z_DiagFormat_segmentation, - z_Segmentation}, + (Odr_fun)z_Segmentation}, {ODR_EXPLICIT, ODR_CONTEXT, 1011, Z_DiagFormat_extServices, - z_ExtServices}, + (Odr_fun)z_ExtServices}, {ODR_EXPLICIT, ODR_CONTEXT, 1012, Z_DiagFormat_accessCtrl, - z_AccessCtrl}, + (Odr_fun)z_AccessCtrl}, {ODR_IMPLICIT, ODR_CONTEXT, 1013, Z_DiagFormat_recordSyntax, - z_RecordSyntax}, + (Odr_fun)z_RecordSyntax}, {-1, -1, -1, -1, 0} }; if (o->direction == ODR_DECODE) - *p = odr_malloc(o, sizeof(**p)); + *p = (Z_DiagFormat *)odr_malloc(o, sizeof(**p)); else if (!*p) return opt; if (odr_choice(o, arm, &(*p)->u, &(*p)->which)) @@ -319,14 +322,14 @@ int z_Diagnostic(ODR o, Z_Diagnostic **p, int opt) static Odr_arm arm[] = { {ODR_IMPLICIT, ODR_CONTEXT, 1, Z_Diagnostic_defaultDiagRec, - z_DefaultDiagFormat}, + (Odr_fun)z_DefaultDiagFormat}, {ODR_EXPLICIT, ODR_CONTEXT, 2, Z_Diagnostic_explicitDiagnostic, - z_DiagFormat}, + (Odr_fun)z_DiagFormat}, {-1, -1, -1, -1, 0} }; if (o->direction == ODR_DECODE) - *p = odr_malloc(o, sizeof(**p)); + *p = (Z_Diagnostic *)odr_malloc(o, sizeof(**p)); else if (!*p) return opt; if (odr_choice(o, arm, &(*p)->u, &(*p)->which)) @@ -349,10 +352,10 @@ int z_DiagnosticUnit(ODR o, Z_DiagnosticUnit **p, int opt) int z_DiagnosticFormat(ODR o, Z_DiagnosticFormat **p, int opt) { if (o->direction == ODR_DECODE) - *p = odr_malloc(o, sizeof(**p)); + *p = (Z_DiagnosticFormat *)odr_malloc(o, sizeof(**p)); else if (!*p) return opt; - if (odr_sequence_of(o, z_DiagnosticUnit, &(*p)->diagnostics, + if (odr_sequence_of(o, (Odr_fun)z_DiagnosticUnit, &(*p)->diagnostics, &(*p)->num_diagnostics)) return 1; *p = 0; diff --git a/asn/prt-esp.c b/asn/prt-esp.c index 8922bfa..3866371 100644 --- a/asn/prt-esp.c +++ b/asn/prt-esp.c @@ -4,7 +4,10 @@ * Sebastian Hammer, Adam Dickmeiss * * $Log: prt-esp.c,v $ - * Revision 1.2 1998-02-10 15:31:46 adam + * Revision 1.3 1998-02-11 11:53:32 adam + * Changed code so that it compiles as C++. + * + * Revision 1.2 1998/02/10 15:31:46 adam * Implemented date and time structure. Changed the Update Extended * Service. * @@ -30,14 +33,14 @@ int z_Occurrences(ODR o, Z_Occurrences **p, int opt) { static Odr_arm arm[] = { - {ODR_IMPLICIT, ODR_CONTEXT, 1, Z_Occurrences_all, odr_null}, - {ODR_IMPLICIT, ODR_CONTEXT, 2, Z_Occurrences_last, odr_null}, - {ODR_IMPLICIT, ODR_CONTEXT, 3, Z_Occurrences_values, z_OccurValues}, + {ODR_IMPLICIT, ODR_CONTEXT, 1, Z_Occurrences_all, (Odr_fun)odr_null}, + {ODR_IMPLICIT, ODR_CONTEXT, 2, Z_Occurrences_last, (Odr_fun)odr_null}, + {ODR_IMPLICIT, ODR_CONTEXT, 3, Z_Occurrences_values, (Odr_fun)z_OccurValues}, {-1, -1, -1, -1, 0} }; if (o->direction == ODR_DECODE) - *p = odr_malloc(o, sizeof(**p)); + *p = (Z_Occurrences *)odr_malloc(o, sizeof(**p)); else if (!*p) return opt; if (odr_choice(o, arm, &(*p)->u, &(*p)->which)) @@ -63,14 +66,14 @@ int z_ETagUnit(ODR o, Z_ETagUnit **p, int opt) { static Odr_arm arm[] = { - {ODR_IMPLICIT, ODR_CONTEXT, 1, Z_ETagUnit_specificTag, z_SpecificTag}, - {ODR_EXPLICIT, ODR_CONTEXT, 2, Z_ETagUnit_wildThing, z_Occurrences}, - {ODR_IMPLICIT, ODR_CONTEXT, 3, Z_ETagUnit_wildPath, odr_null}, + {ODR_IMPLICIT, ODR_CONTEXT, 1, Z_ETagUnit_specificTag, (Odr_fun)z_SpecificTag}, + {ODR_EXPLICIT, ODR_CONTEXT, 2, Z_ETagUnit_wildThing, (Odr_fun)z_Occurrences}, + {ODR_IMPLICIT, ODR_CONTEXT, 3, Z_ETagUnit_wildPath, (Odr_fun)odr_null}, {-1, -1, -1 -1, 0} }; if (o->direction == ODR_DECODE) - *p = odr_malloc(o, sizeof(**p)); + *p = (Z_ETagUnit *)odr_malloc(o, sizeof(**p)); else if (!*p) return opt; if (odr_choice(o, arm, &(*p)->u, &(*p)->which)) @@ -82,10 +85,10 @@ int z_ETagUnit(ODR o, Z_ETagUnit **p, int opt) int z_ETagPath(ODR o, Z_ETagPath **p, int opt) { if (o->direction == ODR_DECODE) - *p = odr_malloc(o, sizeof(**p)); + *p = (Z_ETagPath *)odr_malloc(o, sizeof(**p)); else if (!*p) return opt; - if (odr_sequence_of(o, z_ETagUnit, &(*p)->tags, &(*p)->num_tags)) + if (odr_sequence_of(o, (Odr_fun)z_ETagUnit, &(*p)->tags, &(*p)->num_tags)) return 1; *p = 0; return opt && odr_ok(o); @@ -105,7 +108,7 @@ int z_SimpleElement(ODR o, Z_SimpleElement **p, int opt) int z_CompoPrimitives(ODR o, Z_CompoPrimitives **p, int opt) { if (o->direction == ODR_DECODE) - *p = odr_malloc(o, sizeof(**p)); + *p = (Z_CompoPrimitives *)odr_malloc(o, sizeof(**p)); else if (!*p) return opt; if (odr_sequence_of(o, z_InternationalString, &(*p)->primitives, @@ -118,10 +121,10 @@ int z_CompoPrimitives(ODR o, Z_CompoPrimitives **p, int opt) int z_CompoSpecs(ODR o, Z_CompoSpecs **p, int opt) { if (o->direction == ODR_DECODE) - *p = odr_malloc(o, sizeof(**p)); + *p = (Z_CompoSpecs *)odr_malloc(o, sizeof(**p)); else if (!*p) return opt; - if (odr_sequence_of(o, z_SimpleElement, &(*p)->specs, &(*p)->num_specs)) + if (odr_sequence_of(o, (Odr_fun)z_SimpleElement, &(*p)->specs, &(*p)->num_specs)) return 1; *p = 0; return opt && odr_ok(o); @@ -132,9 +135,9 @@ int z_CompositeElement(ODR o, Z_CompositeElement **p, int opt) static Odr_arm arm[] = { {ODR_IMPLICIT, ODR_CONTEXT, 1, Z_CompoElement_primitives, - z_CompoPrimitives}, + (Odr_fun)z_CompoPrimitives}, {ODR_IMPLICIT, ODR_CONTEXT, 2, Z_CompoElement_specs, - z_CompoSpecs}, + (Odr_fun)z_CompoSpecs}, {-1, -1, -1, -1, 0} }; @@ -154,14 +157,14 @@ int z_ElementRequest(ODR o, Z_ElementRequest **p, int opt) static Odr_arm arm[] = { {ODR_IMPLICIT, ODR_CONTEXT, 1, Z_ERequest_simpleElement, - z_SimpleElement}, + (Odr_fun)z_SimpleElement}, {ODR_IMPLICIT, ODR_CONTEXT, 2, Z_ERequest_compositeElement, - z_CompositeElement}, + (Odr_fun)z_CompositeElement}, {-1, -1, -1 -1, 0} }; if (o->direction == ODR_DECODE) - *p = odr_malloc(o, sizeof(**p)); + *p = (Z_ElementRequest *)odr_malloc(o, sizeof(**p)); else if (!*p) return opt; if (odr_choice(o, arm, &(*p)->u, &(*p)->which)) @@ -185,7 +188,7 @@ int z_Espec1(ODR o, Z_Espec1 **p, int opt) odr_implicit(o, odr_integer, &(*p)->defaultTagType, ODR_CONTEXT, 4, 1) && odr_implicit_settag(o, ODR_CONTEXT, 5) && - (odr_sequence_of(o, z_ElementRequest, &(*p)->elements, + (odr_sequence_of(o, (Odr_fun)z_ElementRequest, &(*p)->elements, &(*p)->num_elements) || odr_ok(o)) && odr_sequence_end(o); } diff --git a/asn/prt-exd.c b/asn/prt-exd.c index 085d09c..d2569e6 100644 --- a/asn/prt-exd.c +++ b/asn/prt-exd.c @@ -4,7 +4,10 @@ * Sebastian Hammer, Adam Dickmeiss * * $Log: prt-exd.c,v $ - * Revision 1.7 1998-02-10 15:31:46 adam + * Revision 1.8 1998-02-11 11:53:32 adam + * Changed code so that it compiles as C++. + * + * Revision 1.7 1998/02/10 15:31:46 adam * Implemented date and time structure. Changed the Update Extended * Service. * @@ -52,7 +55,7 @@ int z_TaskPackage(ODR o, Z_TaskPackage **p, int opt) 8, 1) && odr_implicit(o, odr_integer, &(*p)->taskStatus, ODR_CONTEXT, 9, 0) && odr_implicit_settag(o, ODR_CONTEXT, 10) && - (odr_sequence_of(o, z_DiagRec, &(*p)->packageDiagnostics, + (odr_sequence_of(o, (Odr_fun)z_DiagRec, &(*p)->packageDiagnostics, &(*p)->num_packageDiagnostics) || odr_ok(o)) && odr_implicit(o, z_External, &(*p)->taskSpecificParameters, ODR_CONTEXT, 11, 0) && @@ -128,16 +131,16 @@ int z_IOBilling(ODR o, Z_IOBilling **p, int opt) { static Odr_arm arm[] = { - {ODR_IMPLICIT, ODR_CONTEXT, 0, Z_IOBilling_billInvoice, odr_null}, - {ODR_IMPLICIT, ODR_CONTEXT, 1, Z_IOBilling_prepay, odr_null}, - {ODR_IMPLICIT, ODR_CONTEXT, 2, Z_IOBilling_depositAccount, odr_null}, + {ODR_IMPLICIT, ODR_CONTEXT, 0, Z_IOBilling_billInvoice, (Odr_fun)odr_null}, + {ODR_IMPLICIT, ODR_CONTEXT, 1, Z_IOBilling_prepay, (Odr_fun)odr_null}, + {ODR_IMPLICIT, ODR_CONTEXT, 2, Z_IOBilling_depositAccount, (Odr_fun)odr_null}, {ODR_IMPLICIT, ODR_CONTEXT, 3, Z_IOBilling_creditCard, - z_IOCreditCardInfo}, + (Odr_fun)z_IOCreditCardInfo}, {ODR_IMPLICIT, ODR_CONTEXT, 4, Z_IOBilling_cardInfoPreviouslySupplied, - odr_null}, - {ODR_IMPLICIT, ODR_CONTEXT, 5, Z_IOBilling_privateKnown, odr_null}, + (Odr_fun)odr_null}, + {ODR_IMPLICIT, ODR_CONTEXT, 5, Z_IOBilling_privateKnown, (Odr_fun)odr_null}, {ODR_IMPLICIT, ODR_CONTEXT, 6, Z_IOBilling_privateNotKnown, - z_External}, + (Odr_fun)z_External}, {-1, -1, -1, -1, 0} }; @@ -195,14 +198,14 @@ int z_ItemOrder(ODR o, Z_ItemOrder **p, int opt) { static Odr_arm arm[] = { - {ODR_IMPLICIT, ODR_CONTEXT, 1, Z_ItemOrder_esRequest, z_IORequest}, + {ODR_IMPLICIT, ODR_CONTEXT, 1, Z_ItemOrder_esRequest, (Odr_fun)z_IORequest}, {ODR_IMPLICIT, ODR_CONTEXT, 2, Z_ItemOrder_taskPackage, - z_IOTaskPackage}, + (Odr_fun)z_IOTaskPackage}, {-1, -1, -1, -1, 0} }; if (o->direction == ODR_DECODE) - *p = odr_malloc(o, sizeof(**p)); + *p = (Z_ItemOrder *)odr_malloc(o, sizeof(**p)); else if (!*p) return opt; if (odr_choice(o, arm, &(*p)->u, &(*p)->which)) @@ -221,7 +224,7 @@ int z_IUSuppliedRecordsId (ODR o, Z_IUSuppliedRecordsId **p, int opt) {ODR_IMPLICIT, ODR_CONTEXT, 2, Z_IUSuppliedRecordsId_versionNumber, z_InternationalString}, {ODR_IMPLICIT, ODR_CONTEXT, 3, Z_IUSuppliedRecordsId_previousVersion, - odr_external}, + (Odr_fun)odr_external}, {-1, -1, -1, -1, 0} }; if (!odr_initmember(o, p, sizeof(**p))) @@ -248,11 +251,11 @@ int z_IUSuppliedRecords_elem (ODR o, Z_IUSuppliedRecords_elem **p, int opt) { static Odr_arm arm[] = { {ODR_IMPLICIT, ODR_CONTEXT, 1, Z_IUSuppliedRecords_number, - odr_integer}, + (Odr_fun)odr_integer}, {ODR_IMPLICIT, ODR_CONTEXT, 2, Z_IUSuppliedRecords_string, - z_InternationalString}, + (Odr_fun)z_InternationalString}, {ODR_IMPLICIT, ODR_CONTEXT, 3, Z_IUSuppliedRecords_opaque, - odr_octetstring}, + (Odr_fun)odr_octetstring}, {-1, -1, -1, -1, 0} }; if (!odr_sequence_begin (o, p, sizeof(**p))) @@ -274,7 +277,7 @@ int z_IUSuppliedRecords (ODR o, Z_IUSuppliedRecords **p, int opt) { if (!odr_initmember (o, p, sizeof(**p))) return opt && odr_ok(o); - if (odr_sequence_of (o, z_IUSuppliedRecords_elem, &(*p)->elements, + if (odr_sequence_of (o, (Odr_fun)z_IUSuppliedRecords_elem, &(*p)->elements, &(*p)->num)) return 1; *p = 0; @@ -286,9 +289,9 @@ int z_IUTaskPackageRecordStructure (ODR o, Z_IUTaskPackageRecordStructure **p, { static Odr_arm arm[] = { {ODR_IMPLICIT, ODR_CONTEXT, 1, Z_IUTaskPackageRecordStructure_record, - odr_external}, + (Odr_fun)odr_external}, {ODR_EXPLICIT, ODR_CONTEXT, 2, Z_IUTaskPackageRecordStructure_surrogateDiagnostics, - z_DiagRecs}, + (Odr_fun)z_DiagRecs}, {-1, -1, -1, -1, 0} }; if (!odr_sequence_begin (o, p, sizeof(**p))) @@ -332,10 +335,10 @@ int z_IUTargetPart (ODR o, Z_IUTargetPart **p, int opt) odr_implicit (o, odr_integer, &(*p)->updateStatus, ODR_CONTEXT, 1, 0) && odr_implicit_settag (o, ODR_CONTEXT, 2) && - (odr_sequence_of(o, z_DiagRec, &(*p)->globalDiagnostics, + (odr_sequence_of(o, (Odr_fun)z_DiagRec, &(*p)->globalDiagnostics, &(*p)->num_globalDiagnostics) || odr_ok(o)) && odr_implicit_settag (o, ODR_CONTEXT, 3) && - odr_sequence_of(o, z_IUTaskPackageRecordStructure, &(*p)->taskPackageRecords, + odr_sequence_of(o, (Odr_fun)z_IUTaskPackageRecordStructure, &(*p)->taskPackageRecords, &(*p)->num_taskPackageRecords) && odr_sequence_end (o); } @@ -368,9 +371,9 @@ int z_IUUpdate (ODR o, Z_IUUpdate **p, int opt) { static Odr_arm arm[] = { {ODR_IMPLICIT, ODR_CONTEXT, 1, Z_IUUpdate_esRequest, - z_IUUpdateEsRequest}, + (Odr_fun)z_IUUpdateEsRequest}, {ODR_IMPLICIT, ODR_CONTEXT, 2, Z_IUUpdate_taskPackage, - z_IUUpdateTaskPackage}, + (Odr_fun)z_IUUpdateTaskPackage}, {-1, -1, -1, -1, 0} }; if (!odr_initmember(o, p, sizeof(**p))) diff --git a/asn/prt-exp.c b/asn/prt-exp.c index b11a9aa..b030e1f 100644 --- a/asn/prt-exp.c +++ b/asn/prt-exp.c @@ -4,7 +4,10 @@ * Sebastian Hammer, Adam Dickmeiss * * $Log: prt-exp.c,v $ - * Revision 1.8 1996-01-02 11:46:41 quinn + * Revision 1.9 1998-02-11 11:53:32 adam + * Changed code so that it compiles as C++. + * + * Revision 1.8 1996/01/02 11:46:41 quinn * Changed 'operator' to 'roperator' to avoid C++ conflict. * * Revision 1.7 1995/12/14 16:28:07 quinn @@ -145,7 +148,7 @@ int z_HumanString(ODR o, Z_HumanString **p, int opt) { if (!odr_initmember(o, p, sizeof(**p))) return opt && odr_ok(o); - if (odr_sequence_of(o, z_HumanStringUnit, &(*p)->strings, + if (odr_sequence_of(o, (Odr_fun)z_HumanStringUnit, &(*p)->strings, &(*p)->num_strings)) return 1; *p = 0; @@ -179,7 +182,7 @@ int z_IconObject(ODR o, Z_IconObject **p, int opt) { if (!odr_initmember(o, p, sizeof(**p))) return opt && odr_ok(o); - if (odr_sequence_of(o, z_IconObjectUnit, &(*p)->iconUnits, + if (odr_sequence_of(o, (Odr_fun)z_IconObjectUnit, &(*p)->iconUnits, &(*p)->num_iconUnits)) return 1; *p = 0; @@ -236,11 +239,11 @@ int z_NetworkAddress(ODR o, Z_NetworkAddress **p, int opt) static Odr_arm arm[] = { {ODR_IMPLICIT, ODR_CONTEXT, 0, Z_NetworkAddress_iA, - z_NetworkAddressIA}, + (Odr_fun)z_NetworkAddressIA}, {ODR_IMPLICIT, ODR_CONTEXT, 1, Z_NetworkAddress_oPA, - z_NetworkAddressOPA}, + (Odr_fun)z_NetworkAddressOPA}, {ODR_IMPLICIT, ODR_CONTEXT, 2, Z_NetworkAddress_other, - z_NetworkAddressOther}, + (Odr_fun)z_NetworkAddressOther}, {-1, -1, -1, -1, 0} }; @@ -258,34 +261,34 @@ int z_AccessInfo(ODR o, Z_AccessInfo **p, int opt) return opt && odr_ok(o); return odr_implicit_settag(o, ODR_CONTEXT, 0) && - (odr_sequence_of(o, z_QueryTypeDetails, &(*p)->queryTypesSupported, + (odr_sequence_of(o, (Odr_fun)z_QueryTypeDetails, &(*p)->queryTypesSupported, &(*p)->num_queryTypesSupported) || odr_ok(o)) && odr_implicit_settag(o, ODR_CONTEXT, 1) && - (odr_sequence_of(o, odr_oid, &(*p)->diagnosticsSets, + (odr_sequence_of(o, (Odr_fun)odr_oid, &(*p)->diagnosticsSets, &(*p)->num_diagnosticsSets) || odr_ok(o)) && odr_implicit_settag(o, ODR_CONTEXT, 2) && - (odr_sequence_of(o, odr_oid, &(*p)->attributeSetIds, + (odr_sequence_of(o, (Odr_fun)odr_oid, &(*p)->attributeSetIds, &(*p)->num_attributeSetIds) || odr_ok(o)) && odr_implicit_settag(o, ODR_CONTEXT, 3) && - (odr_sequence_of(o, odr_oid, &(*p)->schemas, &(*p)->num_schemas) || + (odr_sequence_of(o, (Odr_fun)odr_oid, &(*p)->schemas, &(*p)->num_schemas) || odr_ok(o)) && odr_implicit_settag(o, ODR_CONTEXT, 4) && - (odr_sequence_of(o, odr_oid, &(*p)->recordSyntaxes, + (odr_sequence_of(o, (Odr_fun)odr_oid, &(*p)->recordSyntaxes, &(*p)->num_recordSyntaxes) || odr_ok(o)) && odr_implicit_settag(o, ODR_CONTEXT, 5) && - (odr_sequence_of(o, odr_oid, &(*p)->resourceChallenges, + (odr_sequence_of(o, (Odr_fun)odr_oid, &(*p)->resourceChallenges, &(*p)->num_resourceChallenges) || odr_ok(o)) && odr_implicit(o, z_AccessRestrictions, &(*p)->restrictedAccess, ODR_CONTEXT, 6, 1) && odr_implicit(o, z_Costs, &(*p)->costInfo, ODR_CONTEXT, 8, 1) && odr_implicit_settag(o, ODR_CONTEXT, 9) && - (odr_sequence_of(o, odr_oid, &(*p)->variantSets, + (odr_sequence_of(o, (Odr_fun)odr_oid, &(*p)->variantSets, &(*p)->num_variantSets) || odr_ok(o)) && odr_implicit_settag(o, ODR_CONTEXT, 10) && - (odr_sequence_of(o, z_ElementSetName, &(*p)->elementSetNames, + (odr_sequence_of(o, (Odr_fun)z_ElementSetName, &(*p)->elementSetNames, &(*p)->num_elementSetNames) || odr_ok(o)) && odr_implicit_settag(o, ODR_CONTEXT, 11) && - (odr_sequence_of(o, z_InternationalString, &(*p)->unitSystems, + (odr_sequence_of(o, (Odr_fun)z_InternationalString, &(*p)->unitSystems, &(*p)->num_unitSystems) || odr_ok(o)) && odr_sequence_end(o); } @@ -295,17 +298,17 @@ int z_QueryTypeDetails(ODR o, Z_QueryTypeDetails **p, int opt) static Odr_arm arm[] = { {ODR_IMPLICIT, ODR_CONTEXT, 0, Z_QueryTypeDetails_private, - z_PrivateCapabilities}, + (Odr_fun)z_PrivateCapabilities}, {ODR_IMPLICIT, ODR_CONTEXT, 1, Z_QueryTypeDetails_rpn, - z_RpnCapabilities}, + (Odr_fun)z_RpnCapabilities}, {ODR_IMPLICIT, ODR_CONTEXT, 2, Z_QueryTypeDetails_iso8777, - z_Iso8777Capabilities}, + (Odr_fun)z_Iso8777Capabilities}, {ODR_IMPLICIT, ODR_CONTEXT, 3, Z_QueryTypeDetails_z3958, - z_HumanString}, + (Odr_fun)z_HumanString}, {ODR_IMPLICIT, ODR_CONTEXT, 4, Z_QueryTypeDetails_erpn, - z_RpnCapabilities}, + (Odr_fun)z_RpnCapabilities}, {ODR_IMPLICIT, ODR_CONTEXT, 5, Z_QueryTypeDetails_rankedList, - z_HumanString}, + (Odr_fun)z_HumanString}, {-1, -1, -1, -1, 0} }; @@ -333,13 +336,13 @@ int z_PrivateCapabilities(ODR o, Z_PrivateCapabilities **p, int opt) return opt && odr_ok(o); return odr_implicit_settag(o, ODR_CONTEXT, 0) && - (odr_sequence_of(o, z_PrivateCapOperator, &(*p)->operators, + (odr_sequence_of(o, (Odr_fun)z_PrivateCapOperator, &(*p)->operators, &(*p)->num_operators) || odr_ok(o)) && odr_implicit_settag(o, ODR_CONTEXT, 1) && - (odr_sequence_of(o, z_SearchKey, &(*p)->searchKeys, + (odr_sequence_of(o, (Odr_fun)z_SearchKey, &(*p)->searchKeys, &(*p)->num_searchKeys) || odr_ok(o)) && odr_implicit_settag(o, ODR_CONTEXT, 2) && - (odr_sequence_of(o, z_HumanString, &(*p)->description, + (odr_sequence_of(o, (Odr_fun)z_HumanString, &(*p)->description, &(*p)->num_description) || odr_ok(o)) && odr_sequence_end(o); } @@ -350,7 +353,7 @@ int z_RpnCapabilities(ODR o, Z_RpnCapabilities **p, int opt) return opt && odr_ok(o); return odr_implicit_settag(o, ODR_CONTEXT, 0) && - (odr_sequence_of(o, odr_integer, &(*p)->operators, &(*p)->num_operators) || odr_ok(o)) && + (odr_sequence_of(o, (Odr_fun)odr_integer, &(*p)->operators, &(*p)->num_operators) || odr_ok(o)) && odr_implicit(o, odr_bool, &(*p)->resultSetAsOperandSupported, ODR_CONTEXT, 1, 0) && odr_implicit(o, odr_bool, &(*p)->restrictionOperandSupported, @@ -366,7 +369,7 @@ int z_Iso8777Capabilities(ODR o, Z_Iso8777Capabilities **p, int opt) return opt && odr_ok(o); return odr_implicit_settag(o, ODR_CONTEXT, 0) && - odr_sequence_of(o, z_SearchKey, &(*p)->searchKeys, + odr_sequence_of(o, (Odr_fun)z_SearchKey, &(*p)->searchKeys, &(*p)->num_searchKeys) && odr_implicit(o, z_HumanString, &(*p)->restrictions, ODR_CONTEXT, 1, 1) && @@ -388,9 +391,9 @@ int z_ProxSupportUnit(ODR o, Z_ProxSupportUnit **p, int opt) static Odr_arm arm[] = { {ODR_IMPLICIT, ODR_CONTEXT, 1, Z_ProxSupportUnit_known, - odr_integer}, + (Odr_fun)odr_integer}, {ODR_IMPLICIT, ODR_CONTEXT, 2, Z_ProxSupportUnit_private, - z_ProxSupportPrivate}, + (Odr_fun)z_ProxSupportPrivate}, {-1, -1, -1, -1, 0} }; @@ -409,7 +412,7 @@ int z_ProximitySupport(ODR o, Z_ProximitySupport **p, int opt) return odr_implicit(o, odr_bool, &(*p)->anySupport, ODR_CONTEXT, 0, 0) && odr_implicit_settag(o, ODR_CONTEXT, 1) && - (odr_sequence_of(o, z_ProxSupportUnit, &(*p)->unitsSupported, + (odr_sequence_of(o, (Odr_fun)z_ProxSupportUnit, &(*p)->unitsSupported, &(*p)->num_unitsSupported) || odr_ok(o)) && odr_sequence_end(o); } @@ -432,7 +435,7 @@ int z_AccessRestrictionsUnit(ODR o, Z_AccessRestrictionsUnit **p, int opt) odr_explicit(o, odr_integer, &(*p)->accessType, ODR_CONTEXT, 0, 0) && odr_implicit(o, z_HumanString, &(*p)->accessText, ODR_CONTEXT, 1, 1) && odr_implicit_settag(o, ODR_CONTEXT, 2) && - (odr_sequence_of(o, odr_oid, &(*p)->accessChallenges, + (odr_sequence_of(o, (Odr_fun)odr_oid, &(*p)->accessChallenges, &(*p)->num_accessChallenges) || odr_ok(o)) && odr_sequence_end(o); } @@ -441,7 +444,7 @@ int z_AccessRestrictions(ODR o, Z_AccessRestrictions **p, int opt) { if (!odr_initmember(o, p, sizeof(**p))) return opt && odr_ok(o); - if (odr_sequence_of(o, z_AccessRestrictionsUnit, &(*p)->restrictions, + if (odr_sequence_of(o, (Odr_fun)z_AccessRestrictionsUnit, &(*p)->restrictions, &(*p)->num_restrictions)) return 1; *p = 0; @@ -469,7 +472,7 @@ int z_Costs(ODR o, Z_Costs **p, int opt) odr_implicit(o, z_Charge, &(*p)->searchCharge, ODR_CONTEXT, 3, 1) && odr_implicit(o, z_Charge, &(*p)->subscriptCharge, ODR_CONTEXT, 4, 1) && odr_implicit_settag(o, ODR_CONTEXT, 5) && - (odr_sequence_of(o, z_CostsOtherCharge, &(*p)->otherCharges, + (odr_sequence_of(o, (Odr_fun)z_CostsOtherCharge, &(*p)->otherCharges, &(*p)->num_otherCharges) || odr_ok(o)) && odr_sequence_end(o); } @@ -504,7 +507,7 @@ int z_AttributeCombinations(ODR o, Z_AttributeCombinations **p, int opt) odr_implicit(o, odr_oid, &(*p)->defaultAttributeSet, ODR_CONTEXT, 0, 0) && odr_implicit_settag(o, ODR_CONTEXT, 1) && - odr_sequence_of(o, z_AttributeCombination, &(*p)->legalCombinations, + odr_sequence_of(o, (Odr_fun)z_AttributeCombination, &(*p)->legalCombinations, &(*p)->num_legalCombinations) && odr_sequence_end(o); } @@ -513,7 +516,7 @@ int z_AttributeCombination(ODR o, Z_AttributeCombination **p, int opt) { if (!odr_initmember(o, p, sizeof(**p))) return opt && odr_ok(o); - if (odr_sequence_of(o, z_AttributeOccurrence, &(*p)->occurrences, + if (odr_sequence_of(o, (Odr_fun)z_AttributeOccurrence, &(*p)->occurrences, &(*p)->num_occurrences)) return 1; *p = 0; @@ -524,7 +527,7 @@ int z_AttributeValueList(ODR o, Z_AttributeValueList **p, int opt) { if (!odr_initmember(o, p, sizeof(**p))) return opt && odr_ok(o); - if (odr_sequence_of(o, z_StringOrNumeric, &(*p)->attributes, + if (odr_sequence_of(o, (Odr_fun)z_StringOrNumeric, &(*p)->attributes, &(*p)->num_attributes)) return 1; *p = 0; @@ -535,9 +538,9 @@ int z_AttributeOccurrence(ODR o, Z_AttributeOccurrence **p, int opt) { static Odr_arm arm[] = { - {ODR_IMPLICIT, ODR_CONTEXT, 3, Z_AttributeOcc_anyOrNone, odr_null}, + {ODR_IMPLICIT, ODR_CONTEXT, 3, Z_AttributeOcc_anyOrNone, (Odr_fun)odr_null}, {ODR_IMPLICIT, ODR_CONTEXT, 4, Z_AttributeOcc_specific, - z_AttributeValueList}, + (Odr_fun)z_AttributeValueList}, {-1, -1, -1, -1, 0} }; @@ -559,10 +562,10 @@ int z_AttributeValue(ODR o, Z_AttributeValue **p, int opt) odr_explicit(o, z_StringOrNumeric, &(*p)->value, ODR_CONTEXT, 0, 0) && odr_implicit(o, z_HumanString, &(*p)->description, ODR_CONTEXT, 1, 1) && odr_implicit_settag(o, ODR_CONTEXT, 2) && - (odr_sequence_of(o, z_StringOrNumeric, &(*p)->subAttributes, + (odr_sequence_of(o, (Odr_fun)z_StringOrNumeric, &(*p)->subAttributes, &(*p)->num_subAttributes) || odr_ok(o)) && odr_implicit_settag(o, ODR_CONTEXT, 3) && - (odr_sequence_of(o, z_StringOrNumeric, &(*p)->superAttributes, + (odr_sequence_of(o, (Odr_fun)z_StringOrNumeric, &(*p)->superAttributes, &(*p)->num_superAttributes) || odr_ok(o)) && odr_implicit(o, odr_null, &(*p)->partialSupport, ODR_CONTEXT, 4, 1) && odr_sequence_end(o); @@ -600,10 +603,10 @@ int z_TargetInfo(ODR o, Z_TargetInfo **p, int opt) 15, 1) && odr_implicit(o, z_HumanString, &(*p)->hours, ODR_CONTEXT, 16, 1) && odr_implicit_settag(o, ODR_CONTEXT, 17) && - (odr_sequence_of(o, z_DatabaseList, &(*p)->dbCombinations, + (odr_sequence_of(o, (Odr_fun)z_DatabaseList, &(*p)->dbCombinations, &(*p)->num_dbCombinations) || odr_ok(o)) && odr_implicit_settag(o, ODR_CONTEXT, 18) && - (odr_sequence_of(o, z_NetworkAddress, &(*p)->addresses, + (odr_sequence_of(o, (Odr_fun)z_NetworkAddress, &(*p)->addresses, &(*p)->num_addresses) || odr_ok(o)) && odr_implicit(o, z_AccessInfo, &(*p)->commonAccessInfo, ODR_CONTEXT, 19, 1) && @@ -615,9 +618,9 @@ int z_DatabaseInfo(ODR o, Z_DatabaseInfo **p, int opt) static Odr_arm arm[] = { {ODR_IMPLICIT, ODR_CONTEXT, 0, Z_Exp_RecordCount_actualNumber, - odr_integer}, + (Odr_fun)odr_integer}, {ODR_IMPLICIT, ODR_CONTEXT, 1, Z_Exp_RecordCount_approxNumber, - odr_integer}, + (Odr_fun)odr_integer}, {-1, -1, -1, -1, 0} }; @@ -635,7 +638,7 @@ int z_DatabaseInfo(ODR o, Z_DatabaseInfo **p, int opt) odr_implicit(o, odr_bool, &(*p)->available, ODR_CONTEXT, 6, 0) && odr_implicit(o, z_HumanString, &(*p)->titleString, ODR_CONTEXT, 7, 1) && odr_implicit_settag(o, ODR_CONTEXT, 8) && - (odr_sequence_of(o, z_HumanString, &(*p)->keywords, + (odr_sequence_of(o, (Odr_fun)z_HumanString, &(*p)->keywords, &(*p)->num_keywords) || odr_ok(o)) && odr_implicit(o, z_HumanString, &(*p)->description, ODR_CONTEXT, 9, 1) && odr_implicit(o, z_DatabaseList, &(*p)->associatedDbs, ODR_CONTEXT, @@ -695,10 +698,10 @@ int z_SchemaInfo(ODR o, Z_SchemaInfo **p, int opt) 2, 0) && odr_implicit(o, z_HumanString, &(*p)->description, ODR_CONTEXT, 3, 1) && odr_implicit_settag(o, ODR_CONTEXT, 4) && - (odr_sequence_of(o, z_TagTypeMapping, &(*p)->tagTypeMapping, + (odr_sequence_of(o, (Odr_fun)z_TagTypeMapping, &(*p)->tagTypeMapping, &(*p)->num_tagTypeMapping) || odr_ok(o)) && odr_implicit_settag(o, ODR_CONTEXT, 5) && - (odr_sequence_of(o, z_ElementInfo, &(*p)->recordStructure, + (odr_sequence_of(o, (Odr_fun)z_ElementInfo, &(*p)->recordStructure, &(*p)->num_recordStructure) || odr_ok(o)) && odr_sequence_end(o); } @@ -733,7 +736,7 @@ int z_Path(ODR o, Z_Path **p, int opt) if (!odr_initmember(o, p, sizeof(**p))) return opt && odr_ok(o); odr_implicit_settag(o, ODR_CONTEXT, 201); - if (odr_sequence_of(o, z_OtherInformationUnit, &(*p)->list, + if (odr_sequence_of(o, (Odr_fun)z_OtherInformationUnit, &(*p)->list, &(*p)->num)) return 1; *p = 0; @@ -745,7 +748,7 @@ int z_ElementInfoList(ODR o, Z_Path **p, int opt) if (!odr_initmember(o, p, sizeof(**p))) return opt && odr_ok(o); odr_implicit_settag(o, ODR_CONTEXT, 201); - if (odr_sequence_of(o, z_OtherInformationUnit, &(*p)->list, + if (odr_sequence_of(o, (Odr_fun)z_OtherInformationUnit, &(*p)->list, &(*p)->num)) return 1; *p = 0; @@ -757,9 +760,9 @@ int z_ElementDataType(ODR o, Z_ElementDataType **p, int opt) static Odr_arm arm[] = { {ODR_IMPLICIT, ODR_CONTEXT, 0, Z_ElementDataType_primitive, - odr_integer}, + (Odr_fun)odr_integer}, {ODR_IMPLICIT, ODR_CONTEXT, 1, Z_ElementDataType_structured, - z_ElementInfoList}, + (Odr_fun)z_ElementInfoList}, {-1, -1, -1, -1, 0} }; @@ -802,7 +805,7 @@ int z_TagSetInfo(ODR o, Z_TagSetInfo **p, int opt) odr_implicit(o, z_HumanString, &(*p)->description, ODR_CONTEXT, 3, 1) && odr_implicit_settag(o, ODR_CONTEXT, 4) && - (odr_sequence_of(o, z_TagSetInfoElements, &(*p)->elements, + (odr_sequence_of(o, (Odr_fun)z_TagSetInfoElements, &(*p)->elements, &(*p)->num_elements) || odr_ok(o)) && odr_sequence_end(o); } @@ -817,13 +820,13 @@ int z_RecordSyntaxInfo(ODR o, Z_RecordSyntaxInfo **p, int opt) odr_implicit(o, z_InternationalString, &(*p)->name, ODR_CONTEXT, 2, 0) && odr_implicit_settag(o, ODR_CONTEXT, 3) && - (odr_sequence_of(o, odr_oid, &(*p)->transferSyntaxes, + (odr_sequence_of(o, (Odr_fun)odr_oid, &(*p)->transferSyntaxes, &(*p)->num_transferSyntaxes) || odr_ok(o)) && odr_implicit(o, z_HumanString, &(*p)->description, ODR_CONTEXT, 4, 1) && odr_implicit(o, z_InternationalString, &(*p)->asn1Module, ODR_CONTEXT, 5, 1) && odr_implicit_settag(o, ODR_CONTEXT, 6) && - (odr_sequence_of(o, z_ElementInfo, &(*p)->abstractStructure, + (odr_sequence_of(o, (Odr_fun)z_ElementInfo, &(*p)->abstractStructure, &(*p)->num_abstractStructure) || odr_ok(o)) && odr_sequence_end(o); } @@ -837,7 +840,7 @@ int z_AttributeSetInfo(ODR o, Z_AttributeSetInfo **p, int opt) odr_implicit(o, odr_oid, &(*p)->attributeSet, ODR_CONTEXT, 1, 0) && odr_implicit(o, z_InternationalString, &(*p)->name, ODR_CONTEXT, 2, 0) && odr_implicit_settag(o, ODR_CONTEXT, 3) && - (odr_sequence_of(o, z_AttributeType, &(*p)->attributes, + (odr_sequence_of(o, (Odr_fun)z_AttributeType, &(*p)->attributes, &(*p)->num_attributes) || odr_ok(o)) && odr_implicit(o, z_HumanString, &(*p)->description, ODR_CONTEXT, 4, 1) && odr_sequence_end(o); @@ -852,7 +855,7 @@ int z_AttributeType(ODR o, Z_AttributeType **p, int opt) odr_implicit(o, z_HumanString, &(*p)->description, ODR_CONTEXT, 1, 1) && odr_implicit(o, odr_integer, &(*p)->attributeType, ODR_CONTEXT, 2, 0) && odr_implicit_settag(o, ODR_CONTEXT, 3) && - odr_sequence_of(o, z_AttributeDescription, &(*p)->attributeValues, + odr_sequence_of(o, (Odr_fun)z_AttributeDescription, &(*p)->attributeValues, &(*p)->num_attributeValues) && odr_sequence_end(o); } @@ -866,7 +869,7 @@ int z_AttributeDescription(ODR o, Z_AttributeDescription **p, int opt) odr_implicit(o, z_HumanString, &(*p)->description, ODR_CONTEXT, 1, 1) && odr_explicit(o, z_StringOrNumeric, &(*p)->attributeValue, ODR_CONTEXT, 2, 0) && odr_implicit_settag(o, ODR_CONTEXT, 3) && - (odr_sequence_of(o, z_StringOrNumeric, &(*p)->equivalentAttributes, + (odr_sequence_of(o, (Odr_fun)z_StringOrNumeric, &(*p)->equivalentAttributes, &(*p)->num_equivalentAttributes) || odr_ok(o)) && odr_sequence_end(o); } @@ -898,7 +901,7 @@ int z_TermListInfo(ODR o, Z_TermListInfo **p, int opt) odr_implicit(o, z_DatabaseName, &(*p)->databaseName, ODR_CONTEXT, 1, 0) && odr_implicit_settag(o, ODR_CONTEXT, 2) && - (odr_sequence_of(o, z_TermListElement, &(*p)->termLists, + (odr_sequence_of(o, (Odr_fun)z_TermListElement, &(*p)->termLists, &(*p)->num_termLists) || odr_ok(o)) && odr_sequence_end(o); } @@ -931,7 +934,7 @@ int z_AttributeDetails(ODR o, Z_AttributeDetails **p, int opt) odr_implicit(o, z_CommonInfo, &(*p)->commonInfo, ODR_CONTEXT, 0, 1) && odr_implicit(o, z_DatabaseName, &(*p)->databaseName, ODR_CONTEXT, 1, 0) && odr_implicit_settag(o, ODR_CONTEXT, 2) && - (odr_sequence_of(o, z_AttributeSetDetails, &(*p)->attributesBySet, + (odr_sequence_of(o, (Odr_fun)z_AttributeSetDetails, &(*p)->attributesBySet, &(*p)->num_attributesBySet) && odr_ok(o)) && odr_implicit(o, z_AttributeCombinations, &(*p)->attributeCombinations, ODR_CONTEXT, 3, 1) && odr_sequence_end(o); @@ -945,7 +948,7 @@ int z_AttributeSetDetails(ODR o, Z_AttributeSetDetails **p, int opt) odr_implicit(o, odr_oid, &(*p)->attributeSet, ODR_CONTEXT, 0, 0) && odr_implicit_settag(o, ODR_CONTEXT, 1) && - odr_sequence_of(o, z_AttributeTypeDetails, &(*p)->attributesByType, + odr_sequence_of(o, (Odr_fun)z_AttributeTypeDetails, &(*p)->attributesByType, &(*p)->num_attributesByType) && odr_sequence_end(o); } @@ -958,7 +961,7 @@ int z_AttributeTypeDetails(ODR o, Z_AttributeTypeDetails **p, int opt) odr_implicit(o, odr_integer, &(*p)->attributeType, ODR_CONTEXT, 0, 0) && odr_implicit(o, z_OmittedAttributeInterpretation, &(*p)->optionalType, ODR_CONTEXT, 1, 1) && odr_implicit_settag(o, ODR_CONTEXT, 2) && - (odr_sequence_of(o, z_AttributeValue, &(*p)->attributeValues, + (odr_sequence_of(o, (Odr_fun)z_AttributeValue, &(*p)->attributeValues, &(*p)->num_attributeValues) || odr_ok(o)) && odr_sequence_end(o); } @@ -996,7 +999,7 @@ int z_TermListDetails(ODR o, Z_TermListDetails **p, int opt) odr_implicit(o, z_EScanInfo, &(*p)->scanInfo, ODR_CONTEXT, 4, 1) && odr_implicit(o, odr_integer, &(*p)->estNumberTerms, ODR_CONTEXT, 5, 1) && odr_implicit_settag(o, ODR_CONTEXT, 6) && - (odr_sequence_of(o, z_Term, &(*p)->sampleTerms, + (odr_sequence_of(o, (Odr_fun)z_Term, &(*p)->sampleTerms, &(*p)->num_sampleTerms) || odr_ok(o)) && odr_sequence_end(o); } @@ -1013,7 +1016,7 @@ int z_ElementSetDetails(ODR o, Z_ElementSetDetails **p, int opt) odr_implicit(o, odr_oid, &(*p)->schema, ODR_CONTEXT, 4, 0) && odr_implicit(o, z_HumanString, &(*p)->description, ODR_CONTEXT, 5, 1) && odr_implicit_settag(o, ODR_CONTEXT, 6) && - (odr_sequence_of(o, z_PerElementDetails, &(*p)->detailsPerElement, &(*p)->num_detailsPerElement) || odr_ok(o)) && + (odr_sequence_of(o, (Odr_fun)z_PerElementDetails, &(*p)->detailsPerElement, &(*p)->num_detailsPerElement) || odr_ok(o)) && odr_sequence_end(o); } @@ -1028,7 +1031,7 @@ int z_RetrievalRecordDetails(ODR o, Z_RetrievalRecordDetails **p, int opt) odr_implicit(o, odr_oid, &(*p)->recordSyntax, ODR_CONTEXT, 3, 0) && odr_implicit(o, z_HumanString, &(*p)->description, ODR_CONTEXT, 4, 1) && odr_implicit_settag(o, ODR_CONTEXT, 5) && - (odr_sequence_of(o, z_PerElementDetails, &(*p)->detailsPerElement, + (odr_sequence_of(o, (Odr_fun)z_PerElementDetails, &(*p)->detailsPerElement, &(*p)->num_detailsPerElement) || odr_ok(o)) && odr_sequence_end(o); } @@ -1041,7 +1044,7 @@ int z_PerElementDetails(ODR o, Z_PerElementDetails **p, int opt) odr_implicit(o, z_InternationalString, &(*p)->name, ODR_CONTEXT, 0, 1) && odr_implicit(o, z_RecordTag, &(*p)->recordTag, ODR_CONTEXT, 1, 1) && odr_implicit_settag(o, ODR_CONTEXT, 2) && - (odr_sequence_of(o, z_Path, &(*p)->schemaTags, &(*p)->num_schemaTags) || + (odr_sequence_of(o, (Odr_fun)z_Path, &(*p)->schemaTags, &(*p)->num_schemaTags) || odr_ok(o)) && odr_implicit(o, odr_integer, &(*p)->maxSize, ODR_CONTEXT, 3, 1) && odr_implicit(o, odr_integer, &(*p)->minSize, ODR_CONTEXT, 4, 1) && @@ -1085,7 +1088,7 @@ int z_SortDetails(ODR o, Z_SortDetails **p, int opt) odr_implicit(o, z_DatabaseName, &(*p)->databaseName, ODR_CONTEXT, 1, 0) && odr_implicit_settag(o, ODR_CONTEXT, 2) && - (odr_sequence_of(o, z_SortKeyDetails, &(*p)->sortKeys, + (odr_sequence_of(o, (Odr_fun)z_SortKeyDetails, &(*p)->sortKeys, &(*p)->num_sortKeys) || odr_ok(o)) && odr_sequence_end(o); } @@ -1095,11 +1098,11 @@ int z_SortKeyDetailsSortType(ODR o, Z_SortKeyDetailsSortType **p, int opt) static Odr_arm arm[] = { {ODR_IMPLICIT, ODR_CONTEXT, 0, Z_SortKeyDetailsSortType_character, - odr_null}, + (Odr_fun)odr_null}, {ODR_IMPLICIT, ODR_CONTEXT, 0, Z_SortKeyDetailsSortType_numeric, - odr_null}, + (Odr_fun)odr_null}, {ODR_IMPLICIT, ODR_CONTEXT, 0, Z_SortKeyDetailsSortType_structured, - z_HumanString}, + (Odr_fun)z_HumanString}, {-1, -1, -1, -1, 0} }; @@ -1118,7 +1121,7 @@ int z_SortKeyDetails(ODR o, Z_SortKeyDetails **p, int opt) return odr_implicit(o, z_HumanString, &(*p)->description, ODR_CONTEXT, 0, 1) && odr_implicit_settag(o, ODR_CONTEXT, 1) && - (odr_sequence_of(o, z_Specification, &(*p)->elementSpecifications, + (odr_sequence_of(o, (Odr_fun)z_Specification, &(*p)->elementSpecifications, &(*p)->num_elementSpecifications) || odr_ok(o)) && odr_implicit(o, z_AttributeCombinations, &(*p)->attributeSpecifications, ODR_CONTEXT, 2, 1) && @@ -1157,7 +1160,7 @@ int z_VariantSetInfo(ODR o, Z_VariantSetInfo **p, int opt) odr_implicit(o, z_InternationalString, &(*p)->name, ODR_CONTEXT, 2, 0) && odr_implicit_settag(o, ODR_CONTEXT, 3) && - (odr_sequence_of(o, z_VariantClass, &(*p)->variants, + (odr_sequence_of(o, (Odr_fun)z_VariantClass, &(*p)->variants, &(*p)->num_variants) || odr_ok(o)) && odr_sequence_end(o); } @@ -1172,7 +1175,7 @@ int z_VariantClass(ODR o, Z_VariantClass **p, int opt) odr_implicit(o, z_HumanString, &(*p)->description, ODR_CONTEXT, 1, 1) && odr_implicit(o, odr_integer, &(*p)->variantClass, ODR_CONTEXT, 2, 0) && odr_implicit_settag(o, ODR_CONTEXT, 3) && - odr_sequence_of(o, z_VariantType, &(*p)->variantTypes, + odr_sequence_of(o, (Odr_fun)z_VariantType, &(*p)->variantTypes, &(*p)->num_variantTypes) && odr_sequence_end(o); } @@ -1203,7 +1206,7 @@ int z_ValueSetEnumerated(ODR o, Z_ValueSetEnumerated **p, int opt) { if (!odr_initmember(o, p, sizeof(**p))) return opt && odr_ok(o); - if (odr_sequence_of(o, z_ValueDescription, &(*p)->enumerated, + if (odr_sequence_of(o, (Odr_fun)z_ValueDescription, &(*p)->enumerated, &(*p)->num_enumerated)) return 1; *p = 0; @@ -1214,9 +1217,9 @@ int z_ValueSet(ODR o, Z_ValueSet **p, int opt) { static Odr_arm arm[] = { - {ODR_IMPLICIT, ODR_CONTEXT, 0, Z_ValueSet_range, z_ValueRange}, + {ODR_IMPLICIT, ODR_CONTEXT, 0, Z_ValueSet_range, (Odr_fun)z_ValueRange}, {ODR_IMPLICIT, ODR_CONTEXT, 1, Z_ValueSet_enumerated, - z_ValueSetEnumerated}, + (Odr_fun)z_ValueSetEnumerated}, {-1, -1, -1, -1, 0} }; @@ -1242,12 +1245,12 @@ int z_ValueDescription(ODR o, Z_ValueDescription **p, int opt) { static Odr_arm arm[] = { - {ODR_NONE, -1, -1, Z_ValueDescription_integer, odr_integer}, - {ODR_NONE, -1, -1, Z_ValueDescription_string, z_InternationalString}, - {ODR_NONE, -1, -1, Z_ValueDescription_octets, odr_octetstring}, - {ODR_NONE, -1, -1, Z_ValueDescription_oid, odr_oid}, - {ODR_IMPLICIT, ODR_CONTEXT, 1, Z_ValueDescription_unit, z_Unit}, - {ODR_IMPLICIT, ODR_CONTEXT, 2, Z_ValueDescription_valueAndUnit, z_IntUnit}, + {ODR_NONE, -1, -1, Z_ValueDescription_integer, (Odr_fun)odr_integer}, + {ODR_NONE, -1, -1, Z_ValueDescription_string, (Odr_fun)z_InternationalString}, + {ODR_NONE, -1, -1, Z_ValueDescription_octets, (Odr_fun)odr_octetstring}, + {ODR_NONE, -1, -1, Z_ValueDescription_oid, (Odr_fun)odr_oid}, + {ODR_IMPLICIT, ODR_CONTEXT, 1, Z_ValueDescription_unit, (Odr_fun)z_Unit}, + {ODR_IMPLICIT, ODR_CONTEXT, 2, Z_ValueDescription_valueAndUnit, (Odr_fun)z_IntUnit}, {-1, -1, -1, -1, 0} }; @@ -1269,7 +1272,7 @@ int z_UnitInfo(ODR o, Z_UnitInfo **p, int opt) 1, 0) && odr_implicit(o, z_HumanString, &(*p)->description, ODR_CONTEXT, 2, 1) && odr_implicit_settag(o, ODR_CONTEXT, 3) && - (odr_sequence_of(o, z_UnitType, &(*p)->units, &(*p)->num_units) || + (odr_sequence_of(o, (Odr_fun)z_UnitType, &(*p)->units, &(*p)->num_units) || odr_ok(o)) && odr_sequence_end(o); } @@ -1285,7 +1288,7 @@ int z_UnitType(ODR o, Z_UnitType **p, int opt) odr_explicit(o, z_StringOrNumeric, &(*p)->unitType, ODR_CONTEXT, 2, 0) && odr_implicit_settag(o, ODR_CONTEXT, 3) && - odr_sequence_of(o, z_Units, &(*p)->units, &(*p)->num_units) && + odr_sequence_of(o, (Odr_fun)z_Units, &(*p)->units, &(*p)->num_units) && odr_sequence_end(o); } @@ -1307,7 +1310,7 @@ int z_CategoryList(ODR o, Z_CategoryList **p, int opt) return odr_implicit(o, z_CommonInfo, &(*p)->commonInfo, ODR_CONTEXT, 0, 1) && odr_implicit_settag(o, ODR_CONTEXT, 1) && - odr_sequence_of(o, z_CategoryInfo, &(*p)->categories, + odr_sequence_of(o, (Odr_fun)z_CategoryInfo, &(*p)->categories, &(*p)->num_categories) && odr_sequence_end(o); } @@ -1331,35 +1334,35 @@ int z_ExplainRecord(ODR o, Z_ExplainRecord **p, int opt) { static Odr_arm arm[] = { - {ODR_IMPLICIT, ODR_CONTEXT, 0, Z_Explain_targetInfo, z_TargetInfo}, - {ODR_IMPLICIT, ODR_CONTEXT, 1, Z_Explain_databaseInfo, z_DatabaseInfo}, - {ODR_IMPLICIT, ODR_CONTEXT, 2, Z_Explain_schemaInfo, z_SchemaInfo}, - {ODR_IMPLICIT, ODR_CONTEXT, 3, Z_Explain_tagSetInfo, z_TagSetInfo}, + {ODR_IMPLICIT, ODR_CONTEXT, 0, Z_Explain_targetInfo, (Odr_fun)z_TargetInfo}, + {ODR_IMPLICIT, ODR_CONTEXT, 1, Z_Explain_databaseInfo, (Odr_fun)z_DatabaseInfo}, + {ODR_IMPLICIT, ODR_CONTEXT, 2, Z_Explain_schemaInfo, (Odr_fun)z_SchemaInfo}, + {ODR_IMPLICIT, ODR_CONTEXT, 3, Z_Explain_tagSetInfo, (Odr_fun)z_TagSetInfo}, {ODR_IMPLICIT, ODR_CONTEXT, 4, Z_Explain_recordSyntaxInfo, - z_RecordSyntaxInfo}, + (Odr_fun)z_RecordSyntaxInfo}, {ODR_IMPLICIT, ODR_CONTEXT, 5, Z_Explain_attributeSetInfo, - z_AttributeSetInfo}, + (Odr_fun)z_AttributeSetInfo}, {ODR_IMPLICIT, ODR_CONTEXT, 6, Z_Explain_termListInfo, - z_TermListInfo}, + (Odr_fun)z_TermListInfo}, {ODR_IMPLICIT, ODR_CONTEXT, 7, Z_Explain_extendedServicesInfo, - z_ExtendedServicesInfo}, + (Odr_fun)z_ExtendedServicesInfo}, {ODR_IMPLICIT, ODR_CONTEXT, 8, Z_Explain_attributeDetails, - z_AttributeDetails}, + (Odr_fun)z_AttributeDetails}, {ODR_IMPLICIT, ODR_CONTEXT, 9, Z_Explain_termListDetails, - z_TermListDetails}, + (Odr_fun)z_TermListDetails}, {ODR_IMPLICIT, ODR_CONTEXT, 10, Z_Explain_elementSetDetails, - z_ElementSetDetails}, + (Odr_fun)z_ElementSetDetails}, {ODR_IMPLICIT, ODR_CONTEXT, 11, Z_Explain_retrievalRecordDetails, - z_RetrievalRecordDetails}, + (Odr_fun)z_RetrievalRecordDetails}, {ODR_IMPLICIT, ODR_CONTEXT, 12, Z_Explain_sortDetails, - z_SortDetails}, + (Odr_fun)z_SortDetails}, {ODR_IMPLICIT, ODR_CONTEXT, 13, Z_Explain_processing, - z_ProcessingInformation}, + (Odr_fun)z_ProcessingInformation}, {ODR_IMPLICIT, ODR_CONTEXT, 14, Z_Explain_variants, - z_VariantSetInfo}, - {ODR_IMPLICIT, ODR_CONTEXT, 15, Z_Explain_units, z_UnitInfo}, + (Odr_fun)z_VariantSetInfo}, + {ODR_IMPLICIT, ODR_CONTEXT, 15, Z_Explain_units, (Odr_fun)z_UnitInfo}, {ODR_IMPLICIT, ODR_CONTEXT, 100, Z_Explain_categoryList, - z_CategoryList}, + (Odr_fun)z_CategoryList}, {-1, -1, -1, -1, 0} }; diff --git a/asn/prt-ext.c b/asn/prt-ext.c index 4fb0bab..4063231 100644 --- a/asn/prt-ext.c +++ b/asn/prt-ext.c @@ -4,7 +4,10 @@ * Sebastian Hammer, Adam Dickmeiss * * $Log: prt-ext.c,v $ - * Revision 1.15 1998-02-10 15:31:46 adam + * Revision 1.16 1998-02-11 11:53:32 adam + * Changed code so that it compiles as C++. + * + * Revision 1.15 1998/02/10 15:31:46 adam * Implemented date and time structure. Changed the Update Extended * Service. * @@ -62,21 +65,21 @@ */ static Z_ext_typeent type_table[] = { - {VAL_SUTRS, Z_External_sutrs, z_SUTRS}, - {VAL_EXPLAIN, Z_External_explainRecord, z_ExplainRecord}, - {VAL_RESOURCE1, Z_External_resourceReport1, z_ResourceReport1}, - {VAL_RESOURCE2, Z_External_resourceReport2, z_ResourceReport2}, - {VAL_PROMPT1, Z_External_promptObject1, z_PromptObject1 }, - {VAL_GRS1, Z_External_grs1, z_GenericRecord}, - {VAL_EXTENDED, Z_External_extendedService, z_TaskPackage}, - {VAL_ITEMORDER, Z_External_itemOrder, z_ItemOrder}, - {VAL_DIAG1, Z_External_diag1, z_DiagnosticFormat}, - {VAL_ESPEC1, Z_External_espec1, z_Espec1}, - {VAL_SUMMARY, Z_External_summary, z_BriefBib}, - {VAL_OPAC, Z_External_OPAC, z_OPACRecord}, - {VAL_SEARCHRES1, Z_External_searchResult1, z_SearchInfoReport}, - {VAL_DBUPDATE, Z_External_update, z_IUUpdate}, - {VAL_DATETIME, Z_External_dateTime, z_DateTime}, + {VAL_SUTRS, Z_External_sutrs, (Odr_fun) z_SUTRS}, + {VAL_EXPLAIN, Z_External_explainRecord, (Odr_fun)z_ExplainRecord}, + {VAL_RESOURCE1, Z_External_resourceReport1, (Odr_fun)z_ResourceReport1}, + {VAL_RESOURCE2, Z_External_resourceReport2, (Odr_fun)z_ResourceReport2}, + {VAL_PROMPT1, Z_External_promptObject1, (Odr_fun)z_PromptObject1 }, + {VAL_GRS1, Z_External_grs1, (Odr_fun)z_GenericRecord}, + {VAL_EXTENDED, Z_External_extendedService, (Odr_fun)z_TaskPackage}, + {VAL_ITEMORDER, Z_External_itemOrder, (Odr_fun)z_ItemOrder}, + {VAL_DIAG1, Z_External_diag1, (Odr_fun)z_DiagnosticFormat}, + {VAL_ESPEC1, Z_External_espec1, (Odr_fun)z_Espec1}, + {VAL_SUMMARY, Z_External_summary, (Odr_fun)z_BriefBib}, + {VAL_OPAC, Z_External_OPAC, (Odr_fun)z_OPACRecord}, + {VAL_SEARCHRES1, Z_External_searchResult1, (Odr_fun)z_SearchInfoReport}, + {VAL_DBUPDATE, Z_External_update, (Odr_fun)z_IUUpdate}, + {VAL_DATETIME, Z_External_dateTime, (Odr_fun)z_DateTime}, {VAL_NONE, 0, 0} }; @@ -97,31 +100,31 @@ int z_External(ODR o, Z_External **p, int opt) static Odr_arm arm[] = { - {ODR_EXPLICIT, ODR_CONTEXT, 0, Z_External_single, odr_any}, - {ODR_IMPLICIT, ODR_CONTEXT, 1, Z_External_octet, odr_octetstring}, - {ODR_IMPLICIT, ODR_CONTEXT, 2, Z_External_arbitrary, odr_bitstring}, + {ODR_EXPLICIT, ODR_CONTEXT, 0, Z_External_single, (Odr_fun)odr_any}, + {ODR_IMPLICIT, ODR_CONTEXT, 1, Z_External_octet, (Odr_fun)odr_octetstring}, + {ODR_IMPLICIT, ODR_CONTEXT, 2, Z_External_arbitrary, (Odr_fun)odr_bitstring}, - {ODR_EXPLICIT, ODR_CONTEXT, 0, Z_External_sutrs, z_SUTRS}, + {ODR_EXPLICIT, ODR_CONTEXT, 0, Z_External_sutrs, (Odr_fun)z_SUTRS}, {ODR_EXPLICIT, ODR_CONTEXT, 0, Z_External_explainRecord, - z_ExplainRecord}, + (Odr_fun)z_ExplainRecord}, {ODR_EXPLICIT, ODR_CONTEXT, 0, Z_External_resourceReport1, - z_ResourceReport1}, + (Odr_fun)z_ResourceReport1}, {ODR_EXPLICIT, ODR_CONTEXT, 0, Z_External_resourceReport2, - z_ResourceReport2}, + (Odr_fun)z_ResourceReport2}, {ODR_EXPLICIT, ODR_CONTEXT, 0, Z_External_promptObject1, - z_PromptObject1}, - {ODR_EXPLICIT, ODR_CONTEXT, 0, Z_External_grs1, z_GenericRecord}, + (Odr_fun)z_PromptObject1}, + {ODR_EXPLICIT, ODR_CONTEXT, 0, Z_External_grs1, (Odr_fun)z_GenericRecord}, {ODR_EXPLICIT, ODR_CONTEXT, 0, Z_External_extendedService, - z_TaskPackage}, - {ODR_EXPLICIT, ODR_CONTEXT, 0, Z_External_itemOrder, z_ItemOrder}, - {ODR_EXPLICIT, ODR_CONTEXT, 0, Z_External_diag1, z_DiagnosticFormat}, - {ODR_EXPLICIT, ODR_CONTEXT, 0, Z_External_espec1, z_Espec1}, - {ODR_EXPLICIT, ODR_CONTEXT, 0, Z_External_summary, z_BriefBib}, - {ODR_EXPLICIT, ODR_CONTEXT, 0, Z_External_OPAC, z_OPACRecord}, + (Odr_fun)z_TaskPackage}, + {ODR_EXPLICIT, ODR_CONTEXT, 0, Z_External_itemOrder, (Odr_fun)z_ItemOrder}, + {ODR_EXPLICIT, ODR_CONTEXT, 0, Z_External_diag1, (Odr_fun)z_DiagnosticFormat}, + {ODR_EXPLICIT, ODR_CONTEXT, 0, Z_External_espec1, (Odr_fun)z_Espec1}, + {ODR_EXPLICIT, ODR_CONTEXT, 0, Z_External_summary, (Odr_fun)z_BriefBib}, + {ODR_EXPLICIT, ODR_CONTEXT, 0, Z_External_OPAC, (Odr_fun)z_OPACRecord}, {ODR_EXPLICIT, ODR_CONTEXT, 0, Z_External_searchResult1, - z_SearchInfoReport}, - {ODR_EXPLICIT, ODR_CONTEXT, 0, Z_External_update, z_IUUpdate}, - {ODR_EXPLICIT, ODR_CONTEXT, 0, Z_External_dateTime, z_DateTime}, + (Odr_fun)z_SearchInfoReport}, + {ODR_EXPLICIT, ODR_CONTEXT, 0, Z_External_update, (Odr_fun)z_IUUpdate}, + {ODR_EXPLICIT, ODR_CONTEXT, 0, Z_External_dateTime, (Odr_fun)z_DateTime}, {-1, -1, -1, -1, 0} }; diff --git a/asn/prt-grs.c b/asn/prt-grs.c index 08c5ca6..cb3d989 100644 --- a/asn/prt-grs.c +++ b/asn/prt-grs.c @@ -4,7 +4,10 @@ * Sebastian Hammer, Adam Dickmeiss * * $Log: prt-grs.c,v $ - * Revision 1.6 1997-05-14 06:53:23 adam + * Revision 1.7 1998-02-11 11:53:32 adam + * Changed code so that it compiles as C++. + * + * Revision 1.6 1997/05/14 06:53:23 adam * C++ support. * * Revision 1.5 1995/10/18 16:12:20 quinn @@ -41,10 +44,10 @@ int z_Variant(ODR o, Z_Variant **p, int opt); int z_GenericRecord(ODR o, Z_GenericRecord **p, int opt) { if (o->direction == ODR_DECODE) - *p = odr_malloc(o, sizeof(**p)); + *p = (Z_GenericRecord *)odr_malloc(o, sizeof(**p)); else if (!*p) return opt; - if (odr_sequence_of(o, z_TaggedElement, &(*p)->elements, &(*p)->num_elements)) + if (odr_sequence_of(o, (Odr_fun)z_TaggedElement, &(*p)->elements, &(*p)->num_elements)) return 1; *p = 0; return opt && odr_ok(o); @@ -68,26 +71,26 @@ int z_ElementData(ODR o, Z_ElementData **p, int opt) { static Odr_arm arm[] = { - {ODR_NONE, -1, -1, Z_ElementData_octets, odr_octetstring}, - {ODR_NONE, -1, -1, Z_ElementData_numeric, odr_integer}, - {ODR_NONE, -1, -1, Z_ElementData_date, odr_generalizedtime}, - {ODR_NONE, -1, -1, Z_ElementData_ext, z_External}, - {ODR_NONE, -1, -1, Z_ElementData_string, z_InternationalString}, + {ODR_NONE, -1, -1, Z_ElementData_octets, (Odr_fun)odr_octetstring}, + {ODR_NONE, -1, -1, Z_ElementData_numeric, (Odr_fun)odr_integer}, + {ODR_NONE, -1, -1, Z_ElementData_date, (Odr_fun)odr_generalizedtime}, + {ODR_NONE, -1, -1, Z_ElementData_ext, (Odr_fun)z_External}, + {ODR_NONE, -1, -1, Z_ElementData_string, (Odr_fun)z_InternationalString}, /* The entry below provides some backwards compatibility */ - {ODR_NONE, -1, -1, Z_ElementData_string, odr_visiblestring}, - {ODR_NONE, -1, -1, Z_ElementData_trueOrFalse, odr_bool}, - {ODR_NONE, -1, -1, Z_ElementData_oid, odr_oid}, - {ODR_IMPLICIT, ODR_CONTEXT, 1, Z_ElementData_intUnit, z_IntUnit}, - {ODR_IMPLICIT, ODR_CONTEXT, 2, Z_ElementData_elementNotThere, odr_null}, - {ODR_IMPLICIT, ODR_CONTEXT, 3, Z_ElementData_elementEmpty, odr_null}, - {ODR_IMPLICIT, ODR_CONTEXT, 4, Z_ElementData_noDataRequested, odr_null}, - {ODR_IMPLICIT, ODR_CONTEXT, 5, Z_ElementData_diagnostic, z_External}, - {ODR_EXPLICIT, ODR_CONTEXT, 6, Z_ElementData_subtree, z_GenericRecord}, + {ODR_NONE, -1, -1, Z_ElementData_string, (Odr_fun)odr_visiblestring}, + {ODR_NONE, -1, -1, Z_ElementData_trueOrFalse, (Odr_fun)odr_bool}, + {ODR_NONE, -1, -1, Z_ElementData_oid, (Odr_fun)odr_oid}, + {ODR_IMPLICIT, ODR_CONTEXT, 1, Z_ElementData_intUnit, (Odr_fun)z_IntUnit}, + {ODR_IMPLICIT, ODR_CONTEXT, 2, Z_ElementData_elementNotThere, (Odr_fun)odr_null}, + {ODR_IMPLICIT, ODR_CONTEXT, 3, Z_ElementData_elementEmpty, (Odr_fun)odr_null}, + {ODR_IMPLICIT, ODR_CONTEXT, 4, Z_ElementData_noDataRequested, (Odr_fun)odr_null}, + {ODR_IMPLICIT, ODR_CONTEXT, 5, Z_ElementData_diagnostic, (Odr_fun)z_External}, + {ODR_EXPLICIT, ODR_CONTEXT, 6, Z_ElementData_subtree, (Odr_fun)z_GenericRecord}, {-1, -1, -1, -1, 0} }; if (o->direction == ODR_DECODE) - *p = odr_malloc(o, sizeof(**p)); + *p = (Z_ElementData *)odr_malloc(o, sizeof(**p)); else if (!*p) return opt; if (odr_choice(o, arm, &(*p)->u, &(*p)->which)) @@ -104,12 +107,12 @@ int z_ElementMetaData(ODR o, Z_ElementMetaData **p, int opt) odr_implicit(o, z_Order, &(*p)->seriesOrder, ODR_CONTEXT, 1, 1) && odr_implicit(o, z_Usage, &(*p)->usageRight, ODR_CONTEXT, 2, 1) && odr_implicit_settag(o, ODR_CONTEXT, 3) && - (odr_sequence_of(o, z_HitVector, &(*p)->hits, &(*p)->num_hits) || + (odr_sequence_of(o, (Odr_fun)z_HitVector, &(*p)->hits, &(*p)->num_hits) || odr_ok(o)) && odr_implicit(o, z_InternationalString, &(*p)->displayName, ODR_CONTEXT, 4, 1) && odr_implicit_settag(o, ODR_CONTEXT, 5) && - (odr_sequence_of(o, z_Variant, &(*p)->supportedVariants, + (odr_sequence_of(o, (Odr_fun)z_Variant, &(*p)->supportedVariants, &(*p)->num_supportedVariants) || odr_ok(o)) && odr_implicit(o, z_InternationalString, &(*p)->message, ODR_CONTEXT, 6, 1) && @@ -135,10 +138,10 @@ int z_TagUnit(ODR o, Z_TagUnit **p, int opt) int z_TagPath(ODR o, Z_TagPath **p, int opt) { if (o->direction == ODR_DECODE) - *p = odr_malloc(o, sizeof(**p)); + *p = (Z_TagPath *)odr_malloc(o, sizeof(**p)); else if (!*p) return opt; - if (odr_sequence_of(o, z_TagUnit, &(*p)->tags, &(*p)->num_tags)) + if (odr_sequence_of(o, (Odr_fun)z_TagUnit, &(*p)->tags, &(*p)->num_tags)) return 1; *p = 0; return opt && odr_ok(o); @@ -183,16 +186,16 @@ int z_Triple(ODR o, Z_Triple **p, int opt) { static Odr_arm arm[] = { - {ODR_NONE, -1, -1, Z_Triple_integer, odr_integer}, - {ODR_NONE, -1, -1, Z_Triple_internationalString, z_InternationalString}, + {ODR_NONE, -1, -1, Z_Triple_integer, (Odr_fun)odr_integer}, + {ODR_NONE, -1, -1, Z_Triple_internationalString, (Odr_fun)z_InternationalString}, /* The entry below provides some backwards compatibility */ - {ODR_NONE, -1, -1, Z_Triple_internationalString, odr_visiblestring}, - {ODR_NONE, -1, -1, Z_Triple_octetString, odr_octetstring}, - {ODR_NONE, -1, -1, Z_Triple_oid, odr_oid}, - {ODR_NONE, -1, -1, Z_Triple_boolean, odr_bool}, - {ODR_NONE, -1, -1, Z_Triple_null, odr_null}, - {ODR_IMPLICIT, ODR_CONTEXT, 1, Z_Triple_unit, z_Unit}, - {ODR_IMPLICIT, ODR_CONTEXT, 2, Z_Triple_valueAndUnit, z_IntUnit}, + {ODR_NONE, -1, -1, Z_Triple_internationalString, (Odr_fun)odr_visiblestring}, + {ODR_NONE, -1, -1, Z_Triple_octetString, (Odr_fun)odr_octetstring}, + {ODR_NONE, -1, -1, Z_Triple_oid, (Odr_fun)odr_oid}, + {ODR_NONE, -1, -1, Z_Triple_boolean, (Odr_fun)odr_bool}, + {ODR_NONE, -1, -1, Z_Triple_null, (Odr_fun)odr_null}, + {ODR_IMPLICIT, ODR_CONTEXT, 1, Z_Triple_unit, (Odr_fun)z_Unit}, + {ODR_IMPLICIT, ODR_CONTEXT, 2, Z_Triple_valueAndUnit, (Odr_fun)z_IntUnit}, {-1, -1, -1, -1, 0} }; @@ -216,6 +219,6 @@ int z_Variant(ODR o, Z_Variant **p, int opt) odr_implicit(o, odr_oid, &(*p)->globalVariantSetId, ODR_CONTEXT, 1, 1) && odr_implicit_settag(o, ODR_CONTEXT, 2) && - odr_sequence_of(o, z_Triple, &(*p)->triples, &(*p)->num_triples) && + odr_sequence_of(o, (Odr_fun)z_Triple, &(*p)->triples, &(*p)->num_triples) && odr_sequence_end(o); } diff --git a/asn/prt-rsc.c b/asn/prt-rsc.c index a7466f8..f7fe7b6 100644 --- a/asn/prt-rsc.c +++ b/asn/prt-rsc.c @@ -4,7 +4,10 @@ * Sebastian Hammer, Adam Dickmeiss * * $Log: prt-rsc.c,v $ - * Revision 1.5 1995-09-29 17:11:55 quinn + * Revision 1.6 1998-02-11 11:53:32 adam + * Changed code so that it compiles as C++. + * + * Revision 1.5 1995/09/29 17:11:55 quinn * Smallish * * Revision 1.4 1995/09/27 15:02:43 quinn @@ -43,7 +46,7 @@ int z_ResourceReport1(ODR o, Z_ResourceReport1 **p, int opt) return opt && odr_ok(o); return odr_implicit_settag(o, ODR_CONTEXT, 1) && - odr_sequence_of(o, z_Estimate1, &(*p)->estimates, + odr_sequence_of(o, (Odr_fun)z_Estimate1, &(*p)->estimates, &(*p)->num_estimates) && odr_implicit(o, odr_visiblestring, &(*p)->message, ODR_CONTEXT, 2, 0) && odr_sequence_end(o); @@ -70,7 +73,7 @@ if (!odr_sequence_begin(o, p, sizeof(**p))) return opt && odr_ok(o); return odr_implicit_settag(o, ODR_CONTEXT, 1) && - (odr_sequence_of(o, z_Estimate2, &(*p)->estimates, + (odr_sequence_of(o, (Odr_fun)z_Estimate2, &(*p)->estimates, &(*p)->num_estimates) || odr_ok(o)) && odr_implicit(o, odr_visiblestring, &(*p)->message, ODR_CONTEXT, 2, 1) && odr_sequence_end(o); diff --git a/asn/zget.c b/asn/zget.c index c48f9e5..e59bea1 100644 --- a/asn/zget.c +++ b/asn/zget.c @@ -4,7 +4,10 @@ * Sebastian Hammer, Adam Dickmeiss * * $Log: zget.c,v $ - * Revision 1.13 1998-01-29 13:13:39 adam + * Revision 1.14 1998-02-11 11:53:32 adam + * Changed code so that it compiles as C++. + * + * Revision 1.13 1998/01/29 13:13:39 adam * Function zget_presentRequest fills resultSetId with "default" instead * of "Default". * @@ -52,16 +55,16 @@ Z_InitRequest *zget_InitRequest(ODR o) { - Z_InitRequest *r = odr_malloc(o, sizeof(*r)); + Z_InitRequest *r = (Z_InitRequest *)odr_malloc(o, sizeof(*r)); r->referenceId = 0; - r->options = odr_malloc(o, sizeof(*r->options)); + r->options = (Odr_bitmask *)odr_malloc(o, sizeof(*r->options)); ODR_MASK_ZERO(r->options); - r->protocolVersion = odr_malloc(o, sizeof(*r->protocolVersion)); + r->protocolVersion = (Odr_bitmask *)odr_malloc(o, sizeof(*r->protocolVersion)); ODR_MASK_ZERO(r->protocolVersion); - r->preferredMessageSize = odr_malloc(o, sizeof(int)); + r->preferredMessageSize = (int *)odr_malloc(o, sizeof(int)); *r->preferredMessageSize = 30*1024; - r->maximumRecordSize = odr_malloc(o, sizeof(int)); + r->maximumRecordSize = (int *)odr_malloc(o, sizeof(int)); *r->maximumRecordSize = 30*1024; r->idAuthentication = 0; r->implementationId = "YAZ (id=81)"; @@ -76,18 +79,18 @@ Z_InitRequest *zget_InitRequest(ODR o) Z_InitResponse *zget_InitResponse(ODR o) { - Z_InitResponse *r = odr_malloc(o, sizeof(*r)); + Z_InitResponse *r = (Z_InitResponse *)odr_malloc(o, sizeof(*r)); r->referenceId = 0; - r->options = odr_malloc(o, sizeof(*r->options)); + r->options = (Odr_bitmask *)odr_malloc(o, sizeof(*r->options)); ODR_MASK_ZERO(r->options); - r->protocolVersion = odr_malloc(o, sizeof(*r->protocolVersion)); + r->protocolVersion = (Odr_bitmask *)odr_malloc(o, sizeof(*r->protocolVersion)); ODR_MASK_ZERO(r->protocolVersion); - r->preferredMessageSize = odr_malloc(o, sizeof(int)); + r->preferredMessageSize = (int *)odr_malloc(o, sizeof(int)); *r->preferredMessageSize = 30*1024; - r->maximumRecordSize = odr_malloc(o, sizeof(int)); + r->maximumRecordSize = (int *)odr_malloc(o, sizeof(int)); *r->maximumRecordSize = 30*1024; - r->result = odr_malloc(o, sizeof(bool_t)); + r->result = (int *)odr_malloc(o, sizeof(bool_t)); *r->result = 1; r->implementationId = "YAZ (id=81)"; r->implementationName = "Index Data/YAZ"; @@ -101,16 +104,16 @@ Z_InitResponse *zget_InitResponse(ODR o) Z_SearchRequest *zget_SearchRequest(ODR o) { - Z_SearchRequest *r = odr_malloc(o, sizeof(*r)); + Z_SearchRequest *r = (Z_SearchRequest *)odr_malloc(o, sizeof(*r)); r->referenceId = 0; - r->smallSetUpperBound = odr_malloc(o, sizeof(int)); + r->smallSetUpperBound = (int *)odr_malloc(o, sizeof(int)); *r->smallSetUpperBound = 0; - r->largeSetLowerBound = odr_malloc(o, sizeof(int)); + r->largeSetLowerBound = (int *)odr_malloc(o, sizeof(int)); *r->largeSetLowerBound = 1; - r->mediumSetPresentNumber = odr_malloc(o, sizeof(int)); + r->mediumSetPresentNumber = (int *)odr_malloc(o, sizeof(int)); *r->mediumSetPresentNumber = 0; - r->replaceIndicator = odr_malloc(o, sizeof(bool_t)); + r->replaceIndicator = (int *)odr_malloc(o, sizeof(bool_t)); *r->replaceIndicator = 1; r->resultSetName = "default"; r->num_databaseNames = 0; @@ -128,16 +131,16 @@ Z_SearchRequest *zget_SearchRequest(ODR o) Z_SearchResponse *zget_SearchResponse(ODR o) { - Z_SearchResponse *r = odr_malloc(o, sizeof(*r)); + Z_SearchResponse *r = (Z_SearchResponse *)odr_malloc(o, sizeof(*r)); r->referenceId = 0; - r->resultCount = odr_malloc(o, sizeof(int)); + r->resultCount = (int *)odr_malloc(o, sizeof(int)); *r->resultCount = 0; - r->numberOfRecordsReturned = odr_malloc(o, sizeof(int)); + r->numberOfRecordsReturned = (int *)odr_malloc(o, sizeof(int)); *r->numberOfRecordsReturned = 0; - r->nextResultSetPosition = odr_malloc(o, sizeof(int)); + r->nextResultSetPosition = (int *)odr_malloc(o, sizeof(int)); *r->nextResultSetPosition = 0; - r->searchStatus = odr_malloc(o, sizeof(bool_t)); + r->searchStatus = (int *)odr_malloc(o, sizeof(bool_t)); *r->searchStatus = 1; r->resultSetStatus = 0; r->presentStatus = 0; @@ -151,13 +154,13 @@ Z_SearchResponse *zget_SearchResponse(ODR o) Z_PresentRequest *zget_PresentRequest(ODR o) { - Z_PresentRequest *r = odr_malloc(o, sizeof(*r)); + Z_PresentRequest *r = (Z_PresentRequest *)odr_malloc(o, sizeof(*r)); r->referenceId = 0; r->resultSetId = "default"; - r->resultSetStartPoint = odr_malloc(o, sizeof(int)); + r->resultSetStartPoint = (int *)odr_malloc(o, sizeof(int)); *r->resultSetStartPoint = 1; - r->numberOfRecordsRequested = odr_malloc(o, sizeof(int)); + r->numberOfRecordsRequested = (int *)odr_malloc(o, sizeof(int)); *r->numberOfRecordsRequested = 10; #ifdef Z_95 r->num_ranges = 0; @@ -178,14 +181,14 @@ Z_PresentRequest *zget_PresentRequest(ODR o) Z_PresentResponse *zget_PresentResponse(ODR o) { - Z_PresentResponse *r = odr_malloc(o, sizeof(*r)); + Z_PresentResponse *r = (Z_PresentResponse *)odr_malloc(o, sizeof(*r)); r->referenceId = 0; - r->numberOfRecordsReturned = odr_malloc(o, sizeof(int)); + r->numberOfRecordsReturned = (int *)odr_malloc(o, sizeof(int)); *r->numberOfRecordsReturned = 0; - r->nextResultSetPosition = odr_malloc(o, sizeof(int)); + r->nextResultSetPosition = (int *)odr_malloc(o, sizeof(int)); *r->nextResultSetPosition = 0; - r->presentStatus = odr_malloc(o, sizeof(int)); + r->presentStatus = (int *)odr_malloc(o, sizeof(int)); *r->presentStatus = Z_PRES_SUCCESS; r->records = 0; #ifdef Z_95 @@ -196,10 +199,10 @@ Z_PresentResponse *zget_PresentResponse(ODR o) Z_DeleteResultSetRequest *zget_DeleteResultSetRequest(ODR o) { - Z_DeleteResultSetRequest *r = odr_malloc(o, sizeof(*r)); + Z_DeleteResultSetRequest *r = (Z_DeleteResultSetRequest *)odr_malloc(o, sizeof(*r)); r->referenceId = 0; - r->deleteFunction = odr_malloc(o, sizeof(int)); + r->deleteFunction = (int *)odr_malloc(o, sizeof(int)); *r->deleteFunction = Z_DeleteRequest_list; r->num_ids = 0; r->resultSetList = 0; @@ -211,10 +214,10 @@ Z_DeleteResultSetRequest *zget_DeleteResultSetRequest(ODR o) Z_DeleteResultSetResponse *zget_DeleteResultSetResponse(ODR o) { - Z_DeleteResultSetResponse *r = odr_malloc(o, sizeof(*r)); + Z_DeleteResultSetResponse *r = (Z_DeleteResultSetResponse *)odr_malloc(o, sizeof(*r)); r->referenceId = 0; - r->deleteOperationStatus = odr_malloc(o, sizeof(int)); + r->deleteOperationStatus = (int *)odr_malloc(o, sizeof(int)); *r->deleteOperationStatus = Z_DeleteStatus_success; r->num_statuses = 0; r->deleteListStatuses = 0; @@ -230,7 +233,7 @@ Z_DeleteResultSetResponse *zget_DeleteResultSetResponse(ODR o) Z_ScanRequest *zget_ScanRequest(ODR o) { - Z_ScanRequest *r = odr_malloc(o, sizeof(*r)); + Z_ScanRequest *r = (Z_ScanRequest *)odr_malloc(o, sizeof(*r)); r->referenceId = 0; r->num_databaseNames = 0; @@ -238,7 +241,7 @@ Z_ScanRequest *zget_ScanRequest(ODR o) r->attributeSet = 0; r->termListAndStartPoint = 0; r->stepSize = 0; - r->numberOfTermsRequested = odr_malloc(o, sizeof(int)); + r->numberOfTermsRequested = (int *)odr_malloc(o, sizeof(int)); *r->numberOfTermsRequested = 20; r->preferredPositionInResponse = 0; #ifdef Z_95 @@ -249,13 +252,13 @@ Z_ScanRequest *zget_ScanRequest(ODR o) Z_ScanResponse *zget_ScanResponse(ODR o) { - Z_ScanResponse *r = odr_malloc(o, sizeof(*r)); + Z_ScanResponse *r = (Z_ScanResponse *)odr_malloc(o, sizeof(*r)); r->referenceId = 0; r->stepSize = 0; - r->scanStatus = odr_malloc(o, sizeof(int)); + r->scanStatus = (int *)odr_malloc(o, sizeof(int)); *r->scanStatus = Z_Scan_success; - r->numberOfEntriesReturned = odr_malloc(o, sizeof(int)); + r->numberOfEntriesReturned = (int *)odr_malloc(o, sizeof(int)); *r->numberOfEntriesReturned = 0; r->positionOfTerm =0; r->entries = 0; @@ -268,10 +271,10 @@ Z_ScanResponse *zget_ScanResponse(ODR o) Z_TriggerResourceControlRequest *zget_TriggerResourceControlRequest(ODR o) { - Z_TriggerResourceControlRequest *r = odr_malloc(o, sizeof(*r)); + Z_TriggerResourceControlRequest *r = (Z_TriggerResourceControlRequest *)odr_malloc(o, sizeof(*r)); r->referenceId = 0; - r->requestedAction = odr_malloc(o, sizeof(int)); + r->requestedAction = (int *)odr_malloc(o, sizeof(int)); *r->requestedAction = Z_TriggerResourceCtrl_resourceReport; r->prefResourceReportFormat = 0; r->resultSetWanted = 0; @@ -283,13 +286,13 @@ Z_TriggerResourceControlRequest *zget_TriggerResourceControlRequest(ODR o) Z_ResourceControlRequest *zget_ResourceControlRequest(ODR o) { - Z_ResourceControlRequest *r = odr_malloc(o, sizeof(*r)); + Z_ResourceControlRequest *r = (Z_ResourceControlRequest *)odr_malloc(o, sizeof(*r)); r->referenceId = 0; r->suspendedFlag = 0; r->resourceReport = 0; r->partialResultsAvailable = 0; - r->responseRequired = odr_malloc(o, sizeof(bool_t)); + r->responseRequired = (int *)odr_malloc(o, sizeof(bool_t)); *r->responseRequired = 0; r->triggeredRequestFlag = 0; #ifdef Z_95 @@ -300,10 +303,10 @@ Z_ResourceControlRequest *zget_ResourceControlRequest(ODR o) Z_ResourceControlResponse *zget_ResourceControlResponse(ODR o) { - Z_ResourceControlResponse *r = odr_malloc(o, sizeof(*r)); + Z_ResourceControlResponse *r = (Z_ResourceControlResponse *)odr_malloc(o, sizeof(*r)); r->referenceId = 0; - r->continueFlag = odr_malloc(o, sizeof(bool_t)); + r->continueFlag = (int *)odr_malloc(o, sizeof(bool_t)); *r->continueFlag = 1; r->resultSetWanted = 0; #ifdef Z_95 @@ -314,7 +317,7 @@ Z_ResourceControlResponse *zget_ResourceControlResponse(ODR o) Z_AccessControlRequest *zget_AccessControlRequest(ODR o) { - Z_AccessControlRequest *r = odr_malloc(o, sizeof(*r)); + Z_AccessControlRequest *r = (Z_AccessControlRequest *)odr_malloc(o, sizeof(*r)); r->referenceId = 0; r->which = Z_AccessRequest_simpleForm; @@ -327,7 +330,7 @@ Z_AccessControlRequest *zget_AccessControlRequest(ODR o) Z_AccessControlResponse *zget_AccessControlResponse(ODR o) { - Z_AccessControlResponse *r = odr_malloc(o, sizeof(*r)); + Z_AccessControlResponse *r = (Z_AccessControlResponse *)odr_malloc(o, sizeof(*r)); r->referenceId = 0; r->which = Z_AccessResponse_simpleForm; @@ -341,10 +344,10 @@ Z_AccessControlResponse *zget_AccessControlResponse(ODR o) Z_Segment *zget_Segment(ODR o) { - Z_Segment *r = odr_malloc(o, sizeof(*r)); + Z_Segment *r = (Z_Segment *)odr_malloc(o, sizeof(*r)); r->referenceId = 0; - r->numberOfRecordsReturned = odr_malloc(o, sizeof(int)); + r->numberOfRecordsReturned = (int *)odr_malloc(o, sizeof(int)); *r->numberOfRecordsReturned = 0; r->num_segmentRecords = 0; r->segmentRecords = 0; @@ -354,10 +357,10 @@ Z_Segment *zget_Segment(ODR o) Z_Close *zget_Close(ODR o) { - Z_Close *r = odr_malloc(o, sizeof(*r)); + Z_Close *r = (Z_Close *)odr_malloc(o, sizeof(*r)); r->referenceId = 0; - r->closeReason = odr_malloc(o, sizeof(int)); + r->closeReason = (int *)odr_malloc(o, sizeof(int)); *r->closeReason = Z_Close_finished; r->diagnosticInformation = 0; r->resourceReportFormat = 0; @@ -370,7 +373,7 @@ Z_Close *zget_Close(ODR o) Z_ResourceReportRequest *zget_ResourceReportRequest(ODR o) { - Z_ResourceReportRequest *r = odr_malloc(o, sizeof(*r)); + Z_ResourceReportRequest *r = (Z_ResourceReportRequest *)odr_malloc(o, sizeof(*r)); r->referenceId = 0; r->opId = 0; @@ -381,10 +384,10 @@ Z_ResourceReportRequest *zget_ResourceReportRequest(ODR o) Z_ResourceReportResponse *zget_ResourceReportResponse(ODR o) { - Z_ResourceReportResponse *r = odr_malloc(o, sizeof(*r)); + Z_ResourceReportResponse *r = (Z_ResourceReportResponse *)odr_malloc(o, sizeof(*r)); r->referenceId = 0; - r->resourceReportStatus = odr_malloc(o, sizeof(int)); + r->resourceReportStatus = (int *)odr_malloc(o, sizeof(int)); *r->resourceReportStatus = Z_ResourceReportStatus_success; r->resourceReport = 0; r->otherInfo = 0; @@ -393,7 +396,7 @@ Z_ResourceReportResponse *zget_ResourceReportResponse(ODR o) Z_SortRequest *zget_SortRequest(ODR o) { - Z_SortRequest *r = odr_malloc(o, sizeof(*r)); + Z_SortRequest *r = (Z_SortRequest *)odr_malloc(o, sizeof(*r)); r->referenceId = 0; r->inputResultSetNames = 0; @@ -405,12 +408,12 @@ Z_SortRequest *zget_SortRequest(ODR o) Z_SortResponse *zget_SortResponse(ODR o) { - Z_SortResponse *r = odr_malloc(o, sizeof(*r)); + Z_SortResponse *r = (Z_SortResponse *)odr_malloc(o, sizeof(*r)); r->referenceId = 0; - r->sortStatus = odr_malloc(o, sizeof(int)); + r->sortStatus = (int *)odr_malloc(o, sizeof(int)); *r->sortStatus = Z_SortStatus_success; - r->resultSetStatus = odr_malloc(o, sizeof(int)); + r->resultSetStatus = (int *)odr_malloc(o, sizeof(int)); *r->resultSetStatus = Z_SortResultSetStatus_empty; r->diagnostics = 0; r->otherInfo = 0; @@ -419,10 +422,10 @@ Z_SortResponse *zget_SortResponse(ODR o) Z_ExtendedServicesRequest *zget_ExtendedServicesRequest(ODR o) { - Z_ExtendedServicesRequest *r = odr_malloc(o, sizeof(*r)); + Z_ExtendedServicesRequest *r = (Z_ExtendedServicesRequest *)odr_malloc(o, sizeof(*r)); r->referenceId = 0; - r->function = odr_malloc(o, sizeof(int)); + r->function = (int *)odr_malloc(o, sizeof(int)); *r->function = Z_ExtendedServicesRequest_create; r->packageType = 0; r->packageName = 0; @@ -431,7 +434,7 @@ Z_ExtendedServicesRequest *zget_ExtendedServicesRequest(ODR o) r->permissions = 0; r->description = 0; r->taskSpecificParameters = 0; - r->waitAction = odr_malloc(o, sizeof(int)); + r->waitAction = (int *)odr_malloc(o, sizeof(int)); *r->waitAction = Z_ExtendedServicesRequest_wait; r->elements = 0; r->otherInfo = 0; @@ -440,10 +443,10 @@ Z_ExtendedServicesRequest *zget_ExtendedServicesRequest(ODR o) Z_ExtendedServicesResponse *zget_ExtendedServicesResponse(ODR o) { - Z_ExtendedServicesResponse *r = odr_malloc(o, sizeof(*r)); + Z_ExtendedServicesResponse *r = (Z_ExtendedServicesResponse *)odr_malloc(o, sizeof(*r)); r->referenceId = 0; - r->operationStatus = odr_malloc(o, sizeof(int)); + r->operationStatus = (int *)odr_malloc(o, sizeof(int)); *r->operationStatus = Z_ExtendedServicesResponse_done; r->num_diagnostics = 0; r->diagnostics = 0; @@ -454,7 +457,7 @@ Z_ExtendedServicesResponse *zget_ExtendedServicesResponse(ODR o) Z_APDU *zget_APDU(ODR o, int which) { - Z_APDU *r = odr_malloc(o, sizeof(*r)); + Z_APDU *r = (Z_APDU *)odr_malloc(o, sizeof(*r)); switch (r->which = which) { diff --git a/ccl/cclerrms.c b/ccl/cclerrms.c index e58a23f..d3c2968 100644 --- a/ccl/cclerrms.c +++ b/ccl/cclerrms.c @@ -45,7 +45,10 @@ * Europagate, 1995 * * $Log: cclerrms.c,v $ - * Revision 1.6 1997-09-29 08:56:37 adam + * Revision 1.7 1998-02-11 11:53:33 adam + * Changed code so that it compiles as C++. + * + * Revision 1.6 1997/09/29 08:56:37 adam * Changed CCL parser to be thread safe. New type, CCL_parser, declared * and a create/destructers ccl_parser_create/ccl_parser/destory has * been added. @@ -79,6 +82,9 @@ * */ +/* Chas: Required for the correct definition of ccl_err_msg */ +#include "yaz-ccl.h" + static char *err_msg_array[] = { "Ok", "Search word expected", diff --git a/ccl/cclfind.c b/ccl/cclfind.c index 3776fe1..b20b3cd 100644 --- a/ccl/cclfind.c +++ b/ccl/cclfind.c @@ -45,7 +45,10 @@ * Europagate, 1995 * * $Log: cclfind.c,v $ - * Revision 1.9 1997-09-29 08:56:37 adam + * Revision 1.10 1998-02-11 11:53:33 adam + * Changed code so that it compiles as C++. + * + * Revision 1.9 1997/09/29 08:56:37 adam * Changed CCL parser to be thread safe. New type, CCL_parser, declared * and a create/destructers ccl_parser_create/ccl_parser/destory has * been added. @@ -172,7 +175,7 @@ static void strxcat (char *n, const char *src, int len) */ static char *copy_token_name (struct ccl_token *tp) { - char *str = malloc (tp->len + 1); + char *str = (char *)malloc (tp->len + 1); assert (str); memcpy (str, tp->name, tp->len); str[tp->len] = '\0'; @@ -187,7 +190,7 @@ static char *copy_token_name (struct ccl_token *tp) static struct ccl_rpn_node *mk_node (int kind) { struct ccl_rpn_node *p; - p = malloc (sizeof(*p)); + p = (struct ccl_rpn_node *)malloc (sizeof(*p)); assert (p); p->kind = kind; return p; @@ -244,7 +247,7 @@ static void add_attr (struct ccl_rpn_node *p, int type, int value) { struct ccl_rpn_attr *n; - n = malloc (sizeof(*n)); + n = (struct ccl_rpn_attr *)malloc (sizeof(*n)); assert (n); n->type = type; n->value = value; @@ -288,7 +291,7 @@ static struct ccl_rpn_node *search_term (CCL_parser cclp, { /* no qualifier(s) applied. Use 'term' if it is defined */ - qa = malloc (2*sizeof(*qa)); + qa = (struct ccl_rpn_attr **)malloc (2*sizeof(*qa)); assert (qa); qa[0] = ccl_qual_search (cclp, "term", 4); qa[1] = NULL; @@ -366,7 +369,7 @@ static struct ccl_rpn_node *search_term (CCL_parser cclp, } /* make the RPN token */ - p->u.t.term = malloc (len); + p->u.t.term = (char *)malloc (len); assert (p->u.t.term); p->u.t.term[0] = '\0'; for (i = 0; ilook_token != la; i++) { diff --git a/ccl/cclqual.c b/ccl/cclqual.c index 55cf773..000c33b 100644 --- a/ccl/cclqual.c +++ b/ccl/cclqual.c @@ -45,7 +45,10 @@ * Europagate, 1995 * * $Log: cclqual.c,v $ - * Revision 1.8 1997-09-29 08:56:38 adam + * Revision 1.9 1998-02-11 11:53:33 adam + * Changed code so that it compiles as C++. + * + * Revision 1.8 1997/09/29 08:56:38 adam * Changed CCL parser to be thread safe. New type, CCL_parser, declared * and a create/destructers ccl_parser_create/ccl_parser/destory has * been added. @@ -122,13 +125,13 @@ void ccl_qual_add (CCL_bibset b, const char *name, int no, int *pairs) break; if (!q) { - struct ccl_qualifier *new_qual = malloc (sizeof(*new_qual)); + struct ccl_qualifier *new_qual = (struct ccl_qualifier *)malloc (sizeof(*new_qual)); assert (new_qual); new_qual->next = b->list; b->list = new_qual; - new_qual->name = malloc (strlen(name)+1); + new_qual->name = (char *)malloc (strlen(name)+1); assert (new_qual->name); strcpy (new_qual->name, name); attrp = &new_qual->attr_list; @@ -143,7 +146,7 @@ void ccl_qual_add (CCL_bibset b, const char *name, int no, int *pairs) { struct ccl_rpn_attr *attr; - attr = malloc (sizeof(*attr)); + attr = (struct ccl_rpn_attr *)malloc (sizeof(*attr)); assert (attr); attr->type = *pairs++; attr->value = *pairs++; @@ -159,7 +162,7 @@ void ccl_qual_add (CCL_bibset b, const char *name, int no, int *pairs) */ CCL_bibset ccl_qual_mk (void) { - CCL_bibset b = malloc (sizeof(*b)); + CCL_bibset b = (CCL_bibset)malloc (sizeof(*b)); assert (b); b->list = NULL; return b; diff --git a/ccl/ccltoken.c b/ccl/ccltoken.c index 6994ced..42922cf 100644 --- a/ccl/ccltoken.c +++ b/ccl/ccltoken.c @@ -45,7 +45,10 @@ * Europagate, 1995 * * $Log: ccltoken.c,v $ - * Revision 1.8 1997-09-29 08:56:38 adam + * Revision 1.9 1998-02-11 11:53:33 adam + * Changed code so that it compiles as C++. + * + * Revision 1.8 1997/09/29 08:56:38 adam * Changed CCL parser to be thread safe. New type, CCL_parser, declared * and a create/destructers ccl_parser_create/ccl_parser/destory has * been added. @@ -155,13 +158,13 @@ struct ccl_token *ccl_token_simple (const char *command) } if (!first) { - first = last = malloc (sizeof (*first)); + first = last = (struct ccl_token *)malloc (sizeof (*first)); assert (first); last->prev = NULL; } else { - last->next = malloc (sizeof(*first)); + last->next = (struct ccl_token *)malloc (sizeof(*first)); assert (last->next); last->next->prev = last; last = last->next; @@ -218,13 +221,13 @@ struct ccl_token *ccl_parser_tokenize (CCL_parser cclp, const char *command) } if (!first) { - first = last = malloc (sizeof (*first)); + first = last = (struct ccl_token *)malloc (sizeof (*first)); assert (first); last->prev = NULL; } else { - last->next = malloc (sizeof(*first)); + last->next = (struct ccl_token *)malloc (sizeof(*first)); assert (last->next); last->next->prev = last; last = last->next; @@ -333,7 +336,7 @@ void ccl_token_del (struct ccl_token *list) CCL_parser ccl_parser_create (void) { - CCL_parser p = malloc (sizeof(*p)); + CCL_parser p = (CCL_parser)malloc (sizeof(*p)); if (!p) return p; p->look_token = NULL; diff --git a/client/Makefile b/client/Makefile index d1edd80..fb09a78 100644 --- a/client/Makefile +++ b/client/Makefile @@ -1,7 +1,7 @@ # Copyright (C) 1995-1998, Index Data I/S # All rights reserved. # Sebastian Hammer, Adam Dickmeiss -# $Id: Makefile,v 1.14 1998-01-07 12:59:27 adam Exp $ +# $Id: Makefile,v 1.15 1998-02-11 11:53:33 adam Exp $ LIBDIR=../lib @@ -11,8 +11,8 @@ SHELL=/bin/sh INCLUDE=-I../include -I. -I../../xtimosi/src LIBINCLUDE=-L$(LIBDIR) DEFS=$(INCLUDE) $(CDEFS) -DCCL2RPN=1 -LIBS=$(LIBDIR)/libasn.a $(LIBDIR)/libodr.a \ - $(LIBDIR)/libcomstack.a ../lib/ccl.a $(LIBMOSI) $(LIBDIR)/libutil.a +LIBS=$(LIBDIR)/libasn.a $(LIBDIR)/libutil.a \ + $(LIBDIR)/libcomstack.a ../lib/ccl.a $(LIBMOSI) $(LIBDIR)/libodr.a CPP=$(CC) -E PROG=client PROGO=client.o diff --git a/client/client.c b/client/client.c index dfaf147..dc06c98 100644 --- a/client/client.c +++ b/client/client.c @@ -4,7 +4,10 @@ * Sebastian Hammer, Adam Dickmeiss * * $Log: client.c,v $ - * Revision 1.61 1998-02-10 11:03:06 adam + * Revision 1.62 1998-02-11 11:53:33 adam + * Changed code so that it compiles as C++. + * + * Revision 1.61 1998/02/10 11:03:06 adam * Implemented command refid. Client prints reference-ID's, when present, * in responses. * @@ -554,7 +557,7 @@ static void display_record(Z_DatabaseRecord *p) */ odr_setbuf(in, (char*)p->u.octet_aligned->buf, p->u.octet_aligned->len, 0); - if (!(*type->fun)(in, &rr, 0)) + if (!(*type->fun)(in, (char **)&rr, 0)) { odr_perror(in, "Decoding constructed record."); fprintf(stderr, "[Near %d]\n", odr_offset(in)); @@ -568,7 +571,7 @@ static void display_record(Z_DatabaseRecord *p) * Note: we throw away the original, BER-encoded record here. * Do something else with it if you want to keep it. */ - r->u.sutrs = rr; /* we don't actually check the type here. */ + r->u.sutrs = (Odr_oct *)rr; /* we don't actually check the type here. */ r->which = type->what; } } @@ -862,7 +865,7 @@ static int cmd_base(char *arg) cp = arg + strlen(arg); if (cp - arg < 1) break; - databaseNames[num_databaseNames] = xmalloc (1 + cp - arg); + databaseNames[num_databaseNames] = (char *)xmalloc (1 + cp - arg); memcpy (databaseNames[num_databaseNames], arg, cp - arg); databaseNames[num_databaseNames++][cp - arg] = '\0'; if (!*cp) @@ -1034,7 +1037,7 @@ int send_sortrequest(char *arg, int newset) { Z_APDU *apdu = zget_APDU(out, Z_APDU_sortRequest); Z_SortRequest *req = apdu->u.sortRequest; - Z_SortKeySpecList *sksl = odr_malloc (out, sizeof(*sksl)); + Z_SortKeySpecList *sksl = (Z_SortKeySpecList *)odr_malloc (out, sizeof(*sksl)); char setstring[32]; char sort_string[32], sort_flags[32]; int off; @@ -1049,23 +1052,23 @@ int send_sortrequest(char *arg, int newset) req->referenceId = set_refid (out); req->inputResultSetNames = - odr_malloc (out, sizeof(*req->inputResultSetNames)); + (Z_StringList *)odr_malloc (out, sizeof(*req->inputResultSetNames)); req->inputResultSetNames->num_strings = 1; req->inputResultSetNames->strings = - odr_malloc (out, sizeof(*req->inputResultSetNames->strings)); + (char **)odr_malloc (out, sizeof(*req->inputResultSetNames->strings)); req->inputResultSetNames->strings[0] = - odr_malloc (out, strlen(setstring)+1); + (char *)odr_malloc (out, strlen(setstring)+1); strcpy (req->inputResultSetNames->strings[0], setstring); if (newset && setnumber >= 0) sprintf (setstring, "%d", ++setnumber); - req->sortedResultSetName = odr_malloc (out, strlen(setstring)+1); + req->sortedResultSetName = (char *)odr_malloc (out, strlen(setstring)+1); strcpy (req->sortedResultSetName, setstring); req->sortSequence = sksl; sksl->num_specs = 0; - sksl->specs = odr_malloc (out, sizeof(sksl->specs) * 20); + sksl->specs = (Z_SortKeySpec **)odr_malloc (out, sizeof(sksl->specs) * 20); bib1.proto = protocol; bib1.oclass = CLASS_ATTSET; @@ -1075,45 +1078,45 @@ int send_sortrequest(char *arg, int newset) { int i; char *sort_string_sep; - Z_SortKeySpec *sks = odr_malloc (out, sizeof(*sks)); - Z_SortKey *sk = odr_malloc (out, sizeof(*sk)); + Z_SortKeySpec *sks = (Z_SortKeySpec *)odr_malloc (out, sizeof(*sks)); + Z_SortKey *sk = (Z_SortKey *)odr_malloc (out, sizeof(*sk)); arg += off; sksl->specs[sksl->num_specs++] = sks; - sks->sortElement = odr_malloc (out, sizeof(*sks->sortElement)); + sks->sortElement = (Z_SortElement *)odr_malloc (out, sizeof(*sks->sortElement)); sks->sortElement->which = Z_SortElement_generic; sks->sortElement->u.generic = sk; if ((sort_string_sep = strchr (sort_string, '='))) { - Z_AttributeElement *el = odr_malloc (out, sizeof(*el)); + Z_AttributeElement *el = (Z_AttributeElement *)odr_malloc (out, sizeof(*el)); sk->which = Z_SortKey_sortAttributes; sk->u.sortAttributes = - odr_malloc (out, sizeof(*sk->u.sortAttributes)); + (Z_SortAttributes *)odr_malloc (out, sizeof(*sk->u.sortAttributes)); sk->u.sortAttributes->id = oid_ent_to_oid(&bib1, oid); sk->u.sortAttributes->list = - odr_malloc (out, sizeof(*sk->u.sortAttributes->list)); + (Z_AttributeList *)odr_malloc (out, sizeof(*sk->u.sortAttributes->list)); sk->u.sortAttributes->list->num_attributes = 1; sk->u.sortAttributes->list->attributes = - odr_malloc (out, + (Z_AttributeElement **)odr_malloc (out, sizeof(*sk->u.sortAttributes->list->attributes)); sk->u.sortAttributes->list->attributes[0] = el; el->attributeSet = 0; - el->attributeType = odr_malloc (out, sizeof(*el->attributeType)); + el->attributeType = (int *)odr_malloc (out, sizeof(*el->attributeType)); *el->attributeType = atoi (sort_string); el->which = Z_AttributeValue_numeric; - el->value.numeric = odr_malloc (out, sizeof(*el->value.numeric)); + el->value.numeric = (int *)odr_malloc (out, sizeof(*el->value.numeric)); *el->value.numeric = atoi (sort_string_sep + 1); } else { sk->which = Z_SortKey_sortField; - sk->u.sortField = odr_malloc (out, strlen(sort_string)+1); + sk->u.sortField = (char *)odr_malloc (out, strlen(sort_string)+1); strcpy (sk->u.sortField, sort_string); } - sks->sortRelation = odr_malloc (out, sizeof(*sks->sortRelation)); + sks->sortRelation = (int *)odr_malloc (out, sizeof(*sks->sortRelation)); *sks->sortRelation = Z_SortRelation_ascending; - sks->caseSensitivity = odr_malloc (out, sizeof(*sks->caseSensitivity)); + sks->caseSensitivity = (int *)odr_malloc (out, sizeof(*sks->caseSensitivity)); *sks->caseSensitivity = Z_SortCase_caseSensitive; sks->missingValueAction = NULL; diff --git a/comstack/tcpip.c b/comstack/tcpip.c index 0163f3c..3a99bd0 100644 --- a/comstack/tcpip.c +++ b/comstack/tcpip.c @@ -4,7 +4,10 @@ * Sebastian Hammer, Adam Dickmeiss * * $Log: tcpip.c,v $ - * Revision 1.18 1997-09-29 07:15:25 adam + * Revision 1.19 1998-02-11 11:53:33 adam + * Changed code so that it compiles as C++. + * + * Revision 1.18 1997/09/29 07:15:25 adam * Changed use of setsockopt to avoid warnings on MSVC. * * Revision 1.17 1997/09/17 12:10:30 adam @@ -136,6 +139,10 @@ #include #include +/* Chas added the following 2, so we get the definition of completeBER */ +#include +#include + int tcpip_close(COMSTACK h); int tcpip_put(COMSTACK h, char *buf, int size); int tcpip_get(COMSTACK h, char **buf, int *bufsize); @@ -151,7 +158,9 @@ void *tcpip_straddr(COMSTACK h, const char *str); /* * Determine length/completeness of incoming packages */ -int completeBER(unsigned char *buf, int len); /* from the ODR module */ +/* Chas: Removed the definition of completeBERfrom here, use the one in the */ +/* include directory as that as the extern "C" around it */ +/*int completeBER(unsigned char *buf, int len); */ /* from the ODR module */ int completeWAIS(unsigned char *buf, int len); /* from waislen.c */ #ifdef TRACE_TCPIP @@ -226,9 +235,10 @@ COMSTACK tcpip_type(int s, int blocking, int protocol) } else new_socket = 0; - if (!(p = xmalloc(sizeof(struct comstack)))) + if (!(p = (struct comstack *)xmalloc(sizeof(struct comstack)))) return 0; - if (!(state = p->cprivate = xmalloc(sizeof(tcpip_state)))) + if (!(state = (struct tcpip_state *)(p->cprivate = + xmalloc(sizeof(tcpip_state))))) return 0; #ifdef WINDOWS @@ -305,7 +315,7 @@ static int tcpip_strtoaddr_ex(const char *str, struct sockaddr_in *add) void *tcpip_straddr(COMSTACK h, const char *str) { - tcpip_state *sp = h->cprivate; + tcpip_state *sp = (tcpip_state *)h->cprivate; if (!tcpip_strtoaddr_ex (str, &sp->addr)) return 0; @@ -323,7 +333,7 @@ struct sockaddr_in *tcpip_strtoaddr(const char *str) int tcpip_more(COMSTACK h) { - tcpip_state *sp = h->cprivate; + tcpip_state *sp = (tcpip_state *)h->cprivate; return sp->altlen && (*sp->complete)((unsigned char *) sp->altbuf, sp->altlen); @@ -336,7 +346,7 @@ int tcpip_more(COMSTACK h) */ int tcpip_connect(COMSTACK h, void *address) { - struct sockaddr_in *add = address; + struct sockaddr_in *add = (struct sockaddr_in *)address; TRC(fprintf(stderr, "tcpip_connect\n")); if (connect(h->iofile, (struct sockaddr *) add, sizeof(*add)) < 0) @@ -364,7 +374,7 @@ int tcpip_rcvconnect(COMSTACK h) int tcpip_bind(COMSTACK h, void *address, int mode) { - struct sockaddr *addr = address; + struct sockaddr *addr = (struct sockaddr *)address; #ifdef WINDOWS BOOL one = 1; #else @@ -372,7 +382,7 @@ int tcpip_bind(COMSTACK h, void *address, int mode) #endif TRC(fprintf(stderr, "tcpip_bind\n")); - if (setsockopt(h->iofile, SOL_SOCKET, SO_REUSEADDR, (void*) + if (setsockopt(h->iofile, SOL_SOCKET, SO_REUSEADDR, (char*) &one, sizeof(one)) < 0) { h->cerrno = CSYSERR; @@ -427,7 +437,7 @@ int tcpip_listen(COMSTACK h, char *raddr, int *addrlen) COMSTACK tcpip_accept(COMSTACK h) { COMSTACK cnew; - tcpip_state *state, *st = h->cprivate; + tcpip_state *state, *st = (tcpip_state *)h->cprivate; #ifdef WINDOWS unsigned long tru = 1; #endif @@ -438,14 +448,14 @@ COMSTACK tcpip_accept(COMSTACK h) h->cerrno = CSOUTSTATE; return 0; } - if (!(cnew = xmalloc(sizeof(*cnew)))) + if (!(cnew = (COMSTACK)xmalloc(sizeof(*cnew)))) { h->cerrno = CSYSERR; return 0; } memcpy(cnew, h, sizeof(*h)); cnew->iofile = h->newfd; - if (!(state = cnew->cprivate = xmalloc(sizeof(tcpip_state)))) + if (!(state = (tcpip_state *)(cnew->cprivate = xmalloc(sizeof(tcpip_state))))) { h->cerrno = CSYSERR; return 0; @@ -473,7 +483,7 @@ COMSTACK tcpip_accept(COMSTACK h) */ int tcpip_get(COMSTACK h, char **buf, int *bufsize) { - tcpip_state *sp = h->cprivate; + tcpip_state *sp = (tcpip_state *)h->cprivate; char *tmpc; int tmpi, berlen, rest, req, tomove; int hasread = 0, res; @@ -496,11 +506,11 @@ int tcpip_get(COMSTACK h, char **buf, int *bufsize) { if (!*bufsize) { - if (!(*buf = xmalloc(*bufsize = CS_TCPIP_BUFCHUNK))) + if (!(*buf = (char *)xmalloc(*bufsize = CS_TCPIP_BUFCHUNK))) return -1; } else if (*bufsize - hasread < CS_TCPIP_BUFCHUNK) - if (!(*buf =xrealloc(*buf, *bufsize *= 2))) + if (!(*buf =(char *)xrealloc(*buf, *bufsize *= 2))) return -1; if ((res = recv(h->iofile, *buf + hasread, CS_TCPIP_BUFCHUNK, 0)) < 0) #ifdef WINDOWS @@ -527,10 +537,10 @@ int tcpip_get(COMSTACK h, char **buf, int *bufsize) req += CS_TCPIP_BUFCHUNK - rest; if (!sp->altbuf) { - if (!(sp->altbuf = xmalloc(sp->altsize = req))) + if (!(sp->altbuf = (char *)xmalloc(sp->altsize = req))) return -1; } else if (sp->altsize < req) - if (!(sp->altbuf =xrealloc(sp->altbuf, sp->altsize = req))) + if (!(sp->altbuf =(char *)xrealloc(sp->altbuf, sp->altsize = req))) return -1; TRC(fprintf(stderr, " Moving %d bytes to altbuf(0x%x)\n", tomove, (unsigned) sp->altbuf)); @@ -549,7 +559,7 @@ int tcpip_get(COMSTACK h, char **buf, int *bufsize) int tcpip_put(COMSTACK h, char *buf, int size) { int res; - struct tcpip_state *state = h->cprivate; + struct tcpip_state *state = (struct tcpip_state *)h->cprivate; TRC(fprintf(stderr, "tcpip_put: size=%d\n", size)); if (state->towrite < 0) @@ -590,7 +600,7 @@ int tcpip_put(COMSTACK h, char *buf, int size) int tcpip_close(COMSTACK h) { - tcpip_state *sp = h->cprivate; + tcpip_state *sp = (struct tcpip_state *)h->cprivate; TRC(fprintf(stderr, "tcpip_close\n")); if (h->iofile != -1) @@ -609,7 +619,7 @@ int tcpip_close(COMSTACK h) char *tcpip_addrstr(COMSTACK h) { struct sockaddr_in addr; - tcpip_state *sp = h->cprivate; + tcpip_state *sp = (struct tcpip_state *)h->cprivate; char *r, *buf = sp->buf; int len; struct hostent *host; diff --git a/include/ccl.h b/include/ccl.h index d6ed51d..2370ac5 100644 --- a/include/ccl.h +++ b/include/ccl.h @@ -46,7 +46,10 @@ * CCL - header file * * $Log: ccl.h,v $ - * Revision 1.8 1997-09-29 09:01:19 adam + * Revision 1.9 1998-02-11 11:53:33 adam + * Changed code so that it compiles as C++. + * + * Revision 1.8 1997/09/29 09:01:19 adam * Changed CCL parser to be thread safe. New type, CCL-parser, declared * and a create/destructor ccl_parser_create/ccl_parser_destroy has been * added. @@ -262,7 +265,7 @@ struct ccl_rpn_node *ccl_find (CCL_bibset abibset, struct ccl_token *list, int *error, const char **pos); /* Return english-readable error message */ -char *ccl_err_msg (int ccl_errno); +const char *ccl_err_msg (int ccl_errno); /* Delete RPN tree returned by ccl_find */ void ccl_rpn_delete (struct ccl_rpn_node *rpn); diff --git a/include/odr.h b/include/odr.h index 24a5780..9af4c88 100644 --- a/include/odr.h +++ b/include/odr.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 1995-1997, Index Data. + * Copyright (c) 1995-1998, Index Data. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation, in whole or in part, for any purpose, is hereby granted, @@ -24,7 +24,10 @@ * OF THIS SOFTWARE. * * $Log: odr.h,v $ - * Revision 1.24 1997-11-24 11:33:56 adam + * Revision 1.25 1998-02-11 11:53:33 adam + * Changed code so that it compiles as C++. + * + * Revision 1.24 1997/11/24 11:33:56 adam * Using function odr_nullval() instead of global ODR_NULLVAL when * appropriate. * @@ -292,7 +295,7 @@ typedef struct odr Odr_ber_tag odr_ber_tag; } *ODR; -typedef int (*Odr_fun)(); +typedef int (*Odr_fun)(ODR, char **, int); typedef struct odr_arm { diff --git a/include/prt-exd.h b/include/prt-exd.h index a471312..fa3c875 100644 --- a/include/prt-exd.h +++ b/include/prt-exd.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 1995, Index Data. + * Copyright (c) 1995-1998, Index Data. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation, in whole or in part, for any purpose, is hereby granted, diff --git a/include/prt-exp.h b/include/prt-exp.h index 74afadd..832763b 100644 --- a/include/prt-exp.h +++ b/include/prt-exp.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 1995-1997, Index Data. + * Copyright (c) 1995-1998, Index Data. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation, in whole or in part, for any purpose, is hereby granted, diff --git a/include/prt-ext.h b/include/prt-ext.h index b01c8d8..9b60b85 100644 --- a/include/prt-ext.h +++ b/include/prt-ext.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 1995, Index Data. + * Copyright (c) 1995-1998, Index Data. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation, in whole or in part, for any purpose, is hereby granted, diff --git a/include/prt.h b/include/prt.h index 89ca6e0..afd65ce 100644 --- a/include/prt.h +++ b/include/prt.h @@ -1,10 +1,13 @@ /* - * Copyright (c) 1995-1997, Index Data + * Copyright (c) 1995-1998, Index Data * See the file LICENSE for details. * Sebastian Hammer, Adam Dickmeiss * * $Log: prt.h,v $ - * Revision 1.21 1997-10-31 12:20:08 adam + * Revision 1.22 1998-02-11 11:53:34 adam + * Changed code so that it compiles as C++. + * + * Revision 1.21 1997/10/31 12:20:08 adam * Improved memory debugging for xmalloc/nmem.c. References to NMEM * instead of ODR in n ESPEC-1 handling in source d1_espec.c. * Bug fix: missing fclose in data1_read_espec1. diff --git a/odr/ber_any.c b/odr/ber_any.c index 7b56f0f..3c00d47 100644 --- a/odr/ber_any.c +++ b/odr/ber_any.c @@ -4,7 +4,10 @@ * Sebastian Hammer, Adam Dickmeiss * * $Log: ber_any.c,v $ - * Revision 1.13 1997-05-14 06:53:56 adam + * Revision 1.14 1998-02-11 11:53:34 adam + * Changed code so that it compiles as C++. + * + * Revision 1.13 1997/05/14 06:53:56 adam * C++ support. * * Revision 1.12 1995/09/29 17:12:15 quinn @@ -60,7 +63,7 @@ int ber_any(ODR o, Odr_any **p) o->error = OPROTO; return 0; } - (*p)->buf = odr_malloc(o, res); + (*p)->buf = (unsigned char *)odr_malloc(o, res); memcpy((*p)->buf, o->bp, res); (*p)->len = (*p)->size = res; o->bp += res; diff --git a/odr/ber_oct.c b/odr/ber_oct.c index af9d86d..e7c91a8 100644 --- a/odr/ber_oct.c +++ b/odr/ber_oct.c @@ -4,7 +4,10 @@ * Sebastian Hammer, Adam Dickmeiss * * $Log: ber_oct.c,v $ - * Revision 1.10 1995-09-29 17:12:18 quinn + * Revision 1.11 1998-02-11 11:53:34 adam + * Changed code so that it compiles as C++. + * + * Revision 1.10 1995/09/29 17:12:18 quinn * Smallish * * Revision 1.9 1995/09/27 15:02:55 quinn @@ -70,7 +73,7 @@ int ber_octetstring(ODR o, Odr_oct *p, int cons) } if (len + 1 > p->size - p->len) { - c = odr_malloc(o, p->size += len + 1); + c = (unsigned char *)odr_malloc(o, p->size += len + 1); if (p->len) memcpy(c, p->buf, p->len); p->buf = c; diff --git a/odr/ber_tag.c b/odr/ber_tag.c index 0f34540..8dc5e17 100644 --- a/odr/ber_tag.c +++ b/odr/ber_tag.c @@ -4,7 +4,10 @@ * Sebastian Hammer, Adam Dickmeiss * * $Log: ber_tag.c,v $ - * Revision 1.17 1997-09-30 09:33:10 adam + * Revision 1.18 1998-02-11 11:53:34 adam + * Changed code so that it compiles as C++. + * + * Revision 1.17 1997/09/30 09:33:10 adam * Minor changes - removed indentation of ifdef. * * Revision 1.16 1997/09/17 12:10:33 adam @@ -77,7 +80,7 @@ int ber_tag(ODR o, void *p, int zclass, int tag, int *constructed, int opt) { Odr_ber_tag *odr_ber_tag = &o->odr_ber_tag; int rd; - char **pp = p; + char **pp = (char **)p; if (o->direction == ODR_DECODE) *pp = 0; diff --git a/odr/odr.c b/odr/odr.c index c249c93..3208e7a 100644 --- a/odr/odr.c +++ b/odr/odr.c @@ -4,7 +4,10 @@ * Sebastian Hammer, Adam Dickmeiss * * $Log: odr.c,v $ - * Revision 1.26 1997-11-24 11:33:56 adam + * Revision 1.27 1998-02-11 11:53:34 adam + * Changed code so that it compiles as C++. + * + * Revision 1.26 1997/11/24 11:33:56 adam * Using function odr_nullval() instead of global ODR_NULLVAL when * appropriate. * @@ -145,11 +148,11 @@ void odr_setprint(ODR o, FILE *file) ODR odr_createmem(int direction) { - struct odr *r; + ODR r; logf (LOG_DEBUG, "odr_createmem dir=%d", direction); - if (!(r = xmalloc(sizeof(*r)))) + if (!(r = (ODR)xmalloc(sizeof(*r)))) return 0; r->direction = direction; r->print = stderr; diff --git a/odr/odr_any.c b/odr/odr_any.c index 293c4cc..218d64d 100644 --- a/odr/odr_any.c +++ b/odr/odr_any.c @@ -4,7 +4,10 @@ * Sebastian Hammer, Adam Dickmeiss * * $Log: odr_any.c,v $ - * Revision 1.6 1995-09-29 17:12:22 quinn + * Revision 1.7 1998-02-11 11:53:34 adam + * Changed code so that it compiles as C++. + * + * Revision 1.6 1995/09/29 17:12:22 quinn * Smallish * * Revision 1.5 1995/09/27 15:02:58 quinn @@ -42,7 +45,7 @@ int odr_any(ODR o, Odr_any **p, int opt) return 1; } if (o->direction == ODR_DECODE) - *p = odr_malloc(o, sizeof(**p)); + *p = (Odr_oct *)odr_malloc(o, sizeof(**p)); if (ber_any(o, p)) return 1; *p = 0; diff --git a/odr/odr_bit.c b/odr/odr_bit.c index 1407116..771ee4b 100644 --- a/odr/odr_bit.c +++ b/odr/odr_bit.c @@ -4,7 +4,10 @@ * Sebastian Hammer, Adam Dickmeiss * * $Log: odr_bit.c,v $ - * Revision 1.10 1995-09-29 17:12:22 quinn + * Revision 1.11 1998-02-11 11:53:34 adam + * Changed code so that it compiles as C++. + * + * Revision 1.10 1995/09/29 17:12:22 quinn * Smallish * * Revision 1.9 1995/09/27 15:02:58 quinn @@ -67,7 +70,7 @@ int odr_bitstring(ODR o, Odr_bitmask **p, int opt) } if (o->direction == ODR_DECODE) { - *p = odr_malloc(o, sizeof(Odr_bitmask)); + *p = (Odr_bitmask *)odr_malloc(o, sizeof(Odr_bitmask)); memset((*p)->bits, 0, ODR_BITMASK_SIZE); (*p)->top = -1; } diff --git a/odr/odr_bool.c b/odr/odr_bool.c index 2fcb888..f26ac2d 100644 --- a/odr/odr_bool.c +++ b/odr/odr_bool.c @@ -4,7 +4,10 @@ * Sebastian Hammer, Adam Dickmeiss * * $Log: odr_bool.c,v $ - * Revision 1.8 1995-09-29 17:12:23 quinn + * Revision 1.9 1998-02-11 11:53:34 adam + * Changed code so that it compiles as C++. + * + * Revision 1.8 1995/09/29 17:12:23 quinn * Smallish * * Revision 1.7 1995/09/27 15:02:58 quinn @@ -60,6 +63,6 @@ int odr_bool(ODR o, int **p, int opt) if (cons) return 0; if (o->direction == ODR_DECODE) - *p = odr_malloc(o, sizeof(int)); + *p = (int *)odr_malloc(o, sizeof(int)); return ber_boolean(o, *p); } diff --git a/odr/odr_choice.c b/odr/odr_choice.c index a4df25e..f0a8f9a 100644 --- a/odr/odr_choice.c +++ b/odr/odr_choice.c @@ -4,7 +4,10 @@ * Sebastian Hammer, Adam Dickmeiss * * $Log: odr_choice.c,v $ - * Revision 1.14 1997-05-14 06:53:57 adam + * Revision 1.15 1998-02-11 11:53:34 adam + * Changed code so that it compiles as C++. + * + * Revision 1.14 1997/05/14 06:53:57 adam * C++ support. * * Revision 1.13 1997/04/30 08:52:10 quinn @@ -53,7 +56,7 @@ int odr_choice(ODR o, Odr_arm arm[], void *p, void *whichp) { - int i, cl = -1, tg, cn, *which = whichp, bias = o->choice_bias; + int i, cl = -1, tg, cn, *which = (int *)whichp, bias = o->choice_bias; if (o->error) return 0; @@ -90,18 +93,18 @@ int odr_choice(ODR o, Odr_arm arm[], void *p, void *whichp) if (arm[i].tagmode == ODR_IMPLICIT) { odr_implicit_settag(o, cl, tg); - return (*arm[i].fun)(o, p, 0); + return (*arm[i].fun)(o, (char **)p, 0); } /* explicit */ if (!odr_constructed_begin(o, p, cl, tg)) return 0; - return (*arm[i].fun)(o, p, 0) && + return (*arm[i].fun)(o, (char **)p, 0) && odr_constructed_end(o); } } else /* no tagging. Have to poll type */ { - if ((*arm[i].fun)(o, p, 1) && *(char**)p) + if ((*arm[i].fun)(o, (char **)p, 1) && *(char**)p) return 1; } } diff --git a/odr/odr_int.c b/odr/odr_int.c index cad4add..8cfab5f 100644 --- a/odr/odr_int.c +++ b/odr/odr_int.c @@ -4,7 +4,10 @@ * Sebastian Hammer, Adam Dickmeiss * * $Log: odr_int.c,v $ - * Revision 1.10 1995-09-29 17:12:24 quinn + * Revision 1.11 1998-02-11 11:53:34 adam + * Changed code so that it compiles as C++. + * + * Revision 1.10 1995/09/29 17:12:24 quinn * Smallish * * Revision 1.9 1995/09/29 17:01:50 quinn @@ -69,6 +72,6 @@ int odr_integer(ODR o, int **p, int opt) return 0; } if (o->direction == ODR_DECODE) - *p = odr_malloc(o, sizeof(int)); + *p = (int *)odr_malloc(o, sizeof(int)); return ber_integer(o, *p); } diff --git a/odr/odr_mem.c b/odr/odr_mem.c index f0792d0..f87e5ca 100644 --- a/odr/odr_mem.c +++ b/odr/odr_mem.c @@ -4,7 +4,10 @@ * Sebastian Hammer, Adam Dickmeiss * * $Log: odr_mem.c,v $ - * Revision 1.12 1995-11-08 17:41:33 quinn + * Revision 1.13 1998-02-11 11:53:34 adam + * Changed code so that it compiles as C++. + * + * Revision 1.12 1995/11/08 17:41:33 quinn * Smallish. * * Revision 1.11 1995/11/01 13:54:43 quinn @@ -88,9 +91,9 @@ int odr_grow_block(odr_ecblock *b, int min_bytes) togrow = b->size; if (togrow < min_bytes) togrow = min_bytes; - if (b->size && !(b->buf =xrealloc(b->buf, b->size += togrow))) + if (b->size && !(b->buf =(unsigned char *)xrealloc(b->buf, b->size += togrow))) abort(); - else if (!b->size && !(b->buf = xmalloc(b->size = togrow))) + else if (!b->size && !(b->buf = (unsigned char *)xmalloc(b->size = togrow))) abort(); #ifdef ODR_DEBUG fprintf(stderr, "New size for encode_buffer: %d\n", b->size); diff --git a/odr/odr_oct.c b/odr/odr_oct.c index b289738..b9c572d 100644 --- a/odr/odr_oct.c +++ b/odr/odr_oct.c @@ -4,7 +4,10 @@ * Sebastian Hammer, Adam Dickmeiss * * $Log: odr_oct.c,v $ - * Revision 1.11 1995-09-29 17:12:25 quinn + * Revision 1.12 1998-02-11 11:53:34 adam + * Changed code so that it compiles as C++. + * + * Revision 1.11 1995/09/29 17:12:25 quinn * Smallish * * Revision 1.10 1995/09/27 15:02:59 quinn @@ -67,7 +70,7 @@ int odr_octetstring(ODR o, Odr_oct **p, int opt) } if (o->direction == ODR_DECODE) { - *p = odr_malloc(o, sizeof(Odr_oct)); + *p = (Odr_oct *)odr_malloc(o, sizeof(Odr_oct)); (*p)->size= 0; (*p)->len = 0; (*p)->buf = 0; @@ -102,7 +105,7 @@ int odr_cstring(ODR o, char **p, int opt) fprintf(o->print, "%s'%s'\n", odr_indent(o), *p); return 1; } - t = odr_malloc(o, sizeof(Odr_oct)); /* wrapper for octstring */ + t = (Odr_oct *)odr_malloc(o, sizeof(Odr_oct)); /* wrapper for octstring */ if (o->direction == ODR_ENCODE) { t->buf = (unsigned char *) *p; diff --git a/odr/odr_oid.c b/odr/odr_oid.c index 94025f6..0feae2e 100644 --- a/odr/odr_oid.c +++ b/odr/odr_oid.c @@ -4,7 +4,10 @@ * Sebastian Hammer, Adam Dickmeiss * * $Log: odr_oid.c,v $ - * Revision 1.12 1995-09-29 17:12:25 quinn + * Revision 1.13 1998-02-11 11:53:34 adam + * Changed code so that it compiles as C++. + * + * Revision 1.12 1995/09/29 17:12:25 quinn * Smallish * * Revision 1.11 1995/09/27 15:03:00 quinn @@ -81,6 +84,6 @@ int odr_oid(ODR o, Odr_oid **p, int opt) return 1; } if (o->direction == ODR_DECODE) - *p = odr_malloc(o, OID_SIZE * sizeof(**p)); + *p = (int *)odr_malloc(o, OID_SIZE * sizeof(**p)); return ber_oidc(o, *p); } diff --git a/odr/odr_seq.c b/odr/odr_seq.c index b5edb90..c03df95 100644 --- a/odr/odr_seq.c +++ b/odr/odr_seq.c @@ -4,7 +4,10 @@ * Sebastian Hammer, Adam Dickmeiss * * $Log: odr_seq.c,v $ - * Revision 1.21 1997-11-24 11:33:56 adam + * Revision 1.22 1998-02-11 11:53:34 adam + * Changed code so that it compiles as C++. + * + * Revision 1.21 1997/11/24 11:33:56 adam * Using function odr_nullval() instead of global ODR_NULLVAL when * appropriate. * @@ -92,7 +95,7 @@ int odr_sequence_begin(ODR o, void *p, int size) if (odr_constructed_begin(o, p, o->t_class, o->t_tag)) { if (o->direction == ODR_DECODE && size) - *pp = odr_malloc(o, size); + *pp = (char *)odr_malloc(o, size); return 1; } else @@ -125,14 +128,14 @@ int odr_sequence_of(ODR o, Odr_fun type, void *p, int *num) { case ODR_DECODE: *num = 0; - *pp = odr_nullval(); + *pp = (char **)odr_nullval(); while (odr_sequence_more(o)) { /* outgrown array? */ if (*num * (int) sizeof(void*) >= size) { /* double the buffer size */ - tmp = odr_malloc(o, sizeof(void*) * (size += size ? size : + tmp = (char **)odr_malloc(o, sizeof(void*) * (size += size ? size : 128)); if (*num) { diff --git a/odr/odr_tag.c b/odr/odr_tag.c index 129a272..3642f46 100644 --- a/odr/odr_tag.c +++ b/odr/odr_tag.c @@ -4,7 +4,10 @@ * Sebastian Hammer, Adam Dickmeiss * * $Log: odr_tag.c,v $ - * Revision 1.8 1997-05-14 06:53:59 adam + * Revision 1.9 1998-02-11 11:53:34 adam + * Changed code so that it compiles as C++. + * + * Revision 1.8 1997/05/14 06:53:59 adam * C++ support. * * Revision 1.7 1996/02/20 12:52:54 quinn @@ -68,7 +71,7 @@ int odr_initmember(ODR o, void *p, int size) if (o->error) return 0; if (o->direction == ODR_DECODE) - *pp = odr_malloc(o, size); + *pp = (char *)odr_malloc(o, size); else if (!*pp) { o->t_class = -1; diff --git a/odr/odr_use.c b/odr/odr_use.c index 25a178d..324bc7d 100644 --- a/odr/odr_use.c +++ b/odr/odr_use.c @@ -4,7 +4,10 @@ * Sebastian Hammer, Adam Dickmeiss * * $Log: odr_use.c,v $ - * Revision 1.7 1995-09-29 17:12:27 quinn + * Revision 1.8 1998-02-11 11:53:34 adam + * Changed code so that it compiles as C++. + * + * Revision 1.7 1995/09/29 17:12:27 quinn * Smallish * * Revision 1.6 1995/09/27 15:03:00 quinn @@ -35,9 +38,9 @@ int odr_external(ODR o, Odr_external **p, int opt) Odr_external *pp; static Odr_arm arm[] = { - {ODR_EXPLICIT, ODR_CONTEXT, 0, ODR_EXTERNAL_single, odr_any}, - {ODR_IMPLICIT, ODR_CONTEXT, 1, ODR_EXTERNAL_octet, odr_octetstring}, - {ODR_IMPLICIT, ODR_CONTEXT, 2, ODR_EXTERNAL_arbitrary, odr_bitstring}, + {ODR_EXPLICIT, ODR_CONTEXT, 0, ODR_EXTERNAL_single, (Odr_fun)odr_any}, + {ODR_IMPLICIT, ODR_CONTEXT, 1, ODR_EXTERNAL_octet, (Odr_fun)odr_octetstring}, + {ODR_IMPLICIT, ODR_CONTEXT, 2, ODR_EXTERNAL_arbitrary, (Odr_fun)odr_bitstring}, {-1, -1, -1, -1, 0} }; diff --git a/odr/odr_util.c b/odr/odr_util.c index 0cee539..72b80d6 100644 --- a/odr/odr_util.c +++ b/odr/odr_util.c @@ -4,7 +4,10 @@ * Sebastian Hammer, Adam Dickmeiss * * $Log: odr_util.c,v $ - * Revision 1.12 1997-10-31 12:20:08 adam + * Revision 1.13 1998-02-11 11:53:34 adam + * Changed code so that it compiles as C++. + * + * Revision 1.12 1997/10/31 12:20:08 adam * Improved memory debugging for xmalloc/nmem.c. References to NMEM * instead of ODR in n ESPEC-1 handling in source d1_espec.c. * Bug fix: missing fclose in data1_read_espec1. @@ -54,7 +57,7 @@ Odr_oid *odr_oiddup_nmem(NMEM nmem, Odr_oid *o) if (!o) return 0; - if (!(r = nmem_malloc(nmem, (oid_oidlen(o) + 1) * sizeof(int)))) + if (!(r = (int *)nmem_malloc(nmem, (oid_oidlen(o) + 1) * sizeof(int)))) return 0; oid_oidcpy(r, o); return r; @@ -75,7 +78,7 @@ Odr_oid *odr_getoidbystr_nmem(NMEM nmem, char *str) return 0; while ((p = strchr(p, '.'))) num++, p++; - ret = nmem_malloc(nmem, sizeof(*ret)*(num + 1)); + ret = (int *)nmem_malloc(nmem, sizeof(*ret)*(num + 1)); p = str; do ret[i++] = atoi(p); diff --git a/retrieval/d1_absyn.c b/retrieval/d1_absyn.c index b38d7aa..006bb58 100644 --- a/retrieval/d1_absyn.c +++ b/retrieval/d1_absyn.c @@ -4,7 +4,10 @@ * Sebastian Hammer, Adam Dickmeiss * * $Log: d1_absyn.c,v $ - * Revision 1.16 1997-12-18 10:51:30 adam + * Revision 1.17 1998-02-11 11:53:34 adam + * Changed code so that it compiles as C++. + * + * Revision 1.16 1997/12/18 10:51:30 adam * Implemented sub-trees feature for schemas - including forward * references. * @@ -100,7 +103,7 @@ data1_absyn *data1_absyn_add (data1_handle dh, const char *name) char fname[512]; NMEM mem = data1_nmem_get (dh); - data1_absyn_cache p = nmem_malloc (mem, sizeof(*p)); + data1_absyn_cache p = (data1_absyn_cache)nmem_malloc (mem, sizeof(*p)); data1_absyn_cache *pp = data1_absyn_cache_get (dh); sprintf(fname, "%s.abs", name); @@ -208,7 +211,7 @@ data1_absyn *data1_read_absyn (data1_handle dh, const char *file) return 0; } - res = nmem_malloc(data1_nmem_get(dh), sizeof(*res)); + res = (data1_absyn *)nmem_malloc(data1_nmem_get(dh), sizeof(*res)); res->name = 0; res->reference = VAL_NONE; res->tagset = 0; @@ -247,7 +250,7 @@ data1_absyn *data1_read_absyn (data1_handle dh, const char *file) if (!cur_elements) { - cur_elements = nmem_malloc(data1_nmem_get(dh), + cur_elements = (data1_sub_elements *)nmem_malloc(data1_nmem_get(dh), sizeof(*cur_elements)); cur_elements->next = res->sub_elements; cur_elements->elements = NULL; @@ -282,7 +285,7 @@ data1_absyn *data1_read_absyn (data1_handle dh, const char *file) } level = i; new_element = *ppl[level] = - nmem_malloc(data1_nmem_get(dh), sizeof(*new_element)); + (data1_element *)nmem_malloc(data1_nmem_get(dh), sizeof(*new_element)); new_element->next = new_element->children = 0; new_element->tag = 0; new_element->termlists = 0; @@ -321,11 +324,11 @@ data1_absyn *data1_read_absyn (data1_handle dh, const char *file) else if (*p) { data1_tag *nt = - new_element->tag = nmem_malloc(data1_nmem_get (dh), + new_element->tag = (data1_tag *)nmem_malloc(data1_nmem_get (dh), sizeof(*new_element->tag)); nt->which = DATA1T_string; nt->value.string = nmem_strdup(data1_nmem_get (dh), p); - nt->names = nmem_malloc(data1_nmem_get(dh), + nt->names = (data1_name *)nmem_malloc(data1_nmem_get(dh), sizeof(*new_element->tag->names)); nt->names->name = nt->value.string; nt->names->next = 0; @@ -366,7 +369,7 @@ data1_absyn *data1_read_absyn (data1_handle dh, const char *file) } if (*attname == '!') strcpy(attname, name); - *tp = nmem_malloc(data1_nmem_get(dh), sizeof(**tp)); + *tp = (data1_termlist *)nmem_malloc(data1_nmem_get(dh), sizeof(**tp)); (*tp)->next = 0; if (!((*tp)->att = data1_getattbyname(dh, res->attset, attname))) @@ -380,7 +383,7 @@ data1_absyn *data1_read_absyn (data1_handle dh, const char *file) (*tp)->structure = "w"; else { - (*tp)->structure = nmem_malloc (data1_nmem_get (dh), + (*tp)->structure = (char *)nmem_malloc (data1_nmem_get (dh), strlen(structure)+1); strcpy ((*tp)->structure, structure); } @@ -400,7 +403,7 @@ data1_absyn *data1_read_absyn (data1_handle dh, const char *file) file, args); continue; } - cur_elements = nmem_malloc(data1_nmem_get(dh), + cur_elements = (data1_sub_elements *)nmem_malloc(data1_nmem_get(dh), sizeof(*cur_elements)); cur_elements->next = res->sub_elements; cur_elements->elements = NULL; @@ -442,7 +445,7 @@ data1_absyn *data1_read_absyn (data1_handle dh, const char *file) fclose(f); return 0; } - *tp = nmem_malloc(data1_nmem_get(dh), sizeof(**tp)); + *tp = (data1_termlist *)nmem_malloc(data1_nmem_get(dh), sizeof(**tp)); if (!((*tp)->att = data1_getattbyname (dh, res->attset, attname))) { @@ -455,7 +458,7 @@ data1_absyn *data1_read_absyn (data1_handle dh, const char *file) (*tp)->structure = "w"; else { - (*tp)->structure = nmem_malloc (data1_nmem_get (dh), + (*tp)->structure = (char *)nmem_malloc (data1_nmem_get (dh), strlen(structure)+1); strcpy ((*tp)->structure, structure); } @@ -555,7 +558,7 @@ data1_absyn *data1_read_absyn (data1_handle dh, const char *file) fclose(f); return 0; } - *esetpp = nmem_malloc(data1_nmem_get(dh), sizeof(**esetpp)); + *esetpp = (data1_esetname *)nmem_malloc(data1_nmem_get(dh), sizeof(**esetpp)); (*esetpp)->name = nmem_strdup(data1_nmem_get(dh), name); (*esetpp)->next = 0; if (*fname == '@') diff --git a/retrieval/d1_attset.c b/retrieval/d1_attset.c index b747942..c0b7f49 100644 --- a/retrieval/d1_attset.c +++ b/retrieval/d1_attset.c @@ -4,7 +4,10 @@ * Sebastian Hammer, Adam Dickmeiss * * $Log: d1_attset.c,v $ - * Revision 1.7 1997-09-17 12:10:34 adam + * Revision 1.8 1998-02-11 11:53:35 adam + * Changed code so that it compiles as C++. + * + * Revision 1.7 1997/09/17 12:10:34 adam * YAZ version 1.4. * * Revision 1.6 1997/09/05 09:50:56 adam @@ -69,7 +72,7 @@ data1_attset *data1_read_attset(data1_handle dh, char *file) return 0; } - res = nmem_malloc(mem, sizeof(*res)); + res = (data1_attset *)nmem_malloc(mem, sizeof(*res)); res->name = 0; res->reference = VAL_NONE; res->ordinal = -1; @@ -110,7 +113,7 @@ data1_attset *data1_read_attset(data1_handle dh, char *file) } if (rr < 3) /* no local attributes given */ { - locals = nmem_malloc(mem, sizeof(*locals)); + locals = (data1_local_attribute *)nmem_malloc(mem, sizeof(*locals)); locals->local = num; locals->next = 0; } @@ -120,14 +123,14 @@ data1_attset *data1_read_attset(data1_handle dh, char *file) data1_local_attribute **ap = &locals; do { - *ap = nmem_malloc(mem, sizeof(**ap)); + *ap = (data1_local_attribute *)nmem_malloc(mem, sizeof(**ap)); (*ap)->local = atoi(p); (*ap)->next = 0; ap = &(*ap)->next; } while ((p = strchr(p, ',')) && *(++p)); } - t = *attp = nmem_malloc(mem, sizeof(*t)); + t = *attp = (data1_att *)nmem_malloc(mem, sizeof(*t)); t->parent = res; t->name = nmem_strdup(mem, name); t->value = num; diff --git a/retrieval/d1_espec.c b/retrieval/d1_espec.c index 5fffb64..932ee64 100644 --- a/retrieval/d1_espec.c +++ b/retrieval/d1_espec.c @@ -4,7 +4,10 @@ * Sebastian Hammer, Adam Dickmeiss * * $Log: d1_espec.c,v $ - * Revision 1.13 1997-11-24 11:33:56 adam + * Revision 1.14 1998-02-11 11:53:35 adam + * Changed code so that it compiles as C++. + * + * Revision 1.13 1997/11/24 11:33:56 adam * Using function odr_nullval() instead of global ODR_NULLVAL when * appropriate. * @@ -64,7 +67,7 @@ static Z_Variant *read_variant(int argc, char **argv, NMEM nmem) { - Z_Variant *r = nmem_malloc(nmem, sizeof(*r)); + Z_Variant *r = (Z_Variant *)nmem_malloc(nmem, sizeof(*r)); oident var1; int i; int oid[OID_SIZE]; @@ -75,7 +78,7 @@ static Z_Variant *read_variant(int argc, char **argv, NMEM nmem) r->globalVariantSetId = odr_oiddup_nmem(nmem, oid_ent_to_oid(&var1, oid)); if (argc) - r->triples = nmem_malloc(nmem, sizeof(Z_Triple*) * argc); + r->triples = (Z_Triple **)nmem_malloc(nmem, sizeof(Z_Triple*) * argc); else r->triples = 0; r->num_triples = argc; @@ -91,11 +94,11 @@ static Z_Variant *read_variant(int argc, char **argv, NMEM nmem) argv[i]); return 0; } - t = r->triples[i] = nmem_malloc(nmem, sizeof(Z_Triple)); + t = r->triples[i] = (Z_Triple *)nmem_malloc(nmem, sizeof(Z_Triple)); t->variantSetId = 0; - t->zclass = nmem_malloc(nmem, sizeof(int)); + t->zclass = (int *)nmem_malloc(nmem, sizeof(int)); *t->zclass = zclass; - t->type = nmem_malloc(nmem, sizeof(int)); + t->type = (int *)nmem_malloc(nmem, sizeof(int)); *t->type = type; /* * This is wrong.. we gotta look up the correct type for the @@ -109,13 +112,13 @@ static Z_Variant *read_variant(int argc, char **argv, NMEM nmem) else if (isdigit(*value)) { t->which = Z_Triple_integer; - t->value.integer = nmem_malloc(nmem, sizeof(*t->value.integer)); + t->value.integer = (int *)nmem_malloc(nmem, sizeof(*t->value.integer)); *t->value.integer = atoi(value); } else { t->which = Z_Triple_internationalString; - t->value.internationalString = nmem_malloc(nmem, strlen(value)+1); + t->value.internationalString = (char *)nmem_malloc(nmem, strlen(value)+1); strcpy(t->value.internationalString, value); } } @@ -124,14 +127,14 @@ static Z_Variant *read_variant(int argc, char **argv, NMEM nmem) static Z_Occurrences *read_occurrences(char *occ, NMEM nmem) { - Z_Occurrences *op = nmem_malloc(nmem, sizeof(*op)); + Z_Occurrences *op = (Z_Occurrences *)nmem_malloc(nmem, sizeof(*op)); char *p; if (!occ) { op->which = Z_Occurrences_values; - op->u.values = nmem_malloc(nmem, sizeof(Z_OccurValues)); - op->u.values->start = nmem_malloc(nmem, sizeof(int)); + op->u.values = (Z_OccurValues *)nmem_malloc(nmem, sizeof(Z_OccurValues)); + op->u.values->start = (int *)nmem_malloc(nmem, sizeof(int)); *op->u.values->start = 1; op->u.values->howMany = 0; } @@ -147,7 +150,7 @@ static Z_Occurrences *read_occurrences(char *occ, NMEM nmem) } else { - Z_OccurValues *ov = nmem_malloc(nmem, sizeof(*ov)); + Z_OccurValues *ov = (Z_OccurValues *)nmem_malloc(nmem, sizeof(*ov)); if (!isdigit(*occ)) { @@ -156,11 +159,11 @@ static Z_Occurrences *read_occurrences(char *occ, NMEM nmem) } op->which = Z_Occurrences_values; op->u.values = ov; - ov->start = nmem_malloc(nmem, sizeof(*ov->start)); + ov->start = (int *)nmem_malloc(nmem, sizeof(*ov->start)); *ov->start = atoi(occ); if ((p = strchr(occ, '+'))) { - ov->howMany = nmem_malloc(nmem, sizeof(*ov->howMany)); + ov->howMany = (int *)nmem_malloc(nmem, sizeof(*ov->howMany)); *ov->howMany = atoi(p + 1); } else @@ -172,7 +175,7 @@ static Z_Occurrences *read_occurrences(char *occ, NMEM nmem) static Z_ETagUnit *read_tagunit(char *buf, NMEM nmem) { - Z_ETagUnit *u = nmem_malloc(nmem, sizeof(*u)); + Z_ETagUnit *u = (Z_ETagUnit *)nmem_malloc(nmem, sizeof(*u)); int terms; int type; char value[512], occ[512]; @@ -204,20 +207,20 @@ static Z_ETagUnit *read_tagunit(char *buf, NMEM nmem) force_string = 1; } u->which = Z_ETagUnit_specificTag; - u->u.specificTag = t = nmem_malloc(nmem, sizeof(*t)); - t->tagType = nmem_malloc(nmem, sizeof(*t->tagType)); + u->u.specificTag = t = (Z_SpecificTag *)nmem_malloc(nmem, sizeof(*t)); + t->tagType = (int *)nmem_malloc(nmem, sizeof(*t->tagType)); *t->tagType = type; - t->tagValue = nmem_malloc(nmem, sizeof(*t->tagValue)); + t->tagValue = (Z_StringOrNumeric *)nmem_malloc(nmem, sizeof(*t->tagValue)); if (!force_string && (numval = atoi(valp))) { t->tagValue->which = Z_StringOrNumeric_numeric; - t->tagValue->u.numeric = nmem_malloc(nmem, sizeof(int)); + t->tagValue->u.numeric = (int *)nmem_malloc(nmem, sizeof(int)); *t->tagValue->u.numeric = numval; } else { t->tagValue->which = Z_StringOrNumeric_string; - t->tagValue->u.string = nmem_malloc(nmem, strlen(valp)+1); + t->tagValue->u.string = (char *)nmem_malloc(nmem, strlen(valp)+1); strcpy(t->tagValue->u.string, valp); } if (terms > 2) /* an occurrences-spec exists */ @@ -238,7 +241,7 @@ Z_Espec1 *data1_read_espec1 (data1_handle dh, const char *file) NMEM nmem = data1_nmem_get (dh); int argc, size_esn = 0; char *argv[50], line[512]; - Z_Espec1 *res = nmem_malloc(nmem, sizeof(*res)); + Z_Espec1 *res = (Z_Espec1 *)nmem_malloc(nmem, sizeof(*res)); if (!(f = yaz_path_fopen(data1_get_tabpath(dh), file, "r"))) { @@ -266,10 +269,10 @@ Z_Espec1 *data1_read_espec1 (data1_handle dh, const char *file) continue; } - res->elementSetNames = nmem_malloc(nmem, sizeof(char**)*nnames); + res->elementSetNames = (char **)nmem_malloc(nmem, sizeof(char**)*nnames); for (i = 0; i < nnames; i++) { - res->elementSetNames[i] = nmem_malloc(nmem, + res->elementSetNames[i] = (char *)nmem_malloc(nmem, strlen(argv[i+1])+1); strcpy(res->elementSetNames[i], argv[i+1]); } @@ -291,7 +294,7 @@ Z_Espec1 *data1_read_espec1 (data1_handle dh, const char *file) logf(LOG_WARN, "%s: Bad defaulttagtype directive", file); continue; } - res->defaultTagType = nmem_malloc(nmem, sizeof(int)); + res->defaultTagType = (int *)nmem_malloc(nmem, sizeof(int)); *res->defaultTagType = atoi(argv[1]); } else if (!strcmp(argv[0], "defaultvariantrequest")) @@ -313,12 +316,12 @@ Z_Espec1 *data1_read_espec1 (data1_handle dh, const char *file) int num, i = 0; if (!res->elements) - res->elements = nmem_malloc(nmem, size_esn = 24*sizeof(er)); + res->elements = (Z_ElementRequest **)nmem_malloc(nmem, size_esn = 24*sizeof(er)); else if (res->num_elements >= (int) (size_esn/sizeof(er))) { Z_ElementRequest **oe = res->elements; size_esn *= 2; - res->elements = nmem_malloc (nmem, size_esn*sizeof(er)); + res->elements = (Z_ElementRequest **)nmem_malloc (nmem, size_esn*sizeof(er)); memcpy (res->elements, oe, size_esn/2); } if (argc < 2) @@ -328,18 +331,18 @@ Z_Espec1 *data1_read_espec1 (data1_handle dh, const char *file) } res->elements[res->num_elements++] = er = - nmem_malloc(nmem, sizeof(*er)); + (Z_ElementRequest *)nmem_malloc(nmem, sizeof(*er)); er->which = Z_ERequest_simpleElement; - er->u.simpleElement = se = nmem_malloc(nmem, sizeof(*se)); + er->u.simpleElement = se = (Z_SimpleElement *)nmem_malloc(nmem, sizeof(*se)); se->variantRequest = 0; - se->path = tp = nmem_malloc(nmem, sizeof(*tp)); + se->path = tp = (Z_ETagPath *)nmem_malloc(nmem, sizeof(*tp)); tp->num_tags = 0; /* * Parse the element selector. */ for (num = 1, ep = path; (ep = strchr(ep, '/')); num++, ep++) ; - tp->tags = nmem_malloc(nmem, sizeof(Z_ETagUnit*)*num); + tp->tags = (Z_ETagUnit **)nmem_malloc(nmem, sizeof(Z_ETagUnit*)*num); for ((ep = strchr(path, '/')) ; path ; (void)((path = ep) && (ep = strchr(path, '/')))) diff --git a/retrieval/d1_expout.c b/retrieval/d1_expout.c index 4a45d0f..8a1fa9d 100644 --- a/retrieval/d1_expout.c +++ b/retrieval/d1_expout.c @@ -4,7 +4,10 @@ * Sebastian Hammer, Adam Dickmeiss * * $Log: d1_expout.c,v $ - * Revision 1.7 1997-12-09 16:18:16 adam + * Revision 1.8 1998-02-11 11:53:35 adam + * Changed code so that it compiles as C++. + * + * Revision 1.7 1997/12/09 16:18:16 adam * Work on EXPLAIN schema. First implementation of sub-schema facility * in the *.abs files. * @@ -84,7 +87,7 @@ static int *f_integer(ExpHandle *eh, data1_node *c) c = c->child; if (!is_data_tag (eh, c) || c->u.data.len > 63) return 0; - r = odr_malloc(eh->o, sizeof(*r)); + r = (int *)odr_malloc(eh->o, sizeof(*r)); sprintf(intbuf, "%.*s", 63, c->u.data.data); *r = atoi(intbuf); return r; @@ -97,7 +100,7 @@ static char *f_string(ExpHandle *eh, data1_node *c) c = c->child; if (!is_data_tag (eh, c)) return 0; - r = odr_malloc(eh->o, c->u.data.len+1); + r = (char *)odr_malloc(eh->o, c->u.data.len+1); memcpy(r, c->u.data.data, c->u.data.len); r[c->u.data.len] = '\0'; return r; @@ -111,7 +114,7 @@ static bool_t *f_bool(ExpHandle *eh, data1_node *c) c = c->child; if (!is_data_tag (eh, c) || c->u.data.len > 63) return 0; - tf = odr_malloc (eh->o, sizeof(*tf)); + tf = (int *)odr_malloc (eh->o, sizeof(*tf)); sprintf(intbuf, "%.*s", c->u.data.len, c->u.data.data); *tf = atoi(intbuf); return tf; @@ -157,12 +160,12 @@ static Z_HumanString *f_humstring(ExpHandle *eh, data1_node *c) c = c->child; if (!is_data_tag (eh, c)) return 0; - r = odr_malloc(eh->o, sizeof(*r)); + r = (Z_HumanString *)odr_malloc(eh->o, sizeof(*r)); r->num_strings = 1; - r->strings = odr_malloc(eh->o, sizeof(Z_HumanStringUnit*)); - r->strings[0] = u = odr_malloc(eh->o, sizeof(*u)); + r->strings = (Z_HumanStringUnit **)odr_malloc(eh->o, sizeof(Z_HumanStringUnit*)); + r->strings[0] = u = (Z_HumanStringUnit *)odr_malloc(eh->o, sizeof(*u)); u->language = 0; - u->text = odr_malloc(eh->o, c->u.data.len+1); + u->text = (char *)odr_malloc(eh->o, c->u.data.len+1); memcpy(u->text, c->u.data.data, c->u.data.len); u->text[c->u.data.len] = '\0'; return r; @@ -170,7 +173,7 @@ static Z_HumanString *f_humstring(ExpHandle *eh, data1_node *c) static Z_CommonInfo *f_commonInfo(ExpHandle *eh, data1_node *n) { - Z_CommonInfo *res = odr_malloc(eh->o, sizeof(*res)); + Z_CommonInfo *res = (Z_CommonInfo *)odr_malloc(eh->o, sizeof(*res)); data1_node *c; res->dateAdded = 0; @@ -213,7 +216,7 @@ Odr_oid **f_oid_seq (ExpHandle *eh, data1_node *n, int *num, oid_class oclass) } if (!*num) return NULL; - res = odr_malloc (eh->o, sizeof(*res) * (*num)); + res = (int **)odr_malloc (eh->o, sizeof(*res) * (*num)); for (c = n->child, i = 0 ; c; c = c->next) { if (is_numeric_tag (eh, c) != 1000) @@ -238,7 +241,7 @@ char **f_string_seq (ExpHandle *eh, data1_node *n, int *num) } if (!*num) return NULL; - res = odr_malloc (eh->o, sizeof(*res) * (*num)); + res = (char **)odr_malloc (eh->o, sizeof(*res) * (*num)); for (c = n->child, i = 0 ; c; c = c->next) { if (!is_numeric_tag (eh, c) != 1001) @@ -257,7 +260,7 @@ char **f_humstring_seq (ExpHandle *eh, data1_node *n, int *num) Z_RpnCapabilities *f_rpnCapabilities (ExpHandle *eh, data1_node *c) { - Z_RpnCapabilities *res = odr_malloc (eh->o, sizeof(*res)); + Z_RpnCapabilities *res = (Z_RpnCapabilities *)odr_malloc (eh->o, sizeof(*res)); res->num_operators = 0; res->operators = NULL; @@ -285,13 +288,13 @@ Z_QueryTypeDetails **f_queryTypesSupported (ExpHandle *eh, data1_node *c, } if (!*num) return NULL; - res = odr_malloc (eh->o, *num * sizeof(*res)); + res = (Z_QueryTypeDetails **)odr_malloc (eh->o, *num * sizeof(*res)); i = 0; for (n = c->child; n; n = n->next) { if (is_numeric_tag(eh, n) == 519) { - res[i] = odr_malloc (eh->o, sizeof(**res)); + res[i] = (Z_QueryTypeDetails *)odr_malloc (eh->o, sizeof(**res)); res[i]->which = Z_QueryTypeDetails_rpn; res[i]->u.rpn = f_rpnCapabilities (eh, n); i++; @@ -305,7 +308,7 @@ Z_QueryTypeDetails **f_queryTypesSupported (ExpHandle *eh, data1_node *c, static Z_AccessInfo *f_accessInfo(ExpHandle *eh, data1_node *n) { - Z_AccessInfo *res = odr_malloc(eh->o, sizeof(*res)); + Z_AccessInfo *res = (Z_AccessInfo *)odr_malloc(eh->o, sizeof(*res)); data1_node *c; res->num_queryTypesSupported = 0; @@ -377,7 +380,7 @@ static Z_AccessInfo *f_accessInfo(ExpHandle *eh, data1_node *n) static int *f_recordCount(ExpHandle *eh, data1_node *c, int *which) { - int *r= odr_malloc(eh->o, sizeof(*r)); + int *r= (int *)odr_malloc(eh->o, sizeof(*r)); int *wp = which; char intbuf[64]; @@ -418,10 +421,10 @@ static Z_DatabaseList *f_databaseList(ExpHandle *eh, data1_node *n) if (!i) return NULL; - res = odr_malloc (eh->o, sizeof(*res)); + res = (Z_DatabaseList *)odr_malloc (eh->o, sizeof(*res)); res->num_databases = i; - res->databases = odr_malloc (eh->o, sizeof(*res->databases) * i); + res->databases = (char **)odr_malloc (eh->o, sizeof(*res->databases) * i); i = 0; for (c = n->child; c; c = c->next) { @@ -434,7 +437,7 @@ static Z_DatabaseList *f_databaseList(ExpHandle *eh, data1_node *n) static Z_TargetInfo *f_targetInfo(ExpHandle *eh, data1_node *n) { - Z_TargetInfo *res = odr_malloc(eh->o, sizeof(*res)); + Z_TargetInfo *res = (Z_TargetInfo *)odr_malloc(eh->o, sizeof(*res)); data1_node *c; res->commonInfo = 0; @@ -492,7 +495,7 @@ static Z_TargetInfo *f_targetInfo(ExpHandle *eh, data1_node *n) } if (res->num_nicknames) res->nicknames = - odr_malloc (eh->o, res->num_nicknames + (char **)odr_malloc (eh->o, res->num_nicknames * sizeof(*res->nicknames)); for (n = c->child; n; n = n->next) { @@ -514,7 +517,7 @@ static Z_TargetInfo *f_targetInfo(ExpHandle *eh, data1_node *n) } if (res->num_dbCombinations) res->dbCombinations = - odr_malloc (eh->o, res->num_dbCombinations + (Z_DatabaseList **)odr_malloc (eh->o, res->num_dbCombinations * sizeof(*res->dbCombinations)); for (n = c->child; n; n = n->next) { @@ -536,7 +539,7 @@ static Z_TargetInfo *f_targetInfo(ExpHandle *eh, data1_node *n) static Z_DatabaseInfo *f_databaseInfo(ExpHandle *eh, data1_node *n) { - Z_DatabaseInfo *res = odr_malloc(eh->o, sizeof(*res)); + Z_DatabaseInfo *res = (Z_DatabaseInfo *)odr_malloc(eh->o, sizeof(*res)); data1_node *c; res->commonInfo = 0; @@ -592,7 +595,7 @@ static Z_DatabaseInfo *f_databaseInfo(ExpHandle *eh, data1_node *n) } if (res->num_nicknames) res->nicknames = - odr_malloc (eh->o, res->num_nicknames + (char **)odr_malloc (eh->o, res->num_nicknames * sizeof(*res->nicknames)); for (n = c->child; n; n = n->next) { @@ -616,7 +619,7 @@ static Z_DatabaseInfo *f_databaseInfo(ExpHandle *eh, data1_node *n) } if (res->num_keywords) res->keywords = - odr_malloc (eh->o, res->num_keywords + (Z_HumanString **)odr_malloc (eh->o, res->num_keywords * sizeof(*res->keywords)); for (n = c->child; n; n = n->next) { @@ -664,14 +667,14 @@ Z_ExplainRecord *data1_nodetoexplain (data1_handle dh, data1_node *n, int select, ODR o) { ExpHandle eh; - Z_ExplainRecord *res = odr_malloc(o, sizeof(*res)); + Z_ExplainRecord *res = (Z_ExplainRecord *)odr_malloc(o, sizeof(*res)); eh.dh = dh; eh.select = select; eh.o = o; - eh.false_value = odr_malloc(eh.o, sizeof(eh.false_value)); + eh.false_value = (int *)odr_malloc(eh.o, sizeof(eh.false_value)); *eh.false_value = 0; - eh.true_value = odr_malloc(eh.o, sizeof(eh.true_value)); + eh.true_value = (int *)odr_malloc(eh.o, sizeof(eh.true_value)); *eh.true_value = 1; assert(n->which == DATA1N_root); diff --git a/retrieval/d1_grs.c b/retrieval/d1_grs.c index d488949..d17ca3c 100644 --- a/retrieval/d1_grs.c +++ b/retrieval/d1_grs.c @@ -4,7 +4,10 @@ * Sebastian Hammer, Adam Dickmeiss * * $Log: d1_grs.c,v $ - * Revision 1.12 1997-11-24 11:33:56 adam + * Revision 1.13 1998-02-11 11:53:35 adam + * Changed code so that it compiles as C++. + * + * Revision 1.12 1997/11/24 11:33:56 adam * Using function odr_nullval() instead of global ODR_NULLVAL when * appropriate. * @@ -57,7 +60,7 @@ static Z_ElementMetaData *get_ElementMetaData(ODR o) { - Z_ElementMetaData *r = odr_malloc(o, sizeof(*r)); + Z_ElementMetaData *r = (Z_ElementMetaData *)odr_malloc(o, sizeof(*r)); r->seriesOrder = 0; r->usageRight = 0; @@ -83,12 +86,12 @@ static Z_ElementMetaData *get_ElementMetaData(ODR o) */ static Z_Variant *make_variant(data1_node *n, int num, ODR o) { - Z_Variant *v = odr_malloc(o, sizeof(*v)); + Z_Variant *v = (Z_Variant *)odr_malloc(o, sizeof(*v)); data1_node *p; v->globalVariantSetId = 0; v->num_triples = num; - v->triples = odr_malloc(o, sizeof(Z_Triple*) * num); + v->triples = (Z_Triple **)odr_malloc(o, sizeof(Z_Triple*) * num); /* * cycle back up through the tree of variants @@ -99,18 +102,18 @@ static Z_Variant *make_variant(data1_node *n, int num, ODR o) Z_Triple *t; assert(p->which == DATA1N_variant); - t = v->triples[num] = odr_malloc(o, sizeof(*t)); + t = v->triples[num] = (Z_Triple *)odr_malloc(o, sizeof(*t)); t->variantSetId = 0; - t->zclass = odr_malloc(o, sizeof(int)); + t->zclass = (int *)odr_malloc(o, sizeof(int)); *t->zclass = p->u.variant.type->zclass->zclass; - t->type = odr_malloc(o, sizeof(int)); + t->type = (int *)odr_malloc(o, sizeof(int)); *t->type = p->u.variant.type->type; switch (p->u.variant.type->datatype) { case DATA1K_string: t->which = Z_Triple_internationalString; - t->value.internationalString = odr_malloc(o, + t->value.internationalString = (char *)odr_malloc(o, strlen(p->u.variant.value)+1); strcpy(t->value.internationalString, p->u.variant.value); break; @@ -135,7 +138,7 @@ static int traverse_triples(data1_node *n, int level, Z_ElementMetaData *m, if (c->which == DATA1N_data && level) { if (!m->supportedVariants) - m->supportedVariants = odr_malloc(o, sizeof(Z_Variant*) * + m->supportedVariants = (Z_Variant **)odr_malloc(o, sizeof(Z_Variant*) * D1_VARIANTARRAY); else if (m->num_supportedVariants >= D1_VARIANTARRAY) { @@ -158,7 +161,7 @@ static Z_ElementData *nodetoelementdata(data1_handle dh, data1_node *n, int select, int leaf, ODR o, int *len) { - Z_ElementData *res = odr_malloc(o, sizeof(*res)); + Z_ElementData *res = (Z_ElementData *)odr_malloc(o, sizeof(*res)); if (!n) { @@ -178,7 +181,7 @@ static Z_ElementData *nodetoelementdata(data1_handle dh, data1_node *n, { case DATA1I_num: res->which = Z_ElementData_numeric; - res->u.numeric = odr_malloc(o, sizeof(int)); + res->u.numeric = (int *)odr_malloc(o, sizeof(int)); *res->u.numeric = atoi(n->u.data.data); *len += 4; break; @@ -187,7 +190,7 @@ static Z_ElementData *nodetoelementdata(data1_handle dh, data1_node *n, if (p->u.tag.get_bytes > 0 && p->u.tag.get_bytes < toget) toget = p->u.tag.get_bytes; res->which = Z_ElementData_string; - res->u.string = odr_malloc(o, toget+1); + res->u.string = (char *)odr_malloc(o, toget+1); memcpy(res->u.string, n->u.data.data, toget); res->u.string[toget] = '\0'; *len += toget; @@ -217,7 +220,7 @@ static Z_TaggedElement *nodetotaggedelement(data1_handle dh, data1_node *n, int select, ODR o, int *len) { - Z_TaggedElement *res = odr_malloc(o, sizeof(*res)); + Z_TaggedElement *res = (Z_TaggedElement *)odr_malloc(o, sizeof(*res)); data1_tag *tag = 0; data1_node *data; int leaf; @@ -250,13 +253,13 @@ static Z_TaggedElement *nodetotaggedelement(data1_handle dh, data1_node *n, return 0; } - res->tagType = odr_malloc(o, sizeof(int)); + res->tagType = (int *)odr_malloc(o, sizeof(int)); *res->tagType = (tag && tag->tagset) ? tag->tagset->type : 3; - res->tagValue = odr_malloc(o, sizeof(Z_StringOrNumeric)); + res->tagValue = (Z_StringOrNumeric *)odr_malloc(o, sizeof(Z_StringOrNumeric)); if (tag && tag->which == DATA1T_numeric) { res->tagValue->which = Z_StringOrNumeric_numeric; - res->tagValue->u.numeric = odr_malloc(o, sizeof(int)); + res->tagValue->u.numeric = (int *)odr_malloc(o, sizeof(int)); *res->tagValue->u.numeric = tag->value.numeric; } else @@ -269,7 +272,7 @@ static Z_TaggedElement *nodetotaggedelement(data1_handle dh, data1_node *n, tagstr = n->u.tag.tag; res->tagValue->which = Z_StringOrNumeric_string; - res->tagValue->u.string = odr_malloc(o, strlen(tagstr)+1); + res->tagValue->u.string = (char *)odr_malloc(o, strlen(tagstr)+1); strcpy(res->tagValue->u.string, tagstr); } res->tagOccurrence = 0; @@ -294,7 +297,7 @@ static Z_TaggedElement *nodetotaggedelement(data1_handle dh, data1_node *n, } if (n->which == DATA1N_tag && n->u.tag.no_data_requested) { - res->content = odr_malloc(o, sizeof(*res->content)); + res->content = (Z_ElementData *)odr_malloc(o, sizeof(*res->content)); res->content->which = Z_ElementData_noDataRequested; res->content->u.noDataRequested = odr_nullval(); } @@ -308,14 +311,14 @@ static Z_TaggedElement *nodetotaggedelement(data1_handle dh, data1_node *n, Z_GenericRecord *data1_nodetogr(data1_handle dh, data1_node *n, int select, ODR o, int *len) { - Z_GenericRecord *res = odr_malloc(o, sizeof(*res)); + Z_GenericRecord *res = (Z_GenericRecord *)odr_malloc(o, sizeof(*res)); data1_node *c; int num_children = 0; for (c = n->child; c; c = c->next) num_children++; - res->elements = odr_malloc(o, sizeof(Z_TaggedElement *) * num_children); + res->elements = (Z_TaggedElement **)odr_malloc(o, sizeof(Z_TaggedElement *) * num_children); res->num_elements = 0; for (c = n->child; c; c = c->next) { diff --git a/retrieval/d1_handle.c b/retrieval/d1_handle.c index 062b4ad..0c1fef1 100644 --- a/retrieval/d1_handle.c +++ b/retrieval/d1_handle.c @@ -4,7 +4,10 @@ * Sebastian Hammer, Adam Dickmeiss * * $Log: d1_handle.c,v $ - * Revision 1.2 1997-09-30 11:50:04 adam + * Revision 1.3 1998-02-11 11:53:35 adam + * Changed code so that it compiles as C++. + * + * Revision 1.2 1997/09/30 11:50:04 adam * Added handler data1_get_map_buf that is used by data1_nodetomarc. * * Revision 1.1 1997/09/17 12:28:24 adam @@ -35,7 +38,7 @@ struct data1_handle_info { data1_handle data1_create (void) { - data1_handle p = xmalloc (sizeof(*p)); + data1_handle p = (data1_handle)xmalloc (sizeof(*p)); if (!p) return NULL; p->tab_path = NULL; @@ -103,7 +106,7 @@ void data1_set_tabpath (data1_handle dp, const char *p) } if (p) { - dp->tab_path = xmalloc (strlen(p)+1); + dp->tab_path = (char *)xmalloc (strlen(p)+1); strcpy (dp->tab_path, p); } } diff --git a/retrieval/d1_map.c b/retrieval/d1_map.c index c0d8d92..4c8c6a8 100644 --- a/retrieval/d1_map.c +++ b/retrieval/d1_map.c @@ -4,7 +4,10 @@ * Sebastian Hammer, Adam Dickmeiss * * $Log: d1_map.c,v $ - * Revision 1.12 1997-11-18 09:51:09 adam + * Revision 1.13 1998-02-11 11:53:35 adam + * Changed code so that it compiles as C++. + * + * Revision 1.12 1997/11/18 09:51:09 adam * Removed element num_children from data1_node. Minor changes in * data1 to Explain. * @@ -61,7 +64,7 @@ data1_maptab *data1_read_maptab (data1_handle dh, const char *file) { NMEM mem = data1_nmem_get (dh); - data1_maptab *res = nmem_malloc(mem, sizeof(*res)); + data1_maptab *res = (data1_maptab *)nmem_malloc(mem, sizeof(*res)); FILE *f; int argc; char *argv[50], line[512]; @@ -103,7 +106,7 @@ data1_maptab *data1_read_maptab (data1_handle dh, const char *file) file); continue; } - res->target_absyn_name = nmem_malloc(mem, strlen(argv[1])+1); + res->target_absyn_name = (char *)nmem_malloc(mem, strlen(argv[1])+1); strcpy(res->target_absyn_name, argv[1]); } else if (!yaz_matchstr(argv[0], "localnumeric")) @@ -116,7 +119,7 @@ data1_maptab *data1_read_maptab (data1_handle dh, const char *file) file); continue; } - res->name = nmem_malloc(mem, strlen(argv[1])+1); + res->name = (char *)nmem_malloc(mem, strlen(argv[1])+1); strcpy(res->name, argv[1]); } else if (!strcmp(argv[0], "map")) @@ -130,13 +133,13 @@ data1_maptab *data1_read_maptab (data1_handle dh, const char *file) file); continue; } - *mapp = nmem_malloc(mem, sizeof(**mapp)); + *mapp = (data1_mapunit *)nmem_malloc(mem, sizeof(**mapp)); (*mapp)->next = 0; if (argc > 3 && !data1_matchstr(argv[3], "nodata")) (*mapp)->no_data = 1; else (*mapp)->no_data = 0; - (*mapp)->source_element_name = nmem_malloc(mem, strlen(argv[1])+1); + (*mapp)->source_element_name = (char *)nmem_malloc(mem, strlen(argv[1])+1); strcpy((*mapp)->source_element_name, argv[1]); mtp = &(*mapp)->target_path; if (*path == '/') @@ -157,7 +160,7 @@ data1_maptab *data1_read_maptab (data1_handle dh, const char *file) fclose(f); return 0; } - *mtp = nmem_malloc(mem, sizeof(**mtp)); + *mtp = (data1_maptag *)nmem_malloc(mem, sizeof(**mtp)); (*mtp)->next = 0; (*mtp)->type = type; if (np > 2 && !data1_matchstr(parm, "new")) @@ -172,7 +175,7 @@ data1_maptab *data1_read_maptab (data1_handle dh, const char *file) else { (*mtp)->which = D1_MAPTAG_string; - (*mtp)->value.string = nmem_malloc(mem, strlen(valstr)+1); + (*mtp)->value.string = (char *)nmem_malloc(mem, strlen(valstr)+1); strcpy((*mtp)->value.string, valstr); } mtp = &(*mtp)->next; diff --git a/retrieval/d1_marc.c b/retrieval/d1_marc.c index dd35a5e..e2e89a5 100644 --- a/retrieval/d1_marc.c +++ b/retrieval/d1_marc.c @@ -4,7 +4,10 @@ * Sebastian Hammer, Adam Dickmeiss * * $Log: d1_marc.c,v $ - * Revision 1.10 1997-09-30 11:50:04 adam + * Revision 1.11 1998-02-11 11:53:35 adam + * Changed code so that it compiles as C++. + * + * Revision 1.10 1997/09/30 11:50:04 adam * Added handler data1_get_map_buf that is used by data1_nodetomarc. * * Revision 1.9 1997/09/24 13:35:45 adam @@ -55,7 +58,7 @@ data1_marctab *data1_read_marctab (data1_handle dh, const char *file) { FILE *f; NMEM mem = data1_nmem_get (dh); - data1_marctab *res = nmem_malloc(mem, sizeof(*res)); + data1_marctab *res = (data1_marctab *)nmem_malloc(mem, sizeof(*res)); char line[512], *argv[50]; int argc; @@ -263,9 +266,9 @@ static int nodetomarc(data1_marctab *p, data1_node *n, int selected, } if (!*buf) - *buf = xmalloc(*size = len); + *buf = (char *)xmalloc(*size = len); else if (*size <= len) - *buf = xrealloc(*buf, *size = len); + *buf = (char *)xrealloc(*buf, *size = len); op = *buf; memint (op, len, 5); diff --git a/retrieval/d1_read.c b/retrieval/d1_read.c index 7101693..fa2c3f9 100644 --- a/retrieval/d1_read.c +++ b/retrieval/d1_read.c @@ -4,7 +4,10 @@ * Sebastian Hammer, Adam Dickmeiss * * $Log: d1_read.c,v $ - * Revision 1.19 1997-12-09 16:17:09 adam + * Revision 1.20 1998-02-11 11:53:35 adam + * Changed code so that it compiles as C++. + * + * Revision 1.19 1997/12/09 16:17:09 adam * Fix bug regarding variants. Tags with prefix "var" was incorrectly * interpreted as "start of variants". Now, only "var" indicates such * start. @@ -139,7 +142,7 @@ data1_node *data1_mk_node (data1_handle dh, NMEM m) { data1_node *r; - r = nmem_malloc(m, sizeof(*r)); + r = (data1_node *)nmem_malloc(m, sizeof(*r)); r->next = r->child = r->last_child = r->parent = 0; r->destroy = 0; return r; @@ -417,11 +420,11 @@ data1_node *data1_read_record(data1_handle dh, int line = 0; if (!*buf) - *buf = xmalloc(*size = 4096); + *buf = (char *)xmalloc(*size = 4096); for (;;) { - if (rd + 4096 > *size && !(*buf =xrealloc(*buf, *size *= 2))) + if (rd + 4096 > *size && !(*buf =(char *)xrealloc(*buf, *size *= 2))) abort(); if ((res = (*rf)(fh, *buf + rd, 4096)) <= 0) { diff --git a/retrieval/d1_sumout.c b/retrieval/d1_sumout.c index 7f1eac1..2694a2e 100644 --- a/retrieval/d1_sumout.c +++ b/retrieval/d1_sumout.c @@ -4,7 +4,10 @@ * Sebastian Hammer, Adam Dickmeiss * * $Log: d1_sumout.c,v $ - * Revision 1.2 1997-09-17 12:10:38 adam + * Revision 1.3 1998-02-11 11:53:35 adam + * Changed code so that it compiles as C++. + * + * Revision 1.2 1997/09/17 12:10:38 adam * YAZ version 1.4. * * Revision 1.1 1996/06/10 08:56:03 quinn @@ -29,7 +32,7 @@ static int *f_integer(data1_node *c, ODR o) if (!c->child || c->child->which != DATA1N_data || c->child->u.data.len > 63) return 0; - r = odr_malloc(o, sizeof(*r)); + r = (int *)odr_malloc(o, sizeof(*r)); sprintf(intbuf, "%.*s", 63, c->child->u.data.data); *r = atoi(intbuf); return r; @@ -41,7 +44,7 @@ static char *f_string(data1_node *c, ODR o) if (!c->child || c->child->which != DATA1N_data) return 0; - r = odr_malloc(o, c->child->u.data.len+1); + r = (char *)odr_malloc(o, c->child->u.data.len+1); memcpy(r, c->child->u.data.data, c->child->u.data.len); r[c->child->u.data.len] = '\0'; return r; @@ -50,7 +53,7 @@ static char *f_string(data1_node *c, ODR o) Z_BriefBib *data1_nodetosummary (data1_handle dh, data1_node *n, int select, ODR o) { - Z_BriefBib *res = odr_malloc(o, sizeof(*res)); + Z_BriefBib *res = (Z_BriefBib *)odr_malloc(o, sizeof(*res)); data1_node *c; assert(n->which == DATA1N_root); diff --git a/retrieval/d1_tagset.c b/retrieval/d1_tagset.c index 00b09ad..3e04407 100644 --- a/retrieval/d1_tagset.c +++ b/retrieval/d1_tagset.c @@ -4,7 +4,10 @@ * Sebastian Hammer, Adam Dickmeiss * * $Log: d1_tagset.c,v $ - * Revision 1.6 1997-09-17 12:10:38 adam + * Revision 1.7 1998-02-11 11:53:35 adam + * Changed code so that it compiles as C++. + * + * Revision 1.6 1997/09/17 12:10:38 adam * YAZ version 1.4. * * Revision 1.5 1997/09/05 09:50:57 adam @@ -124,7 +127,7 @@ data1_tagset *data1_read_tagset (data1_handle dh, char *file) return 0; } - res = nmem_malloc(mem, sizeof(*res)); + res = (data1_tagset *)nmem_malloc(mem, sizeof(*res)); res->name = 0; res->type = 0; res->tags = 0; @@ -163,7 +166,7 @@ data1_tagset *data1_read_tagset (data1_handle dh, char *file) fclose(f); return 0; } - rr = *tagp = nmem_malloc(mem, sizeof(*rr)); + rr = *tagp = (data1_tag *)nmem_malloc(mem, sizeof(*rr)); rr->tagset = res; rr->next = 0; rr->which = DATA1T_numeric; @@ -186,7 +189,7 @@ data1_tagset *data1_read_tagset (data1_handle dh, char *file) { char *e; - *npp = nmem_malloc(mem, sizeof(**npp)); + *npp = (data1_name *)nmem_malloc(mem, sizeof(**npp)); if ((e = strchr(nm, '/'))) *(e++) = '\0'; (*npp)->name = nmem_strdup(mem, nm); diff --git a/retrieval/d1_varset.c b/retrieval/d1_varset.c index ced2c26..b43c069 100644 --- a/retrieval/d1_varset.c +++ b/retrieval/d1_varset.c @@ -4,7 +4,10 @@ * Sebastian Hammer, Adam Dickmeiss * * $Log: d1_varset.c,v $ - * Revision 1.6 1997-09-17 12:10:39 adam + * Revision 1.7 1998-02-11 11:53:35 adam + * Changed code so that it compiles as C++. + * + * Revision 1.6 1997/09/17 12:10:39 adam * YAZ version 1.4. * * Revision 1.5 1997/09/05 09:50:58 adam @@ -57,7 +60,7 @@ data1_vartype *data1_getvartypebyct (data1_handle dh, data1_varset *set, data1_varset *data1_read_varset (data1_handle dh, const char *file) { NMEM mem = data1_nmem_get (dh); - data1_varset *res = nmem_malloc(mem, sizeof(*res)); + data1_varset *res = (data1_varset *)nmem_malloc(mem, sizeof(*res)); data1_varclass **classp = &res->classes, *zclass = 0; data1_vartype **typep = 0; FILE *f; @@ -84,7 +87,7 @@ data1_varset *data1_read_varset (data1_handle dh, const char *file) fclose(f); return 0; } - *classp = r = zclass = nmem_malloc(mem, sizeof(*r)); + *classp = r = zclass = (data1_varclass *)nmem_malloc(mem, sizeof(*r)); r->set = res; r->zclass = atoi(argv[1]); r->name = nmem_strdup(mem, argv[2]); @@ -109,7 +112,7 @@ data1_varset *data1_read_varset (data1_handle dh, const char *file) fclose(f); return 0; } - *typep = r = nmem_malloc(mem, sizeof(*r)); + *typep = r = (data1_vartype *)nmem_malloc(mem, sizeof(*r)); r->name = nmem_strdup(mem, argv[2]); r->zclass = zclass; r->type = atoi(argv[1]); diff --git a/rfc1006/Makefile b/rfc1006/Makefile index d065072..5f6052b 100644 --- a/rfc1006/Makefile +++ b/rfc1006/Makefile @@ -1,7 +1,7 @@ # Copyright (C) 1994, Index Data I/S # All rights reserved. # Sebastian Hammer, Adam Dickmeiss -# $Id: Makefile,v 1.9 1996-05-22 08:35:58 adam Exp $ +# $Id: Makefile,v 1.10 1998-02-11 11:53:35 adam Exp $ SHELL=/bin/sh INCLUDE=-I../include -I. -I../../xtimosi/src @@ -45,8 +45,8 @@ depend1: depend2: $(CPP) $(INCLUDE) -M *.c >.depend -ifeq (.depend,$(wildcard .depend)) -include .depend -endif +#ifeq (.depend,$(wildcard .depend)) +#include .depend +#endif #Depend --- DOT NOT DELETE THIS LINE diff --git a/server/eventl.c b/server/eventl.c index 76a80be..f626799 100644 --- a/server/eventl.c +++ b/server/eventl.c @@ -4,7 +4,10 @@ * Sebastian Hammer, Adam Dickmeiss * * $Log: eventl.c,v $ - * Revision 1.25 1998-01-29 13:30:23 adam + * Revision 1.26 1998-02-11 11:53:35 adam + * Changed code so that it compiles as C++. + * + * Revision 1.25 1998/01/29 13:30:23 adam * Better event handle system for NT/Unix. * * Revision 1.24 1997/09/04 14:19:13 adam @@ -107,7 +110,7 @@ IOCHAN iochan_create(int fd, IOC_CALLBACK cb, int flags) { IOCHAN new_iochan; - if (!(new_iochan = xmalloc(sizeof(*new_iochan)))) + if (!(new_iochan = (IOCHAN)xmalloc(sizeof(*new_iochan)))) return 0; new_iochan->destroyed = 0; new_iochan->fd = fd; @@ -156,7 +159,7 @@ int event_loop(IOCHAN *iochans) else { /* Destroy the first member in the chain, and try again */ - association *assoc = iochan_getdata(*iochans); + association *assoc = (association *)iochan_getdata(*iochans); COMSTACK conn = assoc->client_link; cs_close(conn); diff --git a/server/requestq.c b/server/requestq.c index 9eeed20..f3eeaa4 100644 --- a/server/requestq.c +++ b/server/requestq.c @@ -4,7 +4,10 @@ * Sebastian Hammer, Adam Dickmeiss * * $Log: requestq.c,v $ - * Revision 1.5 1998-02-10 11:03:56 adam + * Revision 1.6 1998-02-11 11:53:35 adam + * Changed code so that it compiles as C++. + * + * Revision 1.5 1998/02/10 11:03:56 adam * Added support for extended handlers in backend server interface. * * Revision 1.4 1997/10/27 13:55:03 adam @@ -91,7 +94,7 @@ request *request_get(request_q *q) q->list = r->next; else { - if (!(r = xmalloc(sizeof(*r)))) + if (!(r = (request *)xmalloc(sizeof(*r)))) abort(); r->response = 0; r->size_response = 0; diff --git a/server/seshigh.c b/server/seshigh.c index 987f84c..e69a42d 100644 --- a/server/seshigh.c +++ b/server/seshigh.c @@ -4,7 +4,10 @@ * Sebastian Hammer, Adam Dickmeiss * * $Log: seshigh.c,v $ - * Revision 1.71 1998-02-10 11:03:57 adam + * Revision 1.72 1998-02-11 11:53:35 adam + * Changed code so that it compiles as C++. + * + * Revision 1.71 1998/02/10 11:03:57 adam * Added support for extended handlers in backend server interface. * * Revision 1.70 1998/01/29 13:15:35 adam @@ -302,7 +305,7 @@ association *create_association(IOCHAN channel, COMSTACK link) if (!control_block) control_block = statserv_getcontrol(); - if (!(anew = xmalloc(sizeof(*anew)))) + if (!(anew = (association *)xmalloc(sizeof(*anew)))) return 0; anew->client_chan = channel; anew->client_link = link; @@ -418,7 +421,7 @@ static void do_close(association *a, int reason, char *message) void ir_session(IOCHAN h, int event) { int res; - association *assoc = iochan_getdata(h); + association *assoc = (association *)iochan_getdata(h); COMSTACK conn = assoc->client_link; request *req; @@ -602,7 +605,7 @@ static int process_request(association *assoc, request *req) */ void backend_response(IOCHAN i, int event) { - association *assoc = iochan_getdata(i); + association *assoc = (association *)iochan_getdata(i); request *req = request_head(&assoc->incoming); Z_APDU *res; int fd; @@ -713,12 +716,12 @@ static Z_APDU *process_initRequest(association *assoc, request *reqb) } assoc->backend = binitres->handle; - if ((assoc->bend_sort = binitreq.bend_sort)) + if ((assoc->bend_sort = (int (*)())binitreq.bend_sort)) logf (LOG_DEBUG, "Sort handler installed"); - if ((assoc->bend_search = binitreq.bend_search)) + if ((assoc->bend_search = (int (*)())binitreq.bend_search)) logf (LOG_DEBUG, "Search handler installed"); - if ((assoc->bend_present = binitreq.bend_present)) - logf (LOG_DEBUG, "Present handler installed"); + if ((assoc->bend_present = (int (*)())binitreq.bend_present)) + logf (LOG_DEBUG, "Present handler installed"); resp->referenceId = req->referenceId; *options = '\0'; /* let's tell the client what we can do */ @@ -805,11 +808,11 @@ static Z_APDU *process_initRequest(association *assoc, request *reqb) static Z_Records *diagrec(association *assoc, int error, char *addinfo) { int oid[OID_SIZE]; - Z_Records *rec = odr_malloc (assoc->encode, sizeof(*rec)); + Z_Records *rec = (Z_Records *)odr_malloc (assoc->encode, sizeof(*rec)); oident bib1; - int *err = odr_malloc (assoc->encode, sizeof(*err)); - Z_DiagRec *drec = odr_malloc (assoc->encode, sizeof(*drec)); - Z_DefaultDiagFormat *dr = odr_malloc (assoc->encode, sizeof(*dr)); + int *err = (int *)odr_malloc (assoc->encode, sizeof(*err)); + Z_DiagRec *drec = (Z_DiagRec *)odr_malloc (assoc->encode, sizeof(*drec)); + Z_DefaultDiagFormat *dr = (Z_DefaultDiagFormat *)odr_malloc (assoc->encode, sizeof(*dr)); bib1.proto = assoc->proto; bib1.oclass = CLASS_DIAGSET; @@ -841,11 +844,11 @@ static Z_NamePlusRecord *surrogatediagrec(association *assoc, char *dbname, int error, char *addinfo) { int oid[OID_SIZE]; - Z_NamePlusRecord *rec = odr_malloc (assoc->encode, sizeof(*rec)); - int *err = odr_malloc (assoc->encode, sizeof(*err)); + Z_NamePlusRecord *rec = (Z_NamePlusRecord *)odr_malloc (assoc->encode, sizeof(*rec)); + int *err = (int *)odr_malloc (assoc->encode, sizeof(*err)); oident bib1; - Z_DiagRec *drec = odr_malloc (assoc->encode, sizeof(*drec)); - Z_DefaultDiagFormat *dr = odr_malloc (assoc->encode, sizeof(*dr)); + Z_DiagRec *drec = (Z_DiagRec *)odr_malloc (assoc->encode, sizeof(*drec)); + Z_DefaultDiagFormat *dr = (Z_DefaultDiagFormat *)odr_malloc (assoc->encode, sizeof(*dr)); bib1.proto = assoc->proto; bib1.oclass = CLASS_DIAGSET; @@ -872,12 +875,12 @@ static Z_NamePlusRecord *surrogatediagrec(association *assoc, char *dbname, static Z_DiagRecs *diagrecs(association *assoc, int error, char *addinfo) { int oid[OID_SIZE]; - Z_DiagRecs *recs = odr_malloc (assoc->encode, sizeof(*recs)); - int *err = odr_malloc (assoc->encode, sizeof(*err)); + Z_DiagRecs *recs = (Z_DiagRecs *)odr_malloc (assoc->encode, sizeof(*recs)); + int *err = (int *)odr_malloc (assoc->encode, sizeof(*err)); oident bib1; - Z_DiagRec **recp = odr_malloc (assoc->encode, sizeof(*recp)); - Z_DiagRec *drec = odr_malloc (assoc->encode, sizeof(*drec)); - Z_DefaultDiagFormat *rec = odr_malloc (assoc->encode, sizeof(*rec)); + Z_DiagRec **recp = (Z_DiagRec **)odr_malloc (assoc->encode, sizeof(*recp)); + Z_DiagRec *drec = (Z_DiagRec *)odr_malloc (assoc->encode, sizeof(*drec)); + Z_DefaultDiagFormat *rec = (Z_DefaultDiagFormat *)odr_malloc (assoc->encode, sizeof(*rec)); logf(LOG_DEBUG, "DiagRecs: %d -- %s", error, addinfo); bib1.proto = assoc->proto; @@ -905,9 +908,9 @@ static Z_Records *pack_records(association *a, char *setname, int start, { int oid[OID_SIZE]; int recno, total_length = 0, toget = *num, dumped_records = 0; - Z_Records *records = odr_malloc (a->encode, sizeof(*records)); - Z_NamePlusRecordList *reclist = odr_malloc (a->encode, sizeof(*reclist)); - Z_NamePlusRecord **list = odr_malloc (a->encode, sizeof(*list) * toget); + Z_Records *records = (Z_Records *)odr_malloc (a->encode, sizeof(*records)); + Z_NamePlusRecordList *reclist = (Z_NamePlusRecordList *)odr_malloc (a->encode, sizeof(*reclist)); + Z_NamePlusRecord **list = (Z_NamePlusRecord **)odr_malloc (a->encode, sizeof(*list) * toget); oident recform; records->which = Z_Records_DBOSD; @@ -993,14 +996,14 @@ static Z_Records *pack_records(association *a, char *setname, int start, continue; } } - if (!(thisrec = odr_malloc(a->encode, sizeof(*thisrec)))) + if (!(thisrec = (Z_NamePlusRecord *)odr_malloc(a->encode, sizeof(*thisrec)))) return 0; - if (!(thisrec->databaseName = odr_malloc(a->encode, + if (!(thisrec->databaseName = (char *)odr_malloc(a->encode, strlen(fres->basename) + 1))) return 0; strcpy(thisrec->databaseName, fres->basename); thisrec->which = Z_NamePlusRecord_databaseRecord; - if (!(thisrec->u.databaseRecord = thisext = odr_malloc(a->encode, + if (!(thisrec->u.databaseRecord = thisext = (Z_External *)odr_malloc(a->encode, sizeof(Z_DatabaseRecord)))) return 0; recform.proto = a->proto; @@ -1036,21 +1039,21 @@ static Z_Records *pack_records(association *a, char *setname, int start, } else if (fres->format == VAL_SUTRS) /* SUTRS is a single-ASN.1-type */ { - Odr_oct *sutrs = odr_malloc(a->encode, sizeof(*sutrs)); + Odr_oct *sutrs = (Odr_oct *)odr_malloc(a->encode, sizeof(*sutrs)); thisext->which = Z_External_sutrs; thisext->u.sutrs = sutrs; - sutrs->buf = odr_malloc(a->encode, fres->len); + sutrs->buf = (unsigned char *)odr_malloc(a->encode, fres->len); sutrs->len = sutrs->size = fres->len; memcpy(sutrs->buf, fres->record, fres->len); } else /* octet-aligned record. */ { thisext->which = Z_External_octet; - if (!(thisext->u.octet_aligned = odr_malloc(a->encode, + if (!(thisext->u.octet_aligned = (Odr_oct *)odr_malloc(a->encode, sizeof(Odr_oct)))) return 0; - if (!(thisext->u.octet_aligned->buf = odr_malloc(a->encode, + if (!(thisext->u.octet_aligned->buf = (unsigned char *)odr_malloc(a->encode, fres->len))) return 0; memcpy(thisext->u.octet_aligned->buf, fres->record, fres->len); @@ -1069,10 +1072,9 @@ static Z_APDU *process_searchRequest(association *assoc, request *reqb, int *fd) { Z_SearchRequest *req = reqb->request->u.searchRequest; - bend_search_rr *bsrr = nmem_malloc (reqb->request_mem, sizeof(*bsrr)); + bend_search_rr *bsrr = (bend_search_rr *)nmem_malloc (reqb->request_mem, sizeof(*bsrr)); logf(LOG_LOG, "Got SearchRequest."); - save_referenceId (reqb, req->referenceId); /* store ref id in request */ bsrr->fd = fd; @@ -1089,7 +1091,7 @@ static Z_APDU *process_searchRequest(association *assoc, request *reqb, bsrr->errcode = 0; bsrr->hits = 0; bsrr->errstring = NULL; - (*assoc->bend_search)(assoc->backend, bsrr); + ((int (*)(void *, bend_search_rr *))(assoc->bend_search))(assoc->backend, bsrr); if (!bsrr->request) return 0; } @@ -1126,12 +1128,12 @@ static Z_APDU *response_searchRequest(association *assoc, request *reqb, bend_search_rr *bsrt, int *fd) { Z_SearchRequest *req = reqb->request->u.searchRequest; - Z_APDU *apdu = odr_malloc (assoc->encode, sizeof(*apdu)); - Z_SearchResponse *resp = odr_malloc (assoc->encode, sizeof(*resp)); - int *nulint = odr_malloc (assoc->encode, sizeof(*nulint)); - bool_t *sr = odr_malloc (assoc->encode, sizeof(*sr)); - int *next = odr_malloc (assoc->encode, sizeof(*next)); - int *none = odr_malloc (assoc->encode, sizeof(*none)); + Z_APDU *apdu = (Z_APDU *)odr_malloc (assoc->encode, sizeof(*apdu)); + Z_SearchResponse *resp = (Z_SearchResponse *)odr_malloc (assoc->encode, sizeof(*resp)); + int *nulint = (int *)odr_malloc (assoc->encode, sizeof(*nulint)); + bool_t *sr = (bool_t *)odr_malloc (assoc->encode, sizeof(*sr)); + int *next = (int *)odr_malloc (assoc->encode, sizeof(*next)); + int *none = (int *)odr_malloc (assoc->encode, sizeof(*none)); *nulint = 0; *sr = 1; @@ -1161,8 +1163,8 @@ static Z_APDU *response_searchRequest(association *assoc, request *reqb, } else { - int *toget = odr_malloc (assoc->encode, sizeof(*toget)); - int *presst = odr_malloc (assoc->encode, sizeof(*presst)); + int *toget = (int *)odr_malloc (assoc->encode, sizeof(*toget)); + int *presst = (int *)odr_malloc (assoc->encode, sizeof(*presst)); Z_RecordComposition comp, *compp = 0; *toget = 0; @@ -1259,7 +1261,7 @@ static Z_APDU *process_presentRequest(association *assoc, request *reqb, form = prefformat->value; if (assoc->bend_present) { - bend_present_rr *bprr = nmem_malloc (reqb->request_mem, sizeof(*bprr)); + bend_present_rr *bprr = (bend_present_rr *)nmem_malloc (reqb->request_mem, sizeof(*bprr)); bprr->setname = req->resultSetId; bprr->start = *req->resultSetStartPoint; bprr->number = *req->numberOfRecordsRequested; @@ -1270,16 +1272,16 @@ static Z_APDU *process_presentRequest(association *assoc, request *reqb, bprr->association = assoc; bprr->errcode = 0; bprr->errstring = NULL; - (*assoc->bend_present)(assoc->backend, bprr); + ((int (*)(void *, bend_present_rr *))(*assoc->bend_present))(assoc->backend, bprr); if (!bprr->request) return 0; } - apdu = odr_malloc (assoc->encode, sizeof(*apdu)); - resp = odr_malloc (assoc->encode, sizeof(*resp)); - presst = odr_malloc (assoc->encode, sizeof(*presst)); - next = odr_malloc (assoc->encode, sizeof(*next)); - num = odr_malloc (assoc->encode, sizeof(*num)); + apdu = (Z_APDU *)odr_malloc (assoc->encode, sizeof(*apdu)); + resp = (Z_PresentResponse *)odr_malloc (assoc->encode, sizeof(*resp)); + presst = (int *)odr_malloc (assoc->encode, sizeof(*presst)); + next = (int *)odr_malloc (assoc->encode, sizeof(*next)); + num = (int *)odr_malloc (assoc->encode, sizeof(*num)); *presst = 0; *next = 0; *num = *req->numberOfRecordsRequested; @@ -1308,12 +1310,12 @@ static Z_APDU *process_presentRequest(association *assoc, request *reqb, static Z_APDU *process_scanRequest(association *assoc, request *reqb, int *fd) { Z_ScanRequest *req = reqb->request->u.scanRequest; - Z_APDU *apdu = odr_malloc (assoc->encode, sizeof(*apdu)); - Z_ScanResponse *res = odr_malloc (assoc->encode, sizeof(*res)); - int *scanStatus = odr_malloc (assoc->encode, sizeof(*scanStatus)); + Z_APDU *apdu = (Z_APDU *)odr_malloc (assoc->encode, sizeof(*apdu)); + Z_ScanResponse *res = (Z_ScanResponse *)odr_malloc (assoc->encode, sizeof(*res)); + int *scanStatus = (int *)odr_malloc (assoc->encode, sizeof(*scanStatus)); int *numberOfEntriesReturned = - odr_malloc (assoc->encode, sizeof(*numberOfEntriesReturned)); - Z_ListEntries *ents = odr_malloc (assoc->encode, sizeof(*ents)); + (int *)odr_malloc (assoc->encode, sizeof(*numberOfEntriesReturned)); + Z_ListEntries *ents = (Z_ListEntries *)odr_malloc (assoc->encode, sizeof(*ents)); oident *attent; bend_scanrequest srq; bend_scanresult *srs; @@ -1366,8 +1368,8 @@ static Z_APDU *process_scanRequest(association *assoc, request *reqb, int *fd) else { int i; - Z_Entries *list = odr_malloc (assoc->encode, sizeof(*list)); - Z_Entry **tab = odr_malloc (assoc->encode, + Z_Entries *list = (Z_Entries *)odr_malloc (assoc->encode, sizeof(*list)); + Z_Entry **tab = (Z_Entry **)odr_malloc (assoc->encode, sizeof(*tab) * srs->num_entries); if (srs->status == BEND_SCAN_PARTIAL) @@ -1383,20 +1385,20 @@ static Z_APDU *process_scanRequest(association *assoc, request *reqb, int *fd) Z_TermInfo *t; Odr_oct *o; - list->entries[i] = e = odr_malloc(assoc->encode, sizeof(*e)); + list->entries[i] = e = (Z_Entry *)odr_malloc(assoc->encode, sizeof(*e)); e->which = Z_Entry_termInfo; - e->u.termInfo = t = odr_malloc(assoc->encode, sizeof(*t)); + e->u.termInfo = t = (Z_TermInfo *)odr_malloc(assoc->encode, sizeof(*t)); t->suggestedAttributes = 0; t->displayTerm = 0; t->alternativeTerm = 0; t->byAttributes = 0; t->otherTermInfo = 0; t->globalOccurrences = &srs->entries[i].occurrences; - t->term = odr_malloc(assoc->encode, sizeof(*t->term)); + t->term = (Z_Term *)odr_malloc(assoc->encode, sizeof(*t->term)); t->term->which = Z_Term_general; - t->term->u.general = o = odr_malloc(assoc->encode, + t->term->u.general = o = (Odr_oct *)odr_malloc(assoc->encode, sizeof(Odr_oct)); - o->buf = odr_malloc(assoc->encode, o->len = o->size = + o->buf = (unsigned char *)odr_malloc(assoc->encode, o->len = o->size = strlen(srs->entries[i].term)); memcpy(o->buf, srs->entries[i].term, o->len); logf(LOG_DEBUG, " term #%d: '%s' (%d)", i, @@ -1415,10 +1417,10 @@ static Z_APDU *process_sortRequest(association *assoc, request *reqb, int *fd) { Z_SortRequest *req = reqb->request->u.sortRequest; - Z_SortResponse *res = odr_malloc (assoc->encode, sizeof(*res)); - bend_sort_rr *bsrr = odr_malloc (assoc->encode, sizeof(*bsrr)); + Z_SortResponse *res = (Z_SortResponse *)odr_malloc (assoc->encode, sizeof(*res)); + bend_sort_rr *bsrr = (bend_sort_rr *)odr_malloc (assoc->encode, sizeof(*bsrr)); - Z_APDU *apdu = odr_malloc (assoc->encode, sizeof(*apdu)); + Z_APDU *apdu = (Z_APDU *)odr_malloc (assoc->encode, sizeof(*apdu)); logf(LOG_LOG, "Got SortRequest."); @@ -1432,10 +1434,10 @@ static Z_APDU *process_sortRequest(association *assoc, request *reqb, bsrr->errcode = 0; bsrr->errstring = 0; - (*assoc->bend_sort)(assoc->backend, bsrr); + ((int (*)(void *, bend_sort_rr *))(*assoc->bend_sort))(assoc->backend, bsrr); res->referenceId = req->referenceId; - res->sortStatus = odr_malloc (assoc->encode, sizeof(*res->sortStatus)); + res->sortStatus = (int *)odr_malloc (assoc->encode, sizeof(*res->sortStatus)); *res->sortStatus = bsrr->sort_status; res->resultSetStatus = 0; if (bsrr->errcode) @@ -1479,7 +1481,7 @@ void save_referenceId (request *reqb, Z_ReferenceId *refid) if (refid) { reqb->len_refid = refid->len; - reqb->refid = nmem_malloc (reqb->request_mem, refid->len); + reqb->refid = (char *)nmem_malloc (reqb->request_mem, refid->len); memcpy (reqb->refid, refid->buf, refid->len); } else @@ -1506,8 +1508,8 @@ Z_ReferenceId *bend_request_getid (ODR odr, bend_request req) Z_ReferenceId *id; if (!req->refid) return 0; - id = odr_malloc (odr, sizeof(*odr)); - id->buf = odr_malloc (odr, req->len_refid); + id = (Odr_oct *)odr_malloc (odr, sizeof(*odr)); + id->buf = (unsigned char *)odr_malloc (odr, req->len_refid); id->len = id->size = req->len_refid; memcpy (id->buf, req->refid, req->len_refid); return id; diff --git a/server/session.h b/server/session.h index b5b6db2..f0f96eb 100644 --- a/server/session.h +++ b/server/session.h @@ -4,7 +4,10 @@ * Sebastian Hammer, Adam Dickmeiss * * $Log: session.h,v $ - * Revision 1.14 1998-02-10 11:03:57 adam + * Revision 1.15 1998-02-11 11:53:36 adam + * Changed code so that it compiles as C++. + * + * Revision 1.14 1998/02/10 11:03:57 adam * Added support for extended handlers in backend server interface. * * Revision 1.13 1998/01/29 13:30:23 adam @@ -62,15 +65,17 @@ #include #include "eventl.h" +typedef enum { + REQUEST_IDLE, /* the request is just sitting in the queue */ + REQUEST_PENDING /* operation pending (b'end processing or network I/O*/ + /* this list will have more elements when acc/res control is added */ +} request_state; + typedef struct request { int len_refid; /* length of referenceid */ char *refid; /* referenceid */ - enum { - REQUEST_IDLE, /* the request is just sitting in the queue */ - REQUEST_PENDING /* operation pending (b'end processing or network I/O*/ - /* this list will have more elements when acc/res control is added */ - } state; + request_state state; Z_APDU *request; /* Current request */ NMEM request_mem; /* memory handle for request */ @@ -95,6 +100,13 @@ typedef struct request_q /* * association state. */ +typedef enum +{ + ASSOC_NEW, /* not initialized yet */ + ASSOC_UP, /* normal operation */ + ASSOC_DEAD /* dead. Close if input arrives */ +} association_state; + typedef struct association { IOCHAN client_chan; /* event-loop control */ @@ -111,12 +123,7 @@ typedef struct association void *backend; /* backend handle */ request_q incoming; /* Q of incoming PDUs */ request_q outgoing; /* Q of outgoing data buffers (enc. PDUs) */ - enum - { - ASSOC_NEW, /* not initialized yet */ - ASSOC_UP, /* normal operation */ - ASSOC_DEAD /* dead. Close if input arrives */ - } state; + association_state state; /* session parameters */ int preferredMessageSize; @@ -135,6 +142,7 @@ void ir_session(IOCHAN h, int event); void request_enq(request_q *q, request *r); request *request_head(request_q *q); request *request_deq(request_q *q); +request *request_deq_x(request_q *q, request *r); void request_initq(request_q *q); void request_delq(request_q *q); request *request_get(request_q *q); diff --git a/server/statserv.c b/server/statserv.c index b514f29..ac1940b 100644 --- a/server/statserv.c +++ b/server/statserv.c @@ -7,7 +7,10 @@ * Chas Woodfield, Fretwell Downing Datasystems. * * $Log: statserv.c,v $ - * Revision 1.47 1998-02-10 10:28:57 adam + * Revision 1.48 1998-02-11 11:53:36 adam + * Changed code so that it compiles as C++. + * + * Revision 1.47 1998/02/10 10:28:57 adam * Added app_name, service_dependencies, service_display_name and * options_func. options_func allows us to specify a different function * to interogate the command line arguments. The other members allow us @@ -525,7 +528,7 @@ static void listener(IOCHAN h, int event) { if (pp != h) { - COMSTACK l = iochan_getdata(pp); + COMSTACK l = (COMSTACK)iochan_getdata(pp); cs_close(l); iochan_destroy(pp); } @@ -586,7 +589,7 @@ static void listener(IOCHAN h, int event) /* close our half of the listener socket */ for (pp = pListener; pp; pp = iochan_getnext(pp)) { - COMSTACK l = iochan_getdata(pp); + COMSTACK l = (COMSTACK)iochan_getdata(pp); cs_close(l); iochan_destroy(pp); } diff --git a/util/marcdump.c b/util/marcdump.c index 02507d4..e270996 100644 --- a/util/marcdump.c +++ b/util/marcdump.c @@ -4,7 +4,10 @@ * Sebastian Hammer, Adam Dickmeiss * * $Log: marcdump.c,v $ - * Revision 1.6 1997-12-12 06:32:33 adam + * Revision 1.7 1998-02-11 11:53:36 adam + * Changed code so that it compiles as C++. + * + * Revision 1.6 1997/12/12 06:32:33 adam * Added include of string.h. * * Revision 1.5 1997/09/24 13:29:40 adam @@ -77,7 +80,7 @@ int main (int argc, char **argv) prog, arg, strerror (errno)); exit (1); } - buf = xmalloc (file_size); + buf = (char *)xmalloc (file_size); if (!buf) { fprintf (stderr, "%s: cannot xmalloc: %s\n", diff --git a/util/nmem.c b/util/nmem.c index ea9a9b8..99d22cd 100644 --- a/util/nmem.c +++ b/util/nmem.c @@ -4,7 +4,10 @@ * Sebastian Hammer, Adam Dickmeiss * * $Log: nmem.c,v $ - * Revision 1.6 1997-10-31 12:20:09 adam + * Revision 1.7 1998-02-11 11:53:36 adam + * Changed code so that it compiles as C++. + * + * Revision 1.6 1997/10/31 12:20:09 adam * Improved memory debugging for xmalloc/nmem.c. References to NMEM * instead of ODR in n ESPEC-1 handling in source d1_espec.c. * Bug fix: missing fclose in data1_read_espec1. @@ -82,8 +85,8 @@ static nmem_block *get_block(int size) if (get < size) get = size; - r = xmalloc(sizeof(*r)); - r->buf = xmalloc(r->size = get); + r = (nmem_block *)xmalloc(sizeof(*r)); + r->buf = (char *)xmalloc(r->size = get); } r->top = 0; return r; @@ -148,7 +151,7 @@ NMEM nmem_create(void) if (r) cfreelist = cfreelist->next; else - r = xmalloc(sizeof(*r)); + r = (nmem_control *)xmalloc(sizeof(*r)); NMEM_LEAVE; #if NMEM_DEBUG diff --git a/util/nmemsdup.c b/util/nmemsdup.c index a17f9cf..74841d4 100644 --- a/util/nmemsdup.c +++ b/util/nmemsdup.c @@ -4,7 +4,10 @@ * Sebastian Hammer, Adam Dickmeiss * * $Log: nmemsdup.c,v $ - * Revision 1.1 1997-09-17 12:10:42 adam + * Revision 1.2 1998-02-11 11:53:36 adam + * Changed code so that it compiles as C++. + * + * Revision 1.1 1997/09/17 12:10:42 adam * YAZ version 1.4. * */ @@ -14,7 +17,7 @@ char *nmem_strdup (NMEM mem, const char *src) { - char *dst = nmem_malloc (mem, strlen(src)+1); + char *dst = (char *)nmem_malloc (mem, strlen(src)+1); strcpy (dst, src); return dst; } diff --git a/util/pquery.c b/util/pquery.c index 7b33757..2a2a126 100644 --- a/util/pquery.c +++ b/util/pquery.c @@ -4,7 +4,10 @@ * Sebastian Hammer, Adam Dickmeiss * * $Log: pquery.c,v $ - * Revision 1.17 1997-11-24 11:33:57 adam + * Revision 1.18 1998-02-11 11:53:36 adam + * Changed code so that it compiles as C++. + * + * Revision 1.17 1997/11/24 11:33:57 adam * Using function odr_nullval() instead of global ODR_NULLVAL when * appropriate. * @@ -177,9 +180,9 @@ static Z_AttributesPlusTerm *rpn_term (struct lex_info *li, ODR o, Odr_oct *term_octet; Z_Term *term; - zapt = odr_malloc (o, sizeof(*zapt)); - term_octet = odr_malloc (o, sizeof(*term_octet)); - term = odr_malloc (o, sizeof(*term)); + zapt = (Z_AttributesPlusTerm *)odr_malloc (o, sizeof(*zapt)); + term_octet = (Odr_oct *)odr_malloc (o, sizeof(*term_octet)); + term = (Z_Term *)odr_malloc (o, sizeof(*term)); zapt->num_attributes = num_attr; if (num_attr) @@ -187,15 +190,15 @@ static Z_AttributesPlusTerm *rpn_term (struct lex_info *li, ODR o, int i; int *attr_tmp; - zapt->attributeList = odr_malloc (o, num_attr * + zapt->attributeList = (Z_AttributeElement**)odr_malloc (o, num_attr * sizeof(*zapt->attributeList)); - attr_tmp = odr_malloc (o, num_attr * 2 * sizeof(int)); + attr_tmp = (int *)odr_malloc (o, num_attr * 2 * sizeof(int)); memcpy (attr_tmp, attr_list, num_attr * 2 * sizeof(int)); for (i = 0; i < num_attr; i++) { zapt->attributeList[i] = - odr_malloc (o,sizeof(**zapt->attributeList)); + (Z_AttributeElement*)odr_malloc (o,sizeof(**zapt->attributeList)); zapt->attributeList[i]->attributeType = &attr_tmp[2*i]; #ifdef Z_95 if (attr_set[i] == VAL_NONE) @@ -220,11 +223,11 @@ static Z_AttributesPlusTerm *rpn_term (struct lex_info *li, ODR o, } } else - zapt->attributeList = odr_nullval(); + zapt->attributeList = (Z_AttributeElement**)odr_nullval(); zapt->term = term; term->which = Z_Term_general; term->u.general = term_octet; - term_octet->buf = odr_malloc (o, li->lex_len); + term_octet->buf = (unsigned char *)odr_malloc (o, li->lex_len); term_octet->size = term_octet->len = li->lex_len; memcpy (term_octet->buf, li->lex_buf, li->lex_len); return zapt; @@ -236,7 +239,7 @@ static Z_Operand *rpn_simple (struct lex_info *li, ODR o, oid_proto proto, { Z_Operand *zo; - zo = odr_malloc (o, sizeof(*zo)); + zo = (Z_Operand *)odr_malloc (o, sizeof(*zo)); switch (li->query_look) { case 't': @@ -251,7 +254,7 @@ static Z_Operand *rpn_simple (struct lex_info *li, ODR o, oid_proto proto, if (!li->query_look) return NULL; zo->which = Z_Operand_resultSetId; - zo->u.resultSetId = odr_malloc (o, li->lex_len+1); + zo->u.resultSetId = (char *)odr_malloc (o, li->lex_len+1); memcpy (zo->u.resultSetId, li->lex_buf, li->lex_len); zo->u.resultSetId[li->lex_len] = '\0'; lex (li); @@ -264,18 +267,18 @@ static Z_Operand *rpn_simple (struct lex_info *li, ODR o, oid_proto proto, static Z_ProximityOperator *rpn_proximity (struct lex_info *li, ODR o) { - Z_ProximityOperator *p = odr_malloc (o, sizeof(*p)); + Z_ProximityOperator *p = (Z_ProximityOperator *)odr_malloc (o, sizeof(*p)); if (!lex (li)) return NULL; if (*li->lex_buf == '1') { - p->exclusion = odr_malloc (o, sizeof(*p->exclusion)); + p->exclusion = (int *)odr_malloc (o, sizeof(*p->exclusion)); *p->exclusion = 1; } else if (*li->lex_buf == '0') { - p->exclusion = odr_malloc (o, sizeof(*p->exclusion)); + p->exclusion = (int *)odr_malloc (o, sizeof(*p->exclusion)); *p->exclusion = 0; } else @@ -283,17 +286,17 @@ static Z_ProximityOperator *rpn_proximity (struct lex_info *li, ODR o) if (!lex (li)) return NULL; - p->distance = odr_malloc (o, sizeof(*p->distance)); + p->distance = (int *)odr_malloc (o, sizeof(*p->distance)); *p->distance = atoi (li->lex_buf); if (!lex (li)) return NULL; - p->ordered = odr_malloc (o, sizeof(*p->ordered)); + p->ordered = (int *)odr_malloc (o, sizeof(*p->ordered)); *p->ordered = atoi (li->lex_buf); if (!lex (li)) return NULL; - p->relationType = odr_malloc (o, sizeof(*p->relationType)); + p->relationType = (int *)odr_malloc (o, sizeof(*p->relationType)); *p->relationType = atoi (li->lex_buf); if (!lex (li)) @@ -307,7 +310,7 @@ static Z_ProximityOperator *rpn_proximity (struct lex_info *li, ODR o) if (!lex (li)) return NULL; - p->proximityUnitCode = odr_malloc (o, sizeof(*p->proximityUnitCode)); + p->proximityUnitCode = (int *)odr_malloc (o, sizeof(*p->proximityUnitCode)); *p->proximityUnitCode = atoi (li->lex_buf); return p; @@ -320,8 +323,8 @@ static Z_Complex *rpn_complex (struct lex_info *li, ODR o, oid_proto proto, Z_Complex *zc; Z_Operator *zo; - zc = odr_malloc (o, sizeof(*zc)); - zo = odr_malloc (o, sizeof(*zo)); + zc = (Z_Complex *)odr_malloc (o, sizeof(*zc)); + zo = (Z_Operator *)odr_malloc (o, sizeof(*zo)); zc->roperator = zo; switch (li->query_look) { @@ -366,7 +369,7 @@ static Z_RPNStructure *rpn_structure (struct lex_info *li, ODR o, Z_RPNStructure *sz; const char *cp; - sz = odr_malloc (o, sizeof(*sz)); + sz = (Z_RPNStructure *)odr_malloc (o, sizeof(*sz)); switch (li->query_look) { case 'a': @@ -452,7 +455,7 @@ Z_RPNQuery *p_query_rpn_mk (ODR o, struct lex_info *li, oid_proto proto, oident oset; int oid[OID_SIZE]; - zq = odr_malloc (o, sizeof(*zq)); + zq = (Z_RPNQuery *)odr_malloc (o, sizeof(*zq)); lex (li); if (li->query_look == 'r') { diff --git a/util/wrbuf.c b/util/wrbuf.c index a81d950..c948dc1 100644 --- a/util/wrbuf.c +++ b/util/wrbuf.c @@ -4,7 +4,10 @@ * Sebastian Hammer, Adam Dickmeiss * * $Log: wrbuf.c,v $ - * Revision 1.3 1997-05-01 15:08:15 adam + * Revision 1.4 1998-02-11 11:53:36 adam + * Changed code so that it compiles as C++. + * + * Revision 1.3 1997/05/01 15:08:15 adam * Added log_mask_str_x routine. * * Revision 1.2 1995/11/01 13:55:06 quinn @@ -29,7 +32,7 @@ WRBUF wrbuf_alloc(void) { WRBUF n; - if (!(n = xmalloc(sizeof(*n)))) + if (!(n = (WRBUF)xmalloc(sizeof(*n)))) abort(); n->buf = 0; n->size = 0; @@ -59,9 +62,9 @@ int wrbuf_grow(WRBUF b, int minsize) togrow = b->size; if (togrow < minsize) togrow = minsize; - if (b->size && !(b->buf =xrealloc(b->buf, b->size += togrow))) + if (b->size && !(b->buf =(char *)xrealloc(b->buf, b->size += togrow))) abort(); - else if (!b->size && !(b->buf = xmalloc(b->size = togrow))) + else if (!b->size && !(b->buf = (char *)xmalloc(b->size = togrow))) abort(); return 0; } diff --git a/util/xmalloc.c b/util/xmalloc.c index 8fd0132..4264b24 100644 --- a/util/xmalloc.c +++ b/util/xmalloc.c @@ -4,7 +4,10 @@ * Sebastian Hammer, Adam Dickmeiss * * $Log: xmalloc.c,v $ - * Revision 1.5 1997-10-31 12:20:09 adam + * Revision 1.6 1998-02-11 11:53:36 adam + * Changed code so that it compiles as C++. + * + * Revision 1.5 1997/10/31 12:20:09 adam * Improved memory debugging for xmalloc/nmem.c. References to NMEM * instead of ODR in n ESPEC-1 handling in source d1_espec.c. * Bug fix: missing fclose in data1_read_espec1. @@ -96,7 +99,7 @@ void *xcalloc_f (size_t nmemb, size_t size, char *file, int line) char *xstrdup_f (const char *s, char *file, int line) { - char *p = xmalloc (strlen(s)+1); + char *p = (char *)xmalloc (strlen(s)+1); #if TRACE_XMALLOC logf (LOG_DEBUG, "%s:%d: xstrdup(s=%d) %p", file, line, strlen(s)+1, p); #endif diff --git a/util/yaz-ccl.c b/util/yaz-ccl.c index 6c85642..d9de5ba 100644 --- a/util/yaz-ccl.c +++ b/util/yaz-ccl.c @@ -4,7 +4,10 @@ * Sebastian Hammer, Adam Dickmeiss * * $Log: yaz-ccl.c,v $ - * Revision 1.11 1997-11-24 11:33:57 adam + * Revision 1.12 1998-02-11 11:53:36 adam + * Changed code so that it compiles as C++. + * + * Revision 1.11 1997/11/24 11:33:57 adam * Using function odr_nullval() instead of global ODR_NULLVAL when * appropriate. * @@ -36,13 +39,13 @@ static Z_AttributesPlusTerm *ccl_rpn_term (ODR o, struct ccl_rpn_node *p) Odr_oct *term_octet; Z_Term *term; - zapt = odr_malloc (o, sizeof(*zapt)); + zapt = (Z_AttributesPlusTerm *)odr_malloc (o, sizeof(*zapt)); assert (zapt); - term_octet = odr_malloc (o, sizeof(*term_octet)); + term_octet = (Odr_oct *)odr_malloc (o, sizeof(*term_octet)); assert (term_octet); - term = odr_malloc (o, sizeof(*term)); + term = (Z_Term *)odr_malloc (o, sizeof(*term)); assert(term); for (attr = p->u.t.attr_list; attr; attr = attr->next) @@ -51,31 +54,31 @@ static Z_AttributesPlusTerm *ccl_rpn_term (ODR o, struct ccl_rpn_node *p) if (num) { int i = 0; - zapt->attributeList = odr_malloc (o, num*sizeof(*zapt->attributeList)); + zapt->attributeList = (Z_AttributeElement **)odr_malloc (o, num*sizeof(*zapt->attributeList)); assert (zapt->attributeList); for (attr = p->u.t.attr_list; attr; attr = attr->next, i++) { zapt->attributeList[i] = - odr_malloc (o, sizeof(**zapt->attributeList)); + (Z_AttributeElement *)odr_malloc (o, sizeof(**zapt->attributeList)); assert (zapt->attributeList[i]); zapt->attributeList[i]->attributeType = - odr_malloc(o, sizeof(int)); + (int *)odr_malloc(o, sizeof(int)); *zapt->attributeList[i]->attributeType = attr->type; zapt->attributeList[i]->attributeSet = 0; zapt->attributeList[i]->which = Z_AttributeValue_numeric; zapt->attributeList[i]->value.numeric = - odr_malloc (o, sizeof(int)); + (int *)odr_malloc (o, sizeof(int)); *zapt->attributeList[i]->value.numeric = attr->value; } } else - zapt->attributeList = odr_nullval(); + zapt->attributeList = (Z_AttributeElement**)odr_nullval(); zapt->term = term; term->which = Z_Term_general; term->u.general = term_octet; term_octet->len = term_octet->size = strlen (p->u.t.term); - term_octet->buf = odr_malloc (o, term_octet->len+1); + term_octet->buf = (unsigned char *)odr_malloc (o, term_octet->len+1); strcpy ((char*) term_octet->buf, p->u.t.term); return zapt; } @@ -84,7 +87,7 @@ static Z_Operand *ccl_rpn_simple (ODR o, struct ccl_rpn_node *p) { Z_Operand *zo; - zo = odr_malloc (o, sizeof(*zo)); + zo = (Z_Operand *)odr_malloc (o, sizeof(*zo)); assert (zo); switch (p->kind) @@ -108,9 +111,9 @@ static Z_Complex *ccl_rpn_complex (ODR o, struct ccl_rpn_node *p) Z_Complex *zc; Z_Operator *zo; - zc = odr_malloc (o, sizeof(*zc)); + zc = (Z_Complex *)odr_malloc (o, sizeof(*zc)); assert (zc); - zo = odr_malloc (o, sizeof(*zo)); + zo = (Z_Operator *)odr_malloc (o, sizeof(*zo)); assert (zo); zc->roperator = zo; @@ -140,7 +143,7 @@ static Z_RPNStructure *ccl_rpn_structure (ODR o, struct ccl_rpn_node *p) { Z_RPNStructure *zs; - zs = odr_malloc (o, sizeof(*zs)); + zs = (Z_RPNStructure *)odr_malloc (o, sizeof(*zs)); assert (zs); switch (p->kind) { @@ -166,7 +169,7 @@ Z_RPNQuery *ccl_rpn_query (ODR o, struct ccl_rpn_node *p) { Z_RPNQuery *zq; - zq = odr_malloc (o, sizeof(*zq)); + zq = (Z_RPNQuery *)odr_malloc (o, sizeof(*zq)); assert (zq); zq->attributeSetId = NULL; zq->RPNStructure = ccl_rpn_structure (o, p); diff --git a/ztest/read-grs.c b/ztest/read-grs.c index c847187..2b9c103 100644 --- a/ztest/read-grs.c +++ b/ztest/read-grs.c @@ -4,7 +4,10 @@ * Sebastian Hammer, Adam Dickmeiss * * $Log: read-grs.c,v $ - * Revision 1.1 1997-09-01 08:55:53 adam + * Revision 1.2 1998-02-11 11:53:36 adam + * Changed code so that it compiles as C++. + * + * Revision 1.1 1997/09/01 08:55:53 adam * New windows NT/95 port using MSV5.0. Test server ztest now in * separate directory. When using NT, this test server may operate * as an NT service. Note that the service.[ch] should be part of @@ -67,32 +70,32 @@ Z_GenericRecord *read_grs1(FILE *f, ODR o) return 0; if (!r) { - r = odr_malloc(o, sizeof(*r)); - r->elements = odr_malloc(o, sizeof(Z_TaggedElement*) * + r = (Z_GenericRecord *)odr_malloc(o, sizeof(*r)); + r->elements = (Z_TaggedElement **)odr_malloc(o, sizeof(Z_TaggedElement*) * GRS_MAX_FIELDS); r->num_elements = 0; } - r->elements[r->num_elements] = t = odr_malloc(o, + r->elements[r->num_elements] = t = (Z_TaggedElement *)odr_malloc(o, sizeof(Z_TaggedElement)); - t->tagType = odr_malloc(o, sizeof(int)); + t->tagType = (int *)odr_malloc(o, sizeof(int)); *t->tagType = type; - t->tagValue = odr_malloc(o, sizeof(Z_StringOrNumeric)); + t->tagValue = (Z_StringOrNumeric *)odr_malloc(o, sizeof(Z_StringOrNumeric)); if ((ivalue = atoi(value))) { t->tagValue->which = Z_StringOrNumeric_numeric; - t->tagValue->u.numeric = odr_malloc(o, sizeof(int)); + t->tagValue->u.numeric = (int *)odr_malloc(o, sizeof(int)); *t->tagValue->u.numeric = ivalue; } else { t->tagValue->which = Z_StringOrNumeric_string; - t->tagValue->u.string = odr_malloc(o, strlen(value)+1); + t->tagValue->u.string = (char *)odr_malloc(o, strlen(value)+1); strcpy(t->tagValue->u.string, value); } t->tagOccurrence = 0; t->metaData = 0; t->appliedVariant = 0; - t->content = c = odr_malloc(o, sizeof(Z_ElementData)); + t->content = c = (Z_ElementData *)odr_malloc(o, sizeof(Z_ElementData)); if (*buf == '{') { c->which = Z_ElementData_subtree; @@ -102,7 +105,7 @@ Z_GenericRecord *read_grs1(FILE *f, ODR o) { c->which = Z_ElementData_string; buf[strlen(buf)-1] = '\0'; - c->u.string = odr_malloc(o, strlen(buf)+1); + c->u.string = (char *)odr_malloc(o, strlen(buf)+1); strcpy(c->u.string, buf); } r->num_elements++; diff --git a/ztest/ztest.c b/ztest/ztest.c index 01f046b..c637b9e 100644 --- a/ztest/ztest.c +++ b/ztest/ztest.c @@ -7,7 +7,10 @@ * Chas Woodfield, Fretwell Downing Datasystems. * * $Log: ztest.c,v $ - * Revision 1.7 1998-02-10 11:03:57 adam + * Revision 1.8 1998-02-11 11:53:36 adam + * Changed code so that it compiles as C++. + * + * Revision 1.7 1998/02/10 11:03:57 adam * Added support for extended handlers in backend server interface. * * Revision 1.6 1998/01/29 13:16:02 adam @@ -52,7 +55,7 @@ int ztest_present (void *handle, bend_present_rr *rr); bend_initresult *bend_init(bend_initrequest *q) { - bend_initresult *r = odr_malloc (q->stream, sizeof(*r)); + bend_initresult *r = (bend_initresult *) odr_malloc (q->stream, sizeof(*r)); static char *dummy = "Hej fister"; r->errcode = 0; @@ -112,7 +115,7 @@ char *marc_read(FILE *inf) size = atoin (length_str, 5); if (size <= 6) return NULL; - if (!(buf = xmalloc (size+1))) + if (!(buf = (char*) xmalloc (size+1))) return NULL; if (fread (buf+5, 1, size-5, inf) != (size-5)) { @@ -137,7 +140,7 @@ static char *dummy_database_record (int num) xfree(buf); if (num == 98) { - assert(buf = xmalloc(2101)); + assert(buf = (char*) xmalloc(2101)); memset(buf, 'A', 2100); buf[2100] = '\0'; break; @@ -174,7 +177,8 @@ static Z_GenericRecord *dummy_grs_record (int num, ODR o) bend_fetchresult *bend_fetch(void *handle, bend_fetchrequest *q, int *num) { - bend_fetchresult *r = odr_malloc (q->stream, sizeof(*r)); + bend_fetchresult *r = (bend_fetchresult *) + odr_malloc (q->stream, sizeof(*r)); static char *bbb = 0; r->errstring = 0; @@ -191,7 +195,7 @@ bend_fetchresult *bend_fetch(void *handle, bend_fetchrequest *q, int *num) char buf[100]; sprintf(buf, "This is dummy SUTRS record number %d\n", q->number); - assert(r->record = bbb = xmalloc(strlen(buf)+1)); + assert(r->record = bbb = (char*) xmalloc(strlen(buf)+1)); strcpy(bbb, buf); r->len = strlen(buf); } @@ -249,7 +253,7 @@ bend_scanresult *bend_scan(void *handle, bend_scanrequest *q, int *num) */ bend_scanresult *bend_scan(void *handle, bend_scanrequest *q, int *num) { - bend_scanresult *r = odr_malloc (q->stream, sizeof(*r)); + bend_scanresult *r = (bend_scanresult *) odr_malloc (q->stream, sizeof(*r)); static FILE *f = 0; static struct scan_entry list[200]; static char entries[200][80]; -- 1.7.10.4