r17363: Some C++ warnings
authorVolker Lendecke <vlendec@samba.org>
Tue, 1 Aug 2006 12:45:12 +0000 (12:45 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 16:38:28 +0000 (11:38 -0500)
(This used to be commit fd82f185a2e0f94bfb75f4eee072556ad94bf27d)

source3/libmsrpc/cac_samr.c
source3/libmsrpc/libmsrpc_internal.c
source3/libsmb/smb_share_modes.c
source3/nsswitch/winbind_nss_linux.c
source3/rpc_parse/parse_buffer.c
source3/rpc_parse/parse_dfs.c
source3/torture/denytest.c
source3/torture/nbio.c
source3/torture/pdbtest.c

index a29ee7a41ebb0016860a48e4c4e69ba8bce8119d..056718830709506d3558617ed6e34774832e4591 100644 (file)
@@ -156,7 +156,8 @@ DOM_SID *cac_get_domain_sid(CacServerHandle *hnd, TALLOC_CTX *mem_ctx, uint32 de
    if(!fs.out.domain_sid)
       return NULL;
 
-   sid = talloc_memdup(mem_ctx, &(fs.out.domain_sid->sid), sizeof(DOM_SID));
+   sid = (DOM_SID *)talloc_memdup(mem_ctx, &(fs.out.domain_sid->sid),
+                                 sizeof(DOM_SID));
 
    if(!sid) {
       hnd->status = NT_STATUS_NO_MEMORY;
index a097bc181ce649cdd2eb1d755aa04949545ddf38..a1c37aaac42bf5bf06d89cfc83d78388322f6944 100644 (file)
@@ -252,7 +252,8 @@ REG_VALUE_DATA *cac_MakeRegValueData(TALLOC_CTX *mem_ctx, uint32 data_type, REGV
 
          data->reg_binary.data_length = size;
 
-         data->reg_binary.data = talloc_memdup(mem_ctx, buf.buffer, size);
+         data->reg_binary.data = (uint8 *)talloc_memdup(mem_ctx, buf.buffer,
+                                                       size);
          if(!data->reg_binary.data) {
             TALLOC_FREE(data);
             errno = ENOMEM;
@@ -499,7 +500,8 @@ CacUserInfo *cac_MakeUserInfo(TALLOC_CTX *mem_ctx, SAM_USERINFO_CTR *ctr) {
    memcpy(info->nt_password, id21->nt_pwd, 8);
    memcpy(info->lm_password, id21->lm_pwd, 8);
    
-   info->logon_hours = talloc_memdup(mem_ctx, &(id21->logon_hrs), sizeof(LOGON_HRS));
+   info->logon_hours = (LOGON_HRS *)talloc_memdup(mem_ctx, &(id21->logon_hrs),
+                                                 sizeof(LOGON_HRS));
    if(!info->logon_hours)
       return NULL;
 
index 34ede9df296947a64e0ea5b49eb1d054854ec9cc..54477c452440b1d58cb2e873f50160156b6ab2c5 100644 (file)
@@ -259,9 +259,10 @@ int smb_create_share_mode_entry_ex(struct smbdb_ctx *db_ctx,
        db_data = tdb_fetch(db_ctx->smb_tdb, locking_key);
        if (!db_data.dptr) {
                /* We must create the entry. */
-               db_data.dptr = malloc((2*sizeof(struct share_mode_entry)) +
-                                       strlen(sharepath) + 1 +
-                                       strlen(filename) + 1);
+               db_data.dptr = (char *)malloc(
+                       (2*sizeof(struct share_mode_entry)) +
+                       strlen(sharepath) + 1 +
+                       strlen(filename) + 1);
                if (!db_data.dptr) {
                        return -1;
                }
@@ -294,7 +295,8 @@ int smb_create_share_mode_entry_ex(struct smbdb_ctx *db_ctx,
        }
 
        /* Entry exists, we must add a new entry. */
-       new_data_p = malloc(db_data.dsize + sizeof(struct share_mode_entry));
+       new_data_p = (char *)malloc(
+               db_data.dsize + sizeof(struct share_mode_entry));
        if (!new_data_p) {
                free(db_data.dptr);
                return -1;
@@ -391,7 +393,8 @@ int smb_delete_share_mode_entry(struct smbdb_ctx *db_ctx,
        }
 
        /* More than one - allocate a new record minus the one we'll delete. */
-       new_data_p = malloc(db_data.dsize - sizeof(struct share_mode_entry));
+       new_data_p = (char *)malloc(
+               db_data.dsize - sizeof(struct share_mode_entry));
        if (!new_data_p) {
                free(db_data.dptr);
                return -1;
index 78a39f2873178f6f6b71a2d848fda83a65e844df..6efb9041f91b444cd07d3cfe1dc8cd94ebb30d26 100644 (file)
@@ -370,7 +370,8 @@ _nss_winbind_getpwent_r(struct passwd *result, char *buffer,
 
        return_result:
 
-               pw_cache = getpwent_response.extra_data.data;
+               pw_cache = (struct winbindd_pw *)
+                       getpwent_response.extra_data.data;
 
                /* Check data is valid */
 
@@ -613,7 +614,8 @@ winbind_getgrent(enum winbindd_cmd cmd,
 
        return_result:
 
-               gr_cache = getgrent_response.extra_data.data;
+               gr_cache = (struct winbindd_gr *)
+                       getgrent_response.extra_data.data;
 
                /* Check data is valid */
 
@@ -704,7 +706,7 @@ _nss_winbind_getgrnam_r(const char *name,
 
                if (ret == NSS_STATUS_SUCCESS) {
                        ret = fill_grent(result, &response.data.gr, 
-                                        response.extra_data.data,
+                                        (char *)response.extra_data.data,
                                         &buffer, &buflen);
 
                        if (ret == NSS_STATUS_TRYAGAIN) {
@@ -719,7 +721,8 @@ _nss_winbind_getgrnam_r(const char *name,
                /* We've been called again */
                
                ret = fill_grent(result, &response.data.gr, 
-                                response.extra_data.data, &buffer, &buflen);
+                                (char *)response.extra_data.data, &buffer,
+                                &buflen);
                
                if (ret == NSS_STATUS_TRYAGAIN) {
                        keep_response = True;
@@ -767,7 +770,7 @@ _nss_winbind_getgrgid_r(gid_t gid,
                if (ret == NSS_STATUS_SUCCESS) {
 
                        ret = fill_grent(result, &response.data.gr, 
-                                        response.extra_data.data, 
+                                        (char *)response.extra_data.data, 
                                         &buffer, &buflen);
 
                        if (ret == NSS_STATUS_TRYAGAIN) {
@@ -782,7 +785,8 @@ _nss_winbind_getgrgid_r(gid_t gid,
                /* We've been called again */
 
                ret = fill_grent(result, &response.data.gr, 
-                                response.extra_data.data, &buffer, &buflen);
+                                (char *)response.extra_data.data, &buffer,
+                                &buflen);
 
                if (ret == NSS_STATUS_TRYAGAIN) {
                        keep_response = True;
@@ -853,7 +857,9 @@ _nss_winbind_initgroups_dyn(char *user, gid_t group, long int *start,
                                        }
                                }
 
-                               newgroups = realloc((*groups), newsize * sizeof(**groups));
+                               newgroups = (gid_t *)
+                                       realloc((*groups),
+                                               newsize * sizeof(**groups));
                                if (!newgroups) {
                                        *errnop = ENOMEM;
                                        ret = NSS_STATUS_NOTFOUND;
index 21dddfa3cf552f078001c495d09abae78043f6d4..5643189afeaf018017dad1f5484cab7e5b9c31c1 100644 (file)
@@ -319,7 +319,8 @@ BOOL smb_io_relarraystr(const char *desc, RPC_BUFFER *buffer, int depth, uint16
 
                        /* Yes this should be malloc not talloc. Don't change. */
 
-                       chaine.buffer = SMB_MALLOC((q-p+1)*sizeof(uint16));
+                       chaine.buffer = (uint16 *)
+                               SMB_MALLOC((q-p+1)*sizeof(uint16));
                        if (chaine.buffer == NULL)
                                return False;
 
index f1d070530250b881a6db07d61a959ae227b18a9c..fb0d2fe5a79d03b61cebb1ab21e6f426e21a8f0e 100644 (file)
@@ -325,7 +325,7 @@ BOOL netdfs_io_dfs_Info3_d(const char *desc, NETDFS_DFS_INFO3 *v, prs_struct *ps
                        return False;
                
                if (UNMARSHALLING(ps)) {
-                       v->stores = (void *)PRS_ALLOC_MEM_VOID(ps,sizeof(*v->stores)*v->num_stores);
+                       v->stores = (NETDFS_DFS_STORAGEINFO *)PRS_ALLOC_MEM_VOID(ps,sizeof(*v->stores)*v->num_stores);
                }
                for (i_stores_1=0; i_stores_1<v->num_stores;i_stores_1++) {
                        if (!netdfs_io_dfs_StorageInfo_p("stores", &v->stores[i_stores_1], ps, depth))
@@ -447,7 +447,7 @@ BOOL netdfs_io_dfs_Info4_d(const char *desc, NETDFS_DFS_INFO4 *v, prs_struct *ps
                        return False;
                
                if (UNMARSHALLING(ps)) {
-                       v->stores = (void *)PRS_ALLOC_MEM_VOID(ps,sizeof(*v->stores)*v->num_stores);
+                       v->stores = (NETDFS_DFS_STORAGEINFO *)PRS_ALLOC_MEM_VOID(ps,sizeof(*v->stores)*v->num_stores);
                }
                for (i_stores_1=0; i_stores_1<v->num_stores;i_stores_1++) {
                        if (!netdfs_io_dfs_StorageInfo_p("stores", &v->stores[i_stores_1], ps, depth))
@@ -920,7 +920,7 @@ BOOL netdfs_io_dfs_EnumArray1_d(const char *desc, NETDFS_DFS_ENUMARRAY1 *v, prs_
                        return False;
                
                if (UNMARSHALLING(ps)) {
-                       v->s = (void *)PRS_ALLOC_MEM_VOID(ps,sizeof(*v->s)*v->count);
+                       v->s = (NETDFS_DFS_INFO1 *)PRS_ALLOC_MEM_VOID(ps,sizeof(*v->s)*v->count);
                }
                for (i_s_1=0; i_s_1<v->count;i_s_1++) {
                        if (!netdfs_io_dfs_Info1_p("s", &v->s[i_s_1], ps, depth))
@@ -986,7 +986,7 @@ BOOL netdfs_io_dfs_EnumArray2_d(const char *desc, NETDFS_DFS_ENUMARRAY2 *v, prs_
                        return False;
                
                if (UNMARSHALLING(ps)) {
-                       v->s = (void *)PRS_ALLOC_MEM_VOID(ps,sizeof(*v->s)*v->count);
+                       v->s = (NETDFS_DFS_INFO2 *)PRS_ALLOC_MEM_VOID(ps,sizeof(*v->s)*v->count);
                }
                for (i_s_1=0; i_s_1<v->count;i_s_1++) {
                        if (!netdfs_io_dfs_Info2_p("s", &v->s[i_s_1], ps, depth))
@@ -1052,7 +1052,7 @@ BOOL netdfs_io_dfs_EnumArray3_d(const char *desc, NETDFS_DFS_ENUMARRAY3 *v, prs_
                        return False;
                
                if (UNMARSHALLING(ps)) {
-                       v->s = (void *)PRS_ALLOC_MEM_VOID(ps,sizeof(*v->s)*v->count);
+                       v->s = (NETDFS_DFS_INFO3 *)PRS_ALLOC_MEM_VOID(ps,sizeof(*v->s)*v->count);
                }
                for (i_s_1=0; i_s_1<v->count;i_s_1++) {
                        if (!netdfs_io_dfs_Info3_p("s", &v->s[i_s_1], ps, depth))
@@ -1118,7 +1118,7 @@ BOOL netdfs_io_dfs_EnumArray4_d(const char *desc, NETDFS_DFS_ENUMARRAY4 *v, prs_
                        return False;
                
                if (UNMARSHALLING(ps)) {
-                       v->s = (void *)PRS_ALLOC_MEM_VOID(ps,sizeof(*v->s)*v->count);
+                       v->s = (NETDFS_DFS_INFO4 *)PRS_ALLOC_MEM_VOID(ps,sizeof(*v->s)*v->count);
                }
                for (i_s_1=0; i_s_1<v->count;i_s_1++) {
                        if (!netdfs_io_dfs_Info4_p("s", &v->s[i_s_1], ps, depth))
@@ -1184,7 +1184,7 @@ BOOL netdfs_io_dfs_EnumArray200_d(const char *desc, NETDFS_DFS_ENUMARRAY200 *v,
                        return False;
                
                if (UNMARSHALLING(ps)) {
-                       v->s = (void *)PRS_ALLOC_MEM_VOID(ps,sizeof(*v->s)*v->count);
+                       v->s = (NETDFS_DFS_INFO200 *)PRS_ALLOC_MEM_VOID(ps,sizeof(*v->s)*v->count);
                }
                for (i_s_1=0; i_s_1<v->count;i_s_1++) {
                        if (!netdfs_io_dfs_Info200_p("s", &v->s[i_s_1], ps, depth))
@@ -1250,7 +1250,7 @@ BOOL netdfs_io_dfs_EnumArray300_d(const char *desc, NETDFS_DFS_ENUMARRAY300 *v,
                        return False;
                
                if (UNMARSHALLING(ps)) {
-                       v->s = (void *)PRS_ALLOC_MEM_VOID(ps,sizeof(*v->s)*v->count);
+                       v->s = (NETDFS_DFS_INFO300 *)PRS_ALLOC_MEM_VOID(ps,sizeof(*v->s)*v->count);
                }
                for (i_s_1=0; i_s_1<v->count;i_s_1++) {
                        if (!netdfs_io_dfs_Info300_p("s", &v->s[i_s_1], ps, depth))
index d82376088f64f73f5cbf0af8140b0d55a7f21254..2dc5c2b634f8f0b09bd5ff76405cb38f343b2658 100644 (file)
@@ -1447,10 +1447,10 @@ BOOL torture_denytest1(int dummy)
                } else {
                        char x = 1;
                        res = A_0;
-                       if (cli_read(cli1, fnum2, (void *)&x, 0, 1) == 1) {
+                       if (cli_read(cli1, fnum2, (char *)&x, 0, 1) == 1) {
                                res += A_R;
                        }
-                       if (cli_write(cli1, fnum2, 0, (void *)&x, 0, 1) == 1) {
+                       if (cli_write(cli1, fnum2, 0, (char *)&x, 0, 1) == 1) {
                                res += A_W;
                        }
                }
@@ -1531,10 +1531,10 @@ BOOL torture_denytest2(int dummy)
                } else {
                        char x = 1;
                        res = A_0;
-                       if (cli_read(cli2, fnum2, (void *)&x, 0, 1) == 1) {
+                       if (cli_read(cli2, fnum2, (char *)&x, 0, 1) == 1) {
                                res += A_R;
                        }
-                       if (cli_write(cli2, fnum2, 0, (void *)&x, 0, 1) == 1) {
+                       if (cli_write(cli2, fnum2, 0, (char *)&x, 0, 1) == 1) {
                                res += A_W;
                        }
                }
index 795392ae5cb38bee08082af1f216036f7904195b..9b2d58c86eeb1c4a5745e95495008c260939e62e 100644 (file)
@@ -34,7 +34,7 @@ static struct {
        int handle;
 } ftable[MAX_FILES];
 
-static struct {
+static struct children {
        double bytes_in, bytes_out;
        int line;
        int done;
@@ -70,7 +70,7 @@ void nb_alarm(int ignore)
 void nbio_shmem(int n)
 {
        nprocs = n;
-       children = shm_setup(sizeof(*children) * nprocs);
+       children = (struct children *)shm_setup(sizeof(*children) * nprocs);
        if (!children) {
                printf("Failed to setup shared memory!\n");
                exit(1);
index e1a35b79127a126a3a9c27753b9b28ec929bdb76..8b15f9629b97bf7fea938e0073276a1f18bdcb85 100644 (file)
@@ -291,9 +291,9 @@ int main(int argc, char **argv)
 
        pdb_get_account_policy(AP_PASSWORD_HISTORY, &history);
        if (history * PW_HISTORY_ENTRY_LEN < NT_HASH_LEN) {
-               buf = TALLOC(ctx, NT_HASH_LEN);
+               buf = (uint8 *)TALLOC(ctx, NT_HASH_LEN);
        } else {
-               buf = TALLOC(ctx, history * PW_HISTORY_ENTRY_LEN);
+               buf = (uint8 *)TALLOC(ctx, history * PW_HISTORY_ENTRY_LEN);
        }
 
        /* Generate some random hashes */