1
0
mirror of https://github.com/samba-team/samba.git synced 2025-02-02 09:47:23 +03:00

r17363: Some C++ warnings

(This used to be commit fd82f185a2e0f94bfb75f4eee072556ad94bf27d)
This commit is contained in:
Volker Lendecke 2006-08-01 12:45:12 +00:00 committed by Gerald (Jerry) Carter
parent fbd04d65c5
commit 467ec2a32b
9 changed files with 45 additions and 32 deletions

View 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;

View 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;

View 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;

View 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;

View 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;

View 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))

View 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;
}
}

View 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);

View 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 */