Author: vlendec Date: 2006-08-18 14:05:25 +0000 (Fri, 18 Aug 2006) New Revision: 17605
WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=17605 Log: Some C++ warnings Modified: branches/SAMBA_3_0/source/client/mount.cifs.c branches/SAMBA_3_0/source/nsswitch/winbindd_async.c branches/SAMBA_3_0/source/nsswitch/winbindd_cred_cache.c branches/SAMBA_3_0/source/nsswitch/winbindd_dual.c branches/SAMBA_3_0/source/nsswitch/winbindd_group.c branches/SAMBA_3_0/source/nsswitch/winbindd_misc.c branches/SAMBA_3_0/source/nsswitch/winbindd_pam.c branches/SAMBA_3_0/source/nsswitch/winbindd_sid.c branches/SAMBA_3_0/source/nsswitch/winbindd_user.c branches/SAMBA_3_0/source/nsswitch/winbindd_util.c Changeset: Modified: branches/SAMBA_3_0/source/client/mount.cifs.c =================================================================== --- branches/SAMBA_3_0/source/client/mount.cifs.c 2006-08-18 13:37:36 UTC (rev 17604) +++ branches/SAMBA_3_0/source/client/mount.cifs.c 2006-08-18 14:05:25 UTC (rev 17605) @@ -143,7 +143,7 @@ fs = fopen(file_name,"r"); if(fs == NULL) return errno; - line_buf = malloc(4096); + line_buf = (char *)malloc(4096); if(line_buf == NULL) { fclose(fs); return -ENOMEM; @@ -176,7 +176,7 @@ exit(1); } else { got_user = 1; - user_name = calloc(1 + length,1); + user_name = (char *)calloc(1 + length,1); /* BB adding free of user_name string before exit, not really necessary but would be cleaner */ strncpy(user_name,temp_val, length); @@ -200,7 +200,7 @@ exit(1); } else { if(mountpassword == NULL) { - mountpassword = calloc(65,1); + mountpassword = (char *)calloc(65,1); } else memset(mountpassword,0,64); if(mountpassword) { @@ -228,7 +228,7 @@ exit(1); } else { if(domain_name == NULL) { - domain_name = calloc(65,1); + domain_name = (char *)calloc(65,1); } else memset(domain_name,0,64); if(domain_name) { @@ -255,7 +255,7 @@ char c; if(mountpassword == NULL) - mountpassword = calloc(65,1); + mountpassword = (char *)calloc(65,1); else memset(mountpassword, 0, 64); @@ -374,7 +374,7 @@ if(percent_char) { *percent_char = ','; if(mountpassword == NULL) - mountpassword = calloc(65,1); + mountpassword = (char *)calloc(65,1); if(mountpassword) { if(got_password) printf("\nmount.cifs warning - password specified twice\n"); @@ -596,7 +596,7 @@ if (value) word_len += 1 + strlen(value); - out = realloc(out, out_len + word_len + 2); + out = (char *)realloc(out, out_len + word_len + 2); if (out == NULL) { perror("malloc"); exit(1); @@ -646,7 +646,7 @@ return; } - new_pass_buf = malloc(len+number_of_commas+1); + new_pass_buf = (char *)malloc(len+number_of_commas+1); if(new_pass_buf == NULL) return; @@ -710,7 +710,7 @@ len = strlen(domainnm); /* reset domainm to new buffer, and copy domain name into it */ - domainnm = malloc(len+1); + domainnm = (char *)malloc(len+1); if(domainnm == NULL) return NULL; @@ -769,7 +769,7 @@ share = strchr(unc_name,':'); if(share) { free_share_name = 1; - *punc_name = malloc(length+3); + *punc_name = (char *)malloc(length+3); if(*punc_name == NULL) { /* put the original string back if no memory left */ @@ -1030,7 +1030,7 @@ break; case 'p': if(mountpassword == NULL) - mountpassword = calloc(65,1); + mountpassword = (char *)calloc(65,1); if(mountpassword) { got_password = 1; strncpy(mountpassword,optarg,64); @@ -1055,7 +1055,7 @@ if (getenv("PASSWD")) { if(mountpassword == NULL) - mountpassword = calloc(65,1); + mountpassword = (char *)calloc(65,1); if(mountpassword) { strncpy(mountpassword,getenv("PASSWD"),64); got_password = 1; @@ -1075,7 +1075,7 @@ } /* BB save off path and pop after mount returns? */ - resolved_path = malloc(PATH_MAX+1); + resolved_path = (char *)malloc(PATH_MAX+1); if(resolved_path) { /* Note that if we can not canonicalize the name, we get another chance to see if it is valid when we chdir to it */ @@ -1141,7 +1141,7 @@ optlen += strlen(ipaddr) + 4; if(mountpassword) optlen += strlen(mountpassword) + 6; - options = malloc(optlen + 10 + 64 /* space for commas in password */ + 8 /* space for domain= , domain name itself was counted as part of the length username string above */); + options = (char *)malloc(optlen + 10 + 64 /* space for commas in password */ + 8 /* space for domain= , domain name itself was counted as part of the length username string above */); if(options == NULL) { printf("Could not allocate memory for mount options\n"); @@ -1233,7 +1233,7 @@ mountent.mnt_fsname = share_name; mountent.mnt_dir = mountpoint; mountent.mnt_type = CONST_DISCARD(char *,"cifs"); - mountent.mnt_opts = malloc(220); + mountent.mnt_opts = (char *)malloc(220); if(mountent.mnt_opts) { char * mount_user = getusername(); memset(mountent.mnt_opts,0,200); Modified: branches/SAMBA_3_0/source/nsswitch/winbindd_async.c =================================================================== --- branches/SAMBA_3_0/source/nsswitch/winbindd_async.c 2006-08-18 13:37:36 UTC (rev 17604) +++ branches/SAMBA_3_0/source/nsswitch/winbindd_async.c 2006-08-18 14:05:25 UTC (rev 17605) @@ -1532,7 +1532,8 @@ struct winbindd_response *response, void *c, void *private_data) { - void (*cont)(void *priv, BOOL succ, const char *sid) = c; + void (*cont)(void *priv, BOOL succ, const char *sid) = + (void (*)(void *, BOOL, const char *))c; if (!success) { DEBUG(5, ("Could not trigger uid2sid\n")); @@ -1587,7 +1588,8 @@ struct winbindd_response *response, void *c, void *private_data) { - void (*cont)(void *priv, BOOL succ, const char *sid) = c; + void (*cont)(void *priv, BOOL succ, const char *sid) = + (void (*)(void *, BOOL, const char *))c; if (!success) { DEBUG(5, ("Could not trigger gid2sid\n")); Modified: branches/SAMBA_3_0/source/nsswitch/winbindd_cred_cache.c =================================================================== --- branches/SAMBA_3_0/source/nsswitch/winbindd_cred_cache.c 2006-08-18 13:37:36 UTC (rev 17604) +++ branches/SAMBA_3_0/source/nsswitch/winbindd_cred_cache.c 2006-08-18 14:05:25 UTC (rev 17605) @@ -249,7 +249,7 @@ #ifdef HAVE_MLOCK size_t len = strlen(pass)+1; - new_entry->pass = TALLOC_ZERO(mem_ctx, len); + new_entry->pass = (char *)TALLOC_ZERO(mem_ctx, len); NT_STATUS_HAVE_NO_MEMORY(new_entry->pass); #ifdef DEBUG_PASSWORD Modified: branches/SAMBA_3_0/source/nsswitch/winbindd_dual.c =================================================================== --- branches/SAMBA_3_0/source/nsswitch/winbindd_dual.c 2006-08-18 13:37:36 UTC (rev 17604) +++ branches/SAMBA_3_0/source/nsswitch/winbindd_dual.c 2006-08-18 14:05:25 UTC (rev 17605) @@ -524,7 +524,8 @@ const struct timeval *now, void *private_data) { - struct winbindd_child *child = private_data; + struct winbindd_child *child = + (struct winbindd_child *)private_data; struct winbindd_methods *methods; SAM_UNK_INFO_12 lockout_policy; @@ -823,7 +824,8 @@ * structure needs to be fetched via the * winbindd_cache. Hmm. That needs fixing... */ - if (write_data(state.sock, (void *)&state.response.result, + if (write_data(state.sock, + (const char *)&state.response.result, sizeof(state.response.result)) != sizeof(state.response.result)) { DEBUG(0, ("Could not write result\n")); Modified: branches/SAMBA_3_0/source/nsswitch/winbindd_group.c =================================================================== --- branches/SAMBA_3_0/source/nsswitch/winbindd_group.c 2006-08-18 13:37:36 UTC (rev 17604) +++ branches/SAMBA_3_0/source/nsswitch/winbindd_group.c 2006-08-18 14:05:25 UTC (rev 17605) @@ -168,7 +168,7 @@ /* Allocate buffer */ if (!buf && buf_len != 0) { - if (!(buf = SMB_MALLOC(buf_len))) { + if (!(buf = (char *)SMB_MALLOC(buf_len))) { DEBUG(1, ("out of memory\n")); result = False; goto done; @@ -730,7 +730,7 @@ break; } - name_list = ent->sam_entries; + name_list = (struct acct_info *)ent->sam_entries; if (!(domain = find_domain_from_name(ent->domain_name))) { @@ -813,7 +813,8 @@ if (result) { /* Append to group membership list */ - gr_mem_list = SMB_REALLOC( gr_mem_list, gr_mem_list_len + gr_mem_len); + gr_mem_list = (char *)SMB_REALLOC( + gr_mem_list, gr_mem_list_len + gr_mem_len); if (!gr_mem_list && (group_list[group_list_ndx].num_gr_mem != 0)) { DEBUG(0, ("out of memory\n")); @@ -941,7 +942,8 @@ /* Allocate some memory for extra data. Note that we limit account names to sizeof(fstring) = 128 characters. */ - extra_data = SMB_REALLOC(extra_data, sizeof(fstring) * total_entries); + extra_data = (char *)SMB_REALLOC( + extra_data, sizeof(fstring) * total_entries); if (!extra_data) { DEBUG(0,("failed to enlarge buffer!\n")); @@ -1072,7 +1074,8 @@ static void getgroups_usersid_recv(void *private_data, BOOL success, const DOM_SID *sid, enum SID_NAME_USE type) { - struct getgroups_state *s = private_data; + struct getgroups_state *s = + (struct getgroups_state *)private_data; if ((!success) || ((type != SID_NAME_USER) && (type != SID_NAME_COMPUTER))) { @@ -1089,7 +1092,8 @@ static void getgroups_tokensids_recv(void *private_data, BOOL success, DOM_SID *token_sids, size_t num_token_sids) { - struct getgroups_state *s = private_data; + struct getgroups_state *s = + (struct getgroups_state *)private_data; /* We need at least the user sid and the primary group in the token, * otherwise it's an error */ @@ -1111,7 +1115,8 @@ static void getgroups_sid2gid_recv(void *private_data, BOOL success, gid_t gid) { - struct getgroups_state *s = private_data; + struct getgroups_state *s = + (struct getgroups_state *)private_data; if (success) add_gid_to_array_unique(NULL, gid, @@ -1181,7 +1186,8 @@ static void getusersids_recv(void *private_data, BOOL success, DOM_SID *sids, size_t num_sids) { - struct winbindd_cli_state *state = private_data; + struct winbindd_cli_state *state = + (struct winbindd_cli_state *)private_data; char *ret = NULL; unsigned ofs, ret_size = 0; size_t i; @@ -1198,7 +1204,7 @@ } /* build the reply */ - ret = SMB_MALLOC(ret_size); + ret = (char *)SMB_MALLOC(ret_size); if (!ret) { DEBUG(0, ("malloc failed\n")); request_error(state); Modified: branches/SAMBA_3_0/source/nsswitch/winbindd_misc.c =================================================================== --- branches/SAMBA_3_0/source/nsswitch/winbindd_misc.c 2006-08-18 13:37:36 UTC (rev 17604) +++ branches/SAMBA_3_0/source/nsswitch/winbindd_misc.c 2006-08-18 14:05:25 UTC (rev 17605) @@ -301,7 +301,8 @@ static void sequence_recv(void *private_data, BOOL success) { - struct sequence_state *state = private_data; + struct sequence_state *state = + (struct sequence_state *)private_data; uint32 seq = DOM_SEQUENCE_NONE; if ((success) && (state->response->result == WINBINDD_OK)) @@ -422,7 +423,8 @@ static void domain_info_init_recv(void *private_data, BOOL success) { - struct domain_info_state *istate = private_data; + struct domain_info_state *istate = + (struct domain_info_state *)private_data; struct winbindd_cli_state *state = istate->cli_state; struct winbindd_domain *domain = istate->domain; Modified: branches/SAMBA_3_0/source/nsswitch/winbindd_pam.c =================================================================== --- branches/SAMBA_3_0/source/nsswitch/winbindd_pam.c 2006-08-18 13:37:36 UTC (rev 17604) +++ branches/SAMBA_3_0/source/nsswitch/winbindd_pam.c 2006-08-18 14:05:25 UTC (rev 17605) @@ -104,7 +104,7 @@ return NT_STATUS_NO_MEMORY; } memset( state->response.extra_data.data, '\0', size ); - prs_copy_all_data_out(state->response.extra_data.data, &ps); + prs_copy_all_data_out((char *)state->response.extra_data.data, &ps); state->response.length += size; prs_mem_free(&ps); return NT_STATUS_OK; @@ -1370,9 +1370,10 @@ state->response.extra_data.data = afs_createtoken_str(afsname, cell); - if (state->response.extra_data.data != NULL) + if (state->response.extra_data.data != NULL) { state->response.length += - strlen(state->response.extra_data.data)+1; + strlen((const char *)state->response.extra_data.data)+1; + } no_token: TALLOC_FREE(afsname); @@ -1622,7 +1623,8 @@ result = NT_STATUS_NO_MEMORY; goto done; } - state->response.length += strlen(state->response.extra_data.data)+1; + state->response.length += + strlen((const char *)state->response.extra_data.data)+1; } if (state->request.flags & WBFLAG_PAM_USER_SESSION_KEY) { Modified: branches/SAMBA_3_0/source/nsswitch/winbindd_sid.c =================================================================== --- branches/SAMBA_3_0/source/nsswitch/winbindd_sid.c 2006-08-18 13:37:36 UTC (rev 17604) +++ branches/SAMBA_3_0/source/nsswitch/winbindd_sid.c 2006-08-18 14:05:25 UTC (rev 17605) @@ -328,7 +328,8 @@ static void uid2sid_recv(void *private_data, BOOL success, const char *sid) { - struct winbindd_cli_state *state = private_data; + struct winbindd_cli_state *state = + (struct winbindd_cli_state *)private_data; struct uid2sid_state *uid2sid_state; if (success) { @@ -472,7 +473,8 @@ static void gid2sid_recv(void *private_data, BOOL success, const char *sid) { - struct winbindd_cli_state *state = private_data; + struct winbindd_cli_state *state = + (struct winbindd_cli_state *)private_data; struct gid2sid_state *gid2sid_state; if (success) { @@ -562,7 +564,8 @@ static void gid2sid_idmap_set_mapping_recv(void *private_data, BOOL success) { - struct gid2sid_state *state = private_data; + struct gid2sid_state *state = + (struct gid2sid_state *)private_data; /* don't fail if we can't store it */ Modified: branches/SAMBA_3_0/source/nsswitch/winbindd_user.c =================================================================== --- branches/SAMBA_3_0/source/nsswitch/winbindd_user.c 2006-08-18 13:37:36 UTC (rev 17604) +++ branches/SAMBA_3_0/source/nsswitch/winbindd_user.c 2006-08-18 14:05:25 UTC (rev 17605) @@ -362,7 +362,8 @@ static void getpwnam_name2sid_recv(void *private_data, BOOL success, const DOM_SID *sid, enum SID_NAME_USE type) { - struct winbindd_cli_state *state = private_data; + struct winbindd_cli_state *state = + (struct winbindd_cli_state *)private_data; if (!success) { DEBUG(5, ("Could not lookup name for user %s\n", @@ -382,7 +383,8 @@ static void getpwuid_recv(void *private_data, BOOL success, const char *sid) { - struct winbindd_cli_state *state = private_data; + struct winbindd_cli_state *state = + (struct winbindd_cli_state *)private_data; DOM_SID user_sid; if (!success) { @@ -692,7 +694,7 @@ break; } - name_list = ent->sam_entries; + name_list = (struct getpwent_user *)ent->sam_entries; /* Lookup user info */ @@ -778,7 +780,8 @@ /* Allocate some memory for extra data */ total_entries += num_entries; - extra_data = SMB_REALLOC(extra_data, sizeof(fstring) * total_entries); + extra_data = (char *)SMB_REALLOC( + extra_data, sizeof(fstring) * total_entries); if (!extra_data) { DEBUG(0,("failed to enlarge buffer!\n")); Modified: branches/SAMBA_3_0/source/nsswitch/winbindd_util.c =================================================================== --- branches/SAMBA_3_0/source/nsswitch/winbindd_util.c 2006-08-18 13:37:36 UTC (rev 17604) +++ branches/SAMBA_3_0/source/nsswitch/winbindd_util.c 2006-08-18 14:05:25 UTC (rev 17605) @@ -236,7 +236,7 @@ return; } - p = response->extra_data.data; + p = (char *)response->extra_data.data; while ((p != NULL) && (*p != '\0')) { char *q, *sidstr, *alt_name;
