2 * Copyright (c) 1995, Index Data
3 * See the file LICENSE for details.
4 * Sebastian Hammer, Adam Dickmeiss
7 * Revision 1.6 1995-09-27 15:02:54 quinn
8 * Modified function heads & prototypes.
10 * Revision 1.5 1995/05/16 08:50:43 quinn
11 * License, documentation, and memory fixes
13 * Revision 1.4 1995/04/18 08:15:13 quinn
14 * Added dynamic memory allocation on encoding (whew). Code is now somewhat
15 * neater. We'll make the same change for decoding one day.
17 * Revision 1.3 1995/03/08 12:12:04 quinn
18 * Added better error checking.
20 * Revision 1.2 1995/02/03 17:04:31 quinn
21 * *** empty log message ***
23 * Revision 1.1 1995/02/02 20:38:49 quinn
31 int MDF ber_bitstring(ODR o, Odr_bitmask *p, int cons)
39 if ((res = ber_declen(o->bp, &len)) < 0)
46 if (cons) /* fetch component strings */
49 while (odp_more_chunks(o, base, len))
50 if (!odr_bitstring(o, &p, 0))
54 /* primitive bitstring */
62 if (len - 1 > ODR_BITMASK_SIZE)
67 o->bp++; /* silently ignore the unused-bits field */
70 memcpy(p->bits + p->top + 1, o->bp, len);
76 if ((res = ber_enclen(o, p->top + 2, 5, 0)) < 0)
78 if (odr_putc(o, 0) < 0) /* no unused bits here */
82 if (odr_write(o, p->bits, p->top + 1) < 0)
85 case ODR_PRINT: return 1;
86 default: o->error = OOTHER; return 0;