X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=odr%2Fodr_util.c;h=16dc98471aea3bf6c0f7b63fd4f88bb67af9e023;hb=bf3c907b04a3a1dd708f90ce08328014775758af;hp=6814c60b3fcafafbd9219c024d932bbd8ab8e9bd;hpb=a7d28a25277a208edb9c44d124f179cc2be6db70;p=yaz-moved-to-github.git diff --git a/odr/odr_util.c b/odr/odr_util.c index 6814c60..16dc984 100644 --- a/odr/odr_util.c +++ b/odr/odr_util.c @@ -2,4 +2,31 @@ #include void *nalloc(ODR o, int size) { return malloc(size); } -char *odr_indent(ODR o) {return "";} + +char *odr_indent(ODR o) +{ + static char buf[512]; + + memset(buf, ' ', 512); + buf[o->indent * 4] = 0; + return buf; +} + +int odp_more_chunks(ODR o, unsigned char *base, int len) +{ + if (!len) + return 0; + if (len < 0) /* indefinite length */ + { + if (*o->bp == 0 && *(o->bp + 1) == 0) + { + o->bp += 2; + o->left -= 2; + return 0; + } + else + return 1; + } + else + return o->bp - base < len; +}