r17334: Some C++ warnings
authorVolker Lendecke <vlendec@samba.org>
Mon, 31 Jul 2006 04:30:55 +0000 (04:30 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 16:38:26 +0000 (11:38 -0500)
12 files changed:
source/lib/account_pol.c
source/lib/debug.c
source/lib/dprintf.c
source/lib/gencache.c
source/lib/interface.c
source/lib/ldap_escape.c
source/lib/privileges.c
source/lib/smbldap.c
source/lib/sysacls.c
source/lib/util_pw.c
source/lib/xfile.c
source/popt/findme.c

index 8d844741f5d7b21ec9ad36f51309dda50a010a88..de5a37aea91b562ea82efe29e36db6ea1c71e08f 100644 (file)
@@ -94,7 +94,7 @@ char *account_policy_names_list(void)
                len += strlen(account_policy_names[i].string) + 1;
        }
        len++;
-       nl = SMB_MALLOC(len);
+       nl = (char *)SMB_MALLOC(len);
        if (!nl) {
                return NULL;
        }
index bf75bdf3d3f516d3c03f397bc02183c602975e13..00f6b0e72ff8a0af87995933b4979fd9f28f99e9 100644 (file)
@@ -236,7 +236,7 @@ static char *debug_list_class_names_and_levels(void)
        }
 
        /* create single string list - add space for newline */
