projects
/
yaz-moved-to-github.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
No unsigned char's in public API (except for iconv)
[yaz-moved-to-github.git]
/
src
/
odr_mem.c
diff --git
a/src/odr_mem.c
b/src/odr_mem.c
index
9972c10
..
2cc6b4a
100644
(file)
--- a/
src/odr_mem.c
+++ b/
src/odr_mem.c
@@
-1,5
+1,5
@@
/* This file is part of the YAZ toolkit.
/* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2013 Index Data
* See the file LICENSE for details.
*/
/**
* See the file LICENSE for details.
*/
/**
@@
-62,12
+62,14
@@
size_t odr_total(ODR o)
return nmem_total(o->mem);
}
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));
{
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);
memcpy(p->buf, buf, sz);
+#if OCT_SIZE
p->size = sz;
p->size = sz;
+#endif
p->len = sz;
return p;
}
p->len = sz;
return p;
}
@@
-88,15
+90,14
@@
int odr_grow_block(ODR b, int min_bytes)
if (togrow < min_bytes)
togrow = min_bytes;
if (b->size && !(b->buf =
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();
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;
}
abort();
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))
{
{
if (o->pos + bytes >= o->size && odr_grow_block(o, bytes))
{