From 45b8c41038c587b5993c6219bf6698323cf93494 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Mon, 28 Aug 2006 17:38:49 +0000 Subject: r17891: remove c++ warnings from talloc metze (This used to be commit fb73ce8d4364a1da3c320034d90c0556529c61c4) --- source4/lib/talloc/talloc.c | 23 ++++++++++++----------- source4/lib/talloc/talloc.h | 4 ++-- 2 files changed, 14 insertions(+), 13 deletions(-) (limited to 'source4') diff --git a/source4/lib/talloc/talloc.c b/source4/lib/talloc/talloc.c index fc0462929c..293775b1ca 100644 --- a/source4/lib/talloc/talloc.c +++ b/source4/lib/talloc/talloc.c @@ -107,7 +107,7 @@ struct talloc_chunk { /* panic if we get a bad magic value */ static struct talloc_chunk *talloc_chunk_from_ptr(const void *ptr) { - const char *pp = ptr; + const char *pp = (const char *)ptr; struct talloc_chunk *tc = discard_const_p(struct talloc_chunk, pp - TC_HDR_SIZE); if ((tc->flags & ~0xF) != TALLOC_MAGIC) { TALLOC_ABORT("Bad talloc magic value - unknown value"); @@ -177,7 +177,7 @@ void *_talloc(const void *context, size_t size) return NULL; } - tc = malloc(TC_HDR_SIZE+size); + tc = (struct talloc_chunk *)malloc(TC_HDR_SIZE+size); if (tc == NULL) return NULL; tc->size = size; @@ -251,8 +251,9 @@ void *talloc_reference(const void *context, const void *ptr) if (ptr == NULL) return NULL; tc = talloc_chunk_from_ptr(ptr); - handle = talloc_named_const(context, sizeof(*handle), TALLOC_MAGIC_REFERENCE); - + handle = (struct talloc_reference_handle *)talloc_named_const(context, + sizeof(struct talloc_reference_handle), + TALLOC_MAGIC_REFERENCE); if (handle == NULL) return NULL; /* note that we hang the destructor off the handle, not the @@ -646,13 +647,13 @@ void *_talloc_realloc(const void *context, void *ptr, size_t size, const char *n return NULL; } - tc = new_ptr; + tc = (struct talloc_chunk *)new_ptr; tc->flags &= ~TALLOC_FLAG_FREE; if (tc->parent) { - tc->parent->child = new_ptr; + tc->parent->child = tc; } if (tc->child) { - tc->child->parent = new_ptr; + tc->child->parent = tc; } if (tc->prev) { @@ -962,7 +963,7 @@ char *talloc_strdup(const void *t, const char *p) if (!p) { return NULL; } - ret = talloc_memdup(t, p, strlen(p) + 1); + ret = (char *)talloc_memdup(t, p, strlen(p) + 1); if (ret) { talloc_set_name_const(ret, ret); } @@ -1003,7 +1004,7 @@ char *talloc_strndup(const void *t, const char *p, size_t n) for (len=0; len