summaryrefslogtreecommitdiff
path: root/source4/lib/util
diff options
context:
space:
mode:
Diffstat (limited to 'source4/lib/util')
-rw-r--r--source4/lib/util/data_blob.c10
-rw-r--r--source4/lib/util/dprintf.c2
-rw-r--r--source4/lib/util/util_tdb.c5
-rw-r--r--source4/lib/util/xfile.c2
4 files changed, 10 insertions, 9 deletions
diff --git a/source4/lib/util/data_blob.c b/source4/lib/util/data_blob.c
index 117043f95c..b258e47bba 100644
--- a/source4/lib/util/data_blob.c
+++ b/source4/lib/util/data_blob.c
@@ -39,9 +39,9 @@ _PUBLIC_ DATA_BLOB data_blob_named(const void *p, size_t length, const char *nam
}
if (p) {
- ret.data = talloc_memdup(NULL, p, length);
+ ret.data = (uint8_t *)talloc_memdup(NULL, p, length);
} else {
- ret.data = talloc_size(NULL, length);
+ ret.data = talloc_array(NULL, uint8_t, length);
}
if (ret.data == NULL) {
ret.length = 0;
@@ -175,7 +175,7 @@ _PUBLIC_ char *data_blob_hex_string(TALLOC_CTX *mem_ctx, const DATA_BLOB *blob)
_PUBLIC_ DATA_BLOB data_blob_string_const(const char *str)
{
DATA_BLOB blob;
- blob.data = discard_const(str);
+ blob.data = discard_const_p(uint8_t, str);
blob.length = strlen(str);
return blob;
}
@@ -187,7 +187,7 @@ _PUBLIC_ DATA_BLOB data_blob_string_const(const char *str)
_PUBLIC_ DATA_BLOB data_blob_const(const void *p, size_t length)
{
DATA_BLOB blob;
- blob.data = discard_const(p);
+ blob.data = discard_const_p(uint8_t, p);
blob.length = length;
return blob;
}
@@ -198,7 +198,7 @@ _PUBLIC_ DATA_BLOB data_blob_const(const void *p, size_t length)
**/
_PUBLIC_ bool data_blob_realloc(TALLOC_CTX *mem_ctx, DATA_BLOB *blob, size_t length)
{
- blob->data = talloc_realloc_size(mem_ctx, blob->data, length);
+ blob->data = talloc_realloc(mem_ctx, blob->data, uint8_t, length);
if (blob->data == NULL)
return false;
blob->length = length;
diff --git a/source4/lib/util/dprintf.c b/source4/lib/util/dprintf.c
index a7770f364d..91665e7bdd 100644
--- a/source4/lib/util/dprintf.c
+++ b/source4/lib/util/dprintf.c
@@ -48,7 +48,7 @@ _PUBLIC_ int d_vfprintf(FILE *f, const char *format, va_list ap) _PRINTF_ATTRIBU
charset, but beware of it growing */
maxlen = ret*2;
again:
- p2 = malloc(maxlen);
+ p2 = (char *)malloc(maxlen);
if (!p2) {
SAFE_FREE(p);
return -1;
diff --git a/source4/lib/util/util_tdb.c b/source4/lib/util/util_tdb.c
index 1112f1587c..d7bddbde01 100644
--- a/source4/lib/util/util_tdb.c
+++ b/source4/lib/util/util_tdb.c
@@ -22,6 +22,7 @@
#include "includes.h"
#include "lib/tdb/include/tdb.h"
#include "pstring.h"
+#include "lib/util/util_tdb.h"
/* these are little tdb utility functions that are meant to make
dealing with a tdb database a little less cumbersome in Samba */
@@ -127,7 +128,7 @@ int tdb_store_int32_byblob(struct tdb_context *tdb, const char *keystr, size_t l
int32_t v_store;
SIVAL(&v_store,0,v);
- data.dptr = (void *)&v_store;
+ data.dptr = (unsigned char *)&v_store;
data.dsize = sizeof(int32_t);
return tdb_store(tdb, key, data, TDB_REPLACE);
@@ -187,7 +188,7 @@ bool tdb_store_uint32_byblob(struct tdb_context *tdb, const char *keystr, size_t
bool ret = true;
SIVAL(&v_store, 0, value);
- data.dptr = (void *)&v_store;
+ data.dptr = (unsigned char *)&v_store;
data.dsize = sizeof(uint32_t);
if (tdb_store(tdb, key, data, TDB_REPLACE) == -1)
diff --git a/source4/lib/util/xfile.c b/source4/lib/util/xfile.c
index 8b90e30868..a016031a77 100644
--- a/source4/lib/util/xfile.c
+++ b/source4/lib/util/xfile.c
@@ -85,7 +85,7 @@ static int x_allocate_buffer(XFILE *f)
{
if (f->buf) return 1;
if (f->bufsize == 0) return 0;
- f->buf = malloc(f->bufsize);
+ f->buf = (char *)malloc(f->bufsize);
if (!f->buf) return 0;
f->next = f->buf;
return 1;