X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=src%2Fodr_mem.c;h=33e2bfadb28f4832eda27901f63ca440aee8ac6d;hb=80559dbf0a5d6993eef844e6f6198d28ff5a44fa;hp=8dce213629d61321d5d3e465b40c90c0d6d24bea;hpb=43a9d38d20c1b1bcd1a03b2445a501d27526bd35;p=yaz-moved-to-github.git diff --git a/src/odr_mem.c b/src/odr_mem.c index 8dce213..33e2bfa 100644 --- a/src/odr_mem.c +++ b/src/odr_mem.c @@ -1,5 +1,5 @@ /* This file is part of the YAZ toolkit. - * Copyright (C) 1995-2011 Index Data + * Copyright (C) 1995-2013 Index Data * See the file LICENSE for details. */ /** @@ -62,12 +62,11 @@ size_t odr_total(ODR o) return nmem_total(o->mem); } -Odr_oct *odr_create_Odr_oct(ODR o, const unsigned char *buf, int sz) +Odr_oct *odr_create_Odr_oct(ODR o, const char *buf, int sz) { Odr_oct *p = (Odr_oct *) odr_malloc(o, sizeof(Odr_oct)); - p->buf = (unsigned char *) odr_malloc(o, sz); + p->buf = (char *) odr_malloc(o, sz); memcpy(p->buf, buf, sz); - p->size = sz; p->len = sz; return p; } @@ -88,15 +87,14 @@ int odr_grow_block(ODR b, int min_bytes) if (togrow < min_bytes) togrow = min_bytes; if (b->size && !(b->buf = - (unsigned char *) xrealloc(b->buf, b->size += togrow))) + (char *) xrealloc(b->buf, b->size += togrow))) abort(); - else if (!b->size && !(b->buf = (unsigned char *) - xmalloc(b->size = togrow))) + else if (!b->size && !(b->buf = (char *) xmalloc(b->size = togrow))) abort(); return 0; } -int odr_write(ODR o, unsigned char *buf, int bytes) +int odr_write(ODR o, const char *buf, int bytes) { if (o->pos + bytes >= o->size && odr_grow_block(o, bytes)) {