-       b = buf = SMB_MALLOC(dim+1);
+       b = buf = (char *)SMB_MALLOC(dim+1);
        if (!buf) {
                err = True;
                goto done;
@@ -320,7 +320,7 @@ int debug_add_class(const char *classname)
        new_ptr = SMB_REALLOC_ARRAY(new_ptr, int, debug_num_classes + 1);
        if (!new_ptr)
                return -1;
-       DEBUGLEVEL_CLASS = new_ptr;
+       DEBUGLEVEL_CLASS = (int *)new_ptr;
        DEBUGLEVEL_CLASS[ndx] = 0;
 
        /* debug_level is the pointer used for the DEBUGLEVEL-thingy */
@@ -337,13 +337,13 @@ int debug_add_class(const char *classname)
        new_ptr = SMB_REALLOC_ARRAY(new_ptr, BOOL, debug_num_classes + 1);
        if (!new_ptr)
                return -1;
-       DEBUGLEVEL_CLASS_ISSET = new_ptr;
+       DEBUGLEVEL_CLASS_ISSET = (int *)new_ptr;
        DEBUGLEVEL_CLASS_ISSET[ndx] = False;
 
        new_ptr = SMB_REALLOC_ARRAY(classname_table, char *, debug_num_classes + 1);
        if (!new_ptr)
                return -1;
-       classname_table = new_ptr;
+       classname_table = (char **)new_ptr;
 
        classname_table[ndx] = SMB_STRDUP(classname);
        if (! classname_table[ndx])
@@ -474,7 +474,7 @@ BOOL debug_parse_levels(const char *params_str)
 static void debug_message(int msg_type, struct process_id src,
                          void *buf, size_t len)
 {
-       const char *params_str = buf;
+       const char *params_str = (const char *)buf;
 
        /* Check, it's a proper string! */
        if (params_str[len-1] != '\0') {
index 8ed2fa5d8cdaf505019de9e517d2ce9fb464071f..2312c3db0cbc13f54915291453d33fbaff8d97da 100644 (file)
@@ -54,7 +54,7 @@
           charset, but beware of it growing */
        maxlen = ret*2;
 again:
-       p2 = SMB_MALLOC(maxlen);
+       p2 = (char *)SMB_MALLOC(maxlen);
        if (!p2) {
                SAFE_FREE(p);
                return -1;
index 561a019429a86805337635f7856a4f00567d750f..d4582b34f9d2dd087d1be70aec61e08a930f9b65 100644 (file)
@@ -260,7 +260,7 @@ BOOL gencache_get(const char *keystr, char **valstr, time_t *timeout)
                int status;
                char *fmt;
 
-               v = SMB_MALLOC(databuf.dsize + 1 - TIMEOUT_LEN);
+               v = (char *)SMB_MALLOC(databuf.dsize + 1 - TIMEOUT_LEN);
                if (!v) {
                        return False;
                }
@@ -372,7 +372,7 @@ void gencache_iterate(void (*fn)(const char* key, const char *value, time_t time
 
                SAFE_FREE(databuf.dptr);
 
-               valstr = SMB_MALLOC(databuf.dsize + 1 - TIMEOUT_LEN);
+               valstr = (char *)SMB_MALLOC(databuf.dsize + 1 - TIMEOUT_LEN);
                if (!valstr) {
                        SAFE_FREE(entry);
                        SAFE_FREE(keystr);
index dea01c60111c2966842333f5126645292bbdf58d..9d0b966390f57347912e554699e6e91d806f1247 100644 (file)
@@ -187,7 +187,7 @@ void load_interfaces(void)
        total_probed = get_interfaces(ifaces, MAX_INTERFACES);
 
        if (total_probed > 0) {
-               probed_ifaces = memdup(ifaces, sizeof(ifaces[0])*total_probed);
+               probed_ifaces = (struct iface_struct *)memdup(ifaces, sizeof(ifaces[0])*total_probed);
                if (!probed_ifaces) {
                        DEBUG(0,("ERROR: memdup failed\n"));
                        exit(1);
index fcb787e9e8556dea396a8dcffe2a2de717cd6ef5..26230884341deb1952064b16c7d36dcc9cb7f98c 100644 (file)
@@ -36,7 +36,7 @@
 char *escape_ldap_string_alloc(const char *s)
 {
        size_t len = strlen(s)+1;
-       char *output = SMB_MALLOC(len);
+       char *output = (char *)SMB_MALLOC(len);
        const char *sub;
        int i = 0;
        char *p = output;
@@ -68,7 +68,7 @@ char *escape_ldap_string_alloc(const char *s)
                
                if (sub) {
                        len = len + 3;
-                       output = SMB_REALLOC(output, len);
+                       output = (char *)SMB_REALLOC(output, len);
                        if (!output) { 
                                return NULL;
                        }
index d19592e58269b9e5a7ab0bd774b80804d172803c..344d636f5e7634c748e1c87166eefd37f926a724 100644 (file)
@@ -473,7 +473,7 @@ BOOL get_privileges_for_sids(SE_PRIV *privileges, DOM_SID *slist, int scount)
 
 static int priv_traverse_fn(TDB_CONTEXT *t, TDB_DATA key, TDB_DATA data, void *state)
 {
-       PRIV_SID_LIST *priv = state;
+       PRIV_SID_LIST *priv = (PRIV_SID_LIST *)state;
        int  prefixlen = strlen(PRIVPREFIX);
        DOM_SID sid;
        fstring sid_string;
index a63e1c1bcc33db849fd43ce1fd89eaaa2990a4c9..a157ff132b7cb763d9c67adb21d4ab63abaac35d 100644 (file)
@@ -841,7 +841,8 @@ static int rebindproc_connect_with_state (LDAP *ldap_struct,
                                          ber_tag_t request,
                                          ber_int_t msgid, void *arg)
 {
-       struct smbldap_state *ldap_state = arg;
+       struct smbldap_state *ldap_state =
+               (struct smbldap_state *)arg;
        int rc;
        int version;
 
@@ -1289,7 +1290,7 @@ int smbldap_search_paged(struct smbldap_state *ldap_state,
        /* construct cookie */
        if (*cookie != NULL) {
                ber_printf(cookie_be, "{iO}", (ber_int_t) pagesize, *cookie);
-               ber_bvfree(*cookie); /* don't need it from last time */
+               ber_bvfree((struct berval *)*cookie); /* don't need it from last time */
                *cookie = NULL;
        } else {
                ber_printf(cookie_be, "{io}", (ber_int_t) pagesize, "", 0);
index e8c33c2c956da387334d4d71ad947dca68c88317..eba5fc44b6ca616101f8a18510cfad290e90099e 100644 (file)
@@ -141,7 +141,7 @@ char *sys_acl_to_text(SMB_ACL_T acl_d, ssize_t *len_p)
         */
        len     = 0;
        maxlen  = 20 * acl_d->count;
-       if ((text = SMB_MALLOC(maxlen)) == NULL) {
+       if ((text = (char *)SMB_MALLOC(maxlen)) == NULL) {
                errno = ENOMEM;
                return NULL;
        }
@@ -212,7 +212,7 @@ char *sys_acl_to_text(SMB_ACL_T acl_d, ssize_t *len_p)
                 */
                if ((len + nbytes) > maxlen) {
                        maxlen += nbytes + 20 * (acl_d->count - i);
-                       if ((text = SMB_REALLOC(text, maxlen)) == NULL) {
+                       if ((text = (char *)SMB_REALLOC(text, maxlen)) == NULL) {
                        errno = ENOMEM;
                                return NULL;
                }
@@ -243,8 +243,9 @@ SMB_ACL_T sys_acl_init(int count)
         * acl[] array, this actually allocates an ACL with room
         * for (count+1) entries
         */
-       if ((a = SMB_MALLOC(sizeof(struct smb_acl_t) +
-                           count * sizeof(struct smb_acl_entry))) == NULL) {
+       if ((a = (struct smb_acl_t *)SMB_MALLOC(
+                    sizeof(struct smb_acl_t) +
+                    count * sizeof(struct smb_acl_entry))) == NULL) {
                errno = ENOMEM;
                return NULL;
        }
index 754899f420ee072993c9990fefa26b6799a62f7e..dc184233a6db5d7566ad785c085be8aa8c03ac1a 100644 (file)
@@ -74,7 +74,7 @@ struct passwd *getpwnam_alloc(TALLOC_CTX *mem_ctx, const char *name)
                if ((pwnam_cache[i] != NULL) && 
                    (strcmp(name, pwnam_cache[i]->pw_name) == 0)) {
                        DEBUG(10, ("Got %s from pwnam_cache\n", name));
-                       return talloc_reference(mem_ctx, pwnam_cache[i]);
+                       return (struct passwd *)talloc_reference(mem_ctx, pwnam_cache[i]);
                }
        }
 
@@ -103,7 +103,7 @@ struct passwd *getpwnam_alloc(TALLOC_CTX *mem_ctx, const char *name)
 
        pwnam_cache[i] = tcopy_passwd(pwnam_cache, temp);
        if (pwnam_cache[i]!= NULL && mem_ctx != NULL) {
-               return talloc_reference(mem_ctx, pwnam_cache[i]);
+               return (struct passwd *)talloc_reference(mem_ctx, pwnam_cache[i]);
        }
 
        return tcopy_passwd(NULL, pwnam_cache[i]);
index ef33c7894f75fe3152a5459201c046a150586852..8a6776b5f919ca36eb837f83d8f1b0a5372f97c2 100644 (file)
@@ -80,7 +80,7 @@ static int x_allocate_buffer(XFILE *f)
 {
        if (f->buf) return 1;
        if (f->bufsize == 0) return 0;
-       f->buf = SMB_MALLOC(f->bufsize);
+       f->buf = (char *)SMB_MALLOC(f->bufsize);
        if (!f->buf) return 0;
        f->next = f->buf;
        return 1;
index a950e50018b1827ecf346c87278f094b1e5acb7c..b28981ba1f491e0629d567a7aa7f2db562936918 100644 (file)
@@ -22,8 +22,8 @@ const char * findProgramPath(const char * argv0) {
 
     if (path == NULL) return NULL;
 
-    start = pathbuf = alloca(strlen(path) + 1);
-    buf = malloc(strlen(path) + strlen(argv0) + sizeof("/"));
+    start = pathbuf = (char *)alloca(strlen(path) + 1);
+    buf = (char *)malloc(strlen(path) + strlen(argv0) + sizeof("/"));
     if (buf == NULL) return NULL;      /* XXX can't happen */
     strcpy(pathbuf, path);