X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=asn%2Fproto.c;h=0097d2bed4e440fd9fc86c190e8d3e3e2550c123;hb=19af2bd8dfd21731cc978beccd1346133d614c67;hp=58eae4d5bce077e93dada607cf4d8c56c5b7daad;hpb=e147ddf129696b470aed3cfcdb405af84ee56ef6;p=yaz-moved-to-github.git diff --git a/asn/proto.c b/asn/proto.c index 58eae4d..0097d2b 100644 --- a/asn/proto.c +++ b/asn/proto.c @@ -4,7 +4,16 @@ * Sebastian Hammer, Adam Dickmeiss * * $Log: proto.c,v $ - * Revision 1.58 1999-04-20 09:56:47 adam + * Revision 1.61 1999-11-30 13:47:10 adam + * Improved installation. Moved header files to include/yaz. + * + * Revision 1.60 1999/06/11 16:45:59 adam + * Fixed minor bug in ScanRequest encoder. + * + * Revision 1.59 1999/04/21 11:46:00 adam + * Fixed bug in {en,de}coder for OtherInformation. + * + * Revision 1.58 1999/04/20 09:56:47 adam * Added 'name' paramter to encoder/decoder routines (typedef Odr_fun). * Modified all encoders/decoders to reflect this change. * @@ -181,9 +190,9 @@ * */ -#include +#include -#include +#include /* ---------------------- GLOBAL DEFS ------------------- */ @@ -258,24 +267,22 @@ int z_OtherInformationUnit(ODR o, Z_OtherInformationUnit **p, int opt, {-1, -1, -1, -1, 0, 0} }; - if (!odr_sequence_begin(o, p, sizeof(**p), 0)) + if (!odr_sequence_begin(o, p, sizeof(**p), name)) return opt && odr_ok(o); return odr_implicit(o, z_InfoCategory, &(*p)->category, ODR_CONTEXT, 1, 1) && - odr_choice(o, arm, &(*p)->information, &(*p)->which, 0) && + odr_choice(o, arm, &(*p)->information, &(*p)->which, name) && odr_sequence_end(o); } int z_OtherInformation(ODR o, Z_OtherInformation **p, int opt, const char *name) { - if (o->direction == ODR_DECODE) - *p = (Z_OtherInformation *)odr_malloc(o, sizeof(**p)); - else if (!*p) - return 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, (Odr_fun)z_OtherInformationUnit, &(*p)->list, - &(*p)->num_elements, 0)) + &(*p)->num_elements, name)) return 1; *p = 0; return opt && odr_ok(o); @@ -826,8 +833,8 @@ int z_SearchRequest(ODR o, Z_SearchRequest **p, int opt, const char *name) odr_implicit(o, odr_oid, &pp->preferredRecordSyntax, ODR_CONTEXT, 104, 1) && odr_explicit(o, z_Query, &pp->query, ODR_CONTEXT, 21, 0) && - odr_implicit(o, z_OtherInformation, &(*p)->additionalSearchInfo, - ODR_CONTEXT, 203, 1) && + odr_implicit_tag(o, z_OtherInformation, &(*p)->additionalSearchInfo, + ODR_CONTEXT, 203, 1, 0) && z_OtherInformation(o, &(*p)->otherInfo, 1, 0) && odr_sequence_end(o); } @@ -1215,6 +1222,7 @@ int z_ScanRequest(ODR o, Z_ScanRequest **p, int opt, const char *name) ODR_CONTEXT, 6, 0) && odr_implicit(o, odr_integer, &(*p)->preferredPositionInResponse, ODR_CONTEXT, 7, 1) && + z_OtherInformation(o, &(*p)->otherInfo, 1, "otherInfo") && odr_sequence_end(o); }