X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=odr%2Fodr_util.c;h=d399f9e5b0f0f590f729de49533b36902345b9bc;hb=0d7bd5b0e03b77779702a35738e5c7bcc5d3849d;hp=6814c60b3fcafafbd9219c024d932bbd8ab8e9bd;hpb=a7d28a25277a208edb9c44d124f179cc2be6db70;p=yaz-moved-to-github.git diff --git a/odr/odr_util.c b/odr/odr_util.c index 6814c60..d399f9e 100644 --- a/odr/odr_util.c +++ b/odr/odr_util.c @@ -1,5 +1,43 @@ -#include #include +#include +#include + +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; +} + +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; +}