1 /* This file is part of the YAZ toolkit.
2 * Copyright (C) 1995-2009 Index Data
3 * See the file LICENSE for details.
8 * \brief Implements ODR BITSTRING codec
19 * Top level bitstring string en/decoder.
20 * Returns 1 on success, 0 on error.
22 int odr_bitstring(ODR o, Odr_bitmask **p, int opt, const char *name)
28 if (o->op->t_class < 0)
30 o->op->t_class = ODR_UNIVERSAL;
31 o->op->t_tag = ODR_BITSTRING;
33 res = ber_tag(o, p, o->op->t_class, o->op->t_tag, &cons, opt, name);
37 return odr_missing(o, opt, name);
38 if (o->direction == ODR_PRINT)
41 odr_printf(o, "BITSTRING(len=%d)\n",(*p)->top + 1);
44 if (o->direction == ODR_DECODE)
46 *p = (Odr_bitmask *)odr_malloc(o, sizeof(Odr_bitmask));
47 memset((*p)->bits, 0, ODR_BITMASK_SIZE);
51 /* ignoring the cons helps with at least one target.
52 * http://bugzilla.indexdata.dk/cgi-bin/bugzilla/show_bug.cgi?id=24
54 return ber_bitstring(o, *p, 0);
56 return ber_bitstring(o, *p, cons);
62 * indent-tabs-mode: nil
64 * vim: shiftwidth=4 tabstop=8 expandtab