samba-cvs.cvs
[Top] [All Lists]

svn commit: samba r17891 - in branches/SAMBA_4_0/source/lib/talloc: .

Subject: svn commit: samba r17891 - in branches/SAMBA_4_0/source/lib/talloc: .
From:
Date: Mon, 28 Aug 2006 17:38:49 +0000 GMT
Author: metze
Date: 2006-08-28 17:38:49 +0000 (Mon, 28 Aug 2006)
New Revision: 17891

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=17891

Log:
remove c++ warnings from talloc

metze
Modified:
   branches/SAMBA_4_0/source/lib/talloc/talloc.c
   branches/SAMBA_4_0/source/lib/talloc/talloc.h


Changeset:
Modified: branches/SAMBA_4_0/source/lib/talloc/talloc.c
===================================================================
--- branches/SAMBA_4_0/source/lib/talloc/talloc.c       2006-08-28 17:21:34 UTC 
(rev 17890)
+++ branches/SAMBA_4_0/source/lib/talloc/talloc.c       2006-08-28 17:38:49 UTC 
(rev 17891)
@@ -107,7 +107,7 @@
 /* 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 @@
                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 @@
        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 @@
                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 @@
        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 @@
 
        for (len=0; len<n && p[len]; len++) ;
 
-       ret = _talloc(t, len + 1);
+       ret = (char *)_talloc(t, len + 1);
        if (!ret) { return NULL; }
        memcpy(ret, p, len);
        ret[len] = 0;
@@ -1033,7 +1034,7 @@
                return NULL;
        }
 
-       ret = _talloc(t, len+1);
+       ret = (char *)_talloc(t, len+1);
        if (ret) {
                va_copy(ap2, ap);
                vsnprintf(ret, len+1, fmt, ap2);
@@ -1243,7 +1244,7 @@
 /*
   return 1 if ptr is a parent of context
 */
-int talloc_is_parent(const void *context, const char *ptr)
+int talloc_is_parent(const void *context, const void *ptr)
 {
        struct talloc_chunk *tc;
 

Modified: branches/SAMBA_4_0/source/lib/talloc/talloc.h
===================================================================
--- branches/SAMBA_4_0/source/lib/talloc/talloc.h       2006-08-28 17:21:34 UTC 
(rev 17890)
+++ branches/SAMBA_4_0/source/lib/talloc/talloc.h       2006-08-28 17:38:49 UTC 
(rev 17891)
@@ -59,7 +59,7 @@
 #define talloc_set_destructor(ptr, function)                                 \
        do {                                                                  \
                int (*_talloc_destructor_fn)(_TALLOC_TYPEOF(ptr)) = (function); 
      \
-               _talloc_set_destructor((ptr), (void *)_talloc_destructor_fn); \
+               _talloc_set_destructor((ptr), (int (*)(void 
*))_talloc_destructor_fn); \
        } while(0)
 /* this extremely strange macro is to avoid some braindamaged warning
    stupidity in gcc 4.1.x */
@@ -149,7 +149,7 @@
 size_t talloc_get_size(const void *ctx);
 void *talloc_find_parent_byname(const void *ctx, const char *name);
 void talloc_show_parents(const void *context, FILE *file);
-int talloc_is_parent(const void *context, const char *ptr);
+int talloc_is_parent(const void *context, const void *ptr);
 
 #endif
 

<Prev in Thread] Current Thread [Next in Thread>
  • svn commit: samba r17891 - in branches/SAMBA_4_0/source/lib/talloc: ., metze <=