X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=odr%2Fodr_choice.c;h=eb0038716e8480b7b8321330e470a6504a4eec1b;hb=09abca5ee8cb11137decdfa7d10b822173ad5fe1;hp=1ad923a7dc3e09fb128f3af3f033029bf349bc47;hpb=e147ddf129696b470aed3cfcdb405af84ee56ef6;p=yaz-moved-to-github.git diff --git a/odr/odr_choice.c b/odr/odr_choice.c index 1ad923a..eb00387 100644 --- a/odr/odr_choice.c +++ b/odr/odr_choice.c @@ -1,10 +1,19 @@ /* - * Copyright (c) 1995-1999, Index Data + * Copyright (c) 1995-2002, Index Data * See the file LICENSE for details. * Sebastian Hammer, Adam Dickmeiss * * $Log: odr_choice.c,v $ - * Revision 1.16 1999-04-20 09:56:48 adam + * Revision 1.19 2002-02-20 14:42:30 adam + * Fixed BER decoding of OPTIONAL CHOICE + * + * Revision 1.18 2000/02/29 13:44:55 adam + * Check for config.h (currently not generated). + * + * Revision 1.17 1999/11/30 13:47:11 adam + * Improved installation. Moved header files to include/yaz. + * + * Revision 1.16 1999/04/20 09:56:48 adam * Added 'name' paramter to encoder/decoder routines (typedef Odr_fun). * Modified all encoders/decoders to reflect this change. * @@ -55,8 +64,11 @@ * A damn mess, but now things work, I think. * */ +#if HAVE_CONFIG_H +#include +#endif -#include +#include int odr_choice(ODR o, Odr_arm arm[], void *p, void *whichp, const char *name) @@ -67,6 +79,12 @@ int odr_choice(ODR o, Odr_arm arm[], void *p, void *whichp, return 0; if (o->direction != ODR_DECODE && !*(char**)p) return 0; + + if (o->direction == ODR_DECODE) + { + *which = -1; + *(char**)p = 0; + } o->choice_bias = -1; if (o->direction == ODR_PRINT) @@ -122,8 +140,6 @@ int odr_choice(ODR o, Odr_arm arm[], void *p, void *whichp, return 1; } } - *which = -1; - *(char*)p = 0; return 0; }