X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=odr%2Fodr.c;h=24b15b352cf3808996a0e92578113d1d743ac697;hb=e8464a391ad260860795a69bcd1bcf6940cc17de;hp=c5d725ce31bd6d2d23576c345f46f1bd906d4ef7;hpb=75b13633ae87b4e716c26d2d71a2342fa0be70c7;p=yaz-moved-to-github.git diff --git a/odr/odr.c b/odr/odr.c index c5d725c..24b15b3 100644 --- a/odr/odr.c +++ b/odr/odr.c @@ -4,7 +4,19 @@ * Sebastian Hammer, Adam Dickmeiss * * $Log: odr.c,v $ - * Revision 1.4 1995-03-07 13:16:13 quinn + * Revision 1.8 1995-03-17 10:17:43 quinn + * Added memory management. + * + * Revision 1.7 1995/03/10 11:44:41 quinn + * Fixed serious stack-bug in odr_cons_begin + * + * Revision 1.6 1995/03/08 12:12:15 quinn + * Added better error checking. + * + * Revision 1.5 1995/03/07 13:28:57 quinn + * *** empty log message *** + * + * Revision 1.4 1995/03/07 13:16:13 quinn * Fixed bug in odr_reset * * Revision 1.3 1995/03/07 10:21:31 quinn @@ -27,12 +39,15 @@ char *odr_errlist[] = { "No (unknown) error", - "Memoy allocation failed", + "Memory allocation failed", "System error", "No space in buffer", "Required data element missing", "Unexpected tag", - "Other error" + "Other error", + "Protocol error", + "Malformed data", + "Stack overflow" }; void odr_perror(ODR o, char *message) @@ -60,6 +75,7 @@ ODR odr_createmem(int direction) r->print = stdout; r->buf = 0; r->buflen = 0; + r->mem = 0; odr_reset(r); return r; } @@ -72,11 +88,14 @@ void odr_reset(ODR o) o->t_class = -1; o->t_tag = -1; o->indent = 0; - o->stackp = 0; + o->stackp = -1; + odr_release_mem(o->mem); + o->mem = 0; } void odr_destroy(ODR o) { + odr_release_mem(o->mem); free(o); } @@ -90,4 +109,4 @@ char *odr_getbuf(ODR o, int *len) { *len = o->bp - o->buf; return (char *) o->buf; -} +}