X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=odr%2Fodr.c;h=bfa833462c74be85ea9a9a57b8b3bffe0bf7dc22;hb=70efa832d93f63e4fe7de44b666f3b66ae87c23f;hp=6129857df62981a5864ecc281970fc8c96800c12;hpb=a372d45e267573f7c0f53759de3db81ec1237383;p=yaz-moved-to-github.git diff --git a/odr/odr.c b/odr/odr.c index 6129857..bfa8334 100644 --- a/odr/odr.c +++ b/odr/odr.c @@ -4,7 +4,19 @@ * Sebastian Hammer, Adam Dickmeiss * * $Log: odr.c,v $ - * Revision 1.3 1995-03-07 10:21:31 quinn + * 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 * odr_errno-->odr_error * * Revision 1.2 1995/03/07 10:19:05 quinn @@ -24,12 +36,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) @@ -37,7 +52,7 @@ void odr_perror(ODR o, char *message) fprintf(stderr, "%s: %s\n", message, odr_errlist[o->error]); } -int odr_error(ODR o) +int odr_geterror(ODR o) { return o->error; } @@ -64,12 +79,12 @@ ODR odr_createmem(int direction) void odr_reset(ODR o) { o->error = ONONE; - o->bp = 0; + o->bp = o->buf; o->left = o->buflen; o->t_class = -1; o->t_tag = -1; o->indent = 0; - o->stackp = 0; + o->stackp = -1; } void odr_destroy(ODR o) @@ -87,4 +102,4 @@ char *odr_getbuf(ODR o, int *len) { *len = o->bp - o->buf; return (char *) o->buf; -} +}