Get rid of size member of Odr_oct
[yaz-moved-to-github.git] / src / odr_mem.c
index 8dce213..52d850b 100644 (file)
@@ -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.
  */
 /**
@@ -67,7 +67,9 @@ Odr_oct *odr_create_Odr_oct(ODR o, const unsigned char *buf, int sz)
     Odr_oct *p = (Odr_oct *) odr_malloc(o, sizeof(Odr_oct));
     p->buf = (unsigned char *) odr_malloc(o, sz);
     memcpy(p->buf, buf, sz);
+#if OCT_SIZE
     p->size = sz;
+#endif
     p->len = sz;
     return p;
 }
@@ -96,7 +98,7 @@ int odr_grow_block(ODR b, int min_bytes)
     return 0;
 }
 
-int odr_write(ODR o, unsigned char *buf, int bytes)
+int odr_write2(ODR o, const char *buf, int bytes)
 {
     if (o->pos + bytes >= o->size && odr_grow_block(o, bytes))
     {
@@ -110,6 +112,11 @@ int odr_write(ODR o, unsigned char *buf, int bytes)
     return 0;
 }
 
+int odr_write(ODR o, unsigned char *buf, int bytes)
+{
+    return odr_write2(o, (char *) buf, bytes);
+}
+
 int odr_seek(ODR o, int whence, int offset)
 {
     if (whence == ODR_S_CUR)