2 * Copyright (c) 1995-1999, Index Data
3 * See the file LICENSE for details.
4 * Sebastian Hammer, Adam Dickmeiss
7 * Revision 1.15 1999-01-08 11:23:29 adam
8 * Added const modifier to some of the BER/ODR encoding routines.
10 * Revision 1.14 1998/10/13 15:58:36 adam
11 * Minor fix in odr_getoidbystr_nmem.
13 * Revision 1.13 1998/02/11 11:53:34 adam
14 * Changed code so that it compiles as C++.
16 * Revision 1.12 1997/10/31 12:20:08 adam
17 * Improved memory debugging for xmalloc/nmem.c. References to NMEM
18 * instead of ODR in n ESPEC-1 handling in source d1_espec.c.
19 * Bug fix: missing fclose in data1_read_espec1.
29 char *odr_indent(ODR o)
34 memset(buf, ' ', 512);
37 buf[o->indent * 4] = 0;
41 int odp_more_chunks(ODR o, const unsigned char *base, int len)
45 if (len < 0) /* indefinite length */
47 if (*o->bp == 0 && *(o->bp + 1) == 0)
57 return o->bp - base < len;
60 Odr_oid *odr_oiddup_nmem(NMEM nmem, Odr_oid *o)
66 if (!(r = (int *)nmem_malloc(nmem, (oid_oidlen(o) + 1) * sizeof(int))))
72 Odr_oid *odr_oiddup(ODR odr, Odr_oid *o)
74 return odr_oiddup_nmem (odr->mem, o);
77 Odr_oid *odr_getoidbystr_nmem(NMEM nmem, char *str)
85 while ((p = strchr(p, '.')))
87 ret = (int *)nmem_malloc(nmem, sizeof(*ret)*(num + 1));
91 while ((p = strchr(p, '.')) && *++p);
96 Odr_oid *odr_getoidbystr(ODR o, char *str)
98 return odr_getoidbystr_nmem (o->mem, str);