X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;ds=sidebyside;f=odr%2Fodr_util.c;h=7a07775ac5230839ac7452ebacc292ff77266eb5;hb=63cafe41a93427118959a74201b3e331169a71d9;hp=6814c60b3fcafafbd9219c024d932bbd8ab8e9bd;hpb=a7d28a25277a208edb9c44d124f179cc2be6db70;p=yaz-moved-to-github.git diff --git a/odr/odr_util.c b/odr/odr_util.c index 6814c60..7a07775 100644 --- a/odr/odr_util.c +++ b/odr/odr_util.c @@ -1,5 +1,46 @@ -#include #include +#include +#include + +char *odr_indent(ODR o) +{ + static char buf[512]; + int i = o->indent; + + memset(buf, ' ', 512); + if (i >= 128) + i = 127; + 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; +} + +Odr_oid *odr_oiddup(ODR odr, Odr_oid *o) +{ + Odr_oid *r; -void *nalloc(ODR o, int size) { return malloc(size); } -char *odr_indent(ODR o) {return "";} + if (!o) + return 0; + if (!(r = odr_malloc(odr, (oid_oidlen(o) + 1) * sizeof(int)))) + return 0; + oid_oidcpy(r, o); + return r; +}