From 02eea79624c85fb5ce6c3ffefe2d27e40c5ff97f Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Mon, 31 Jul 2006 03:53:39 +0000 Subject: r17333: Some C++ warnings (This used to be commit be9aaffdaccae06c8c035eaf31862e34b7cfbe38) --- source3/libsmb/clifile.c | 4 ++-- source3/libsmb/clilist.c | 5 +++-- source3/libsmb/clirap.c | 2 +- source3/libsmb/clireadwrite.c | 4 ++-- source3/libsmb/clistr.c | 4 ++-- source3/libsmb/clitrans.c | 8 ++++---- source3/libsmb/libsmbclient.c | 8 ++++---- source3/libsmb/smb_signing.c | 15 ++++++++++----- source3/registry/reg_cachehook.c | 4 ++-- source3/registry/reg_db.c | 4 ++-- source3/registry/reg_objects.c | 9 ++++++--- source3/registry/reg_perfcount.c | 8 ++++---- source3/registry/reg_printing.c | 4 ++-- source3/registry/regfio.c | 4 +++- 14 files changed, 47 insertions(+), 36 deletions(-) (limited to 'source3') diff --git a/source3/libsmb/clifile.c b/source3/libsmb/clifile.c index 46ff8af6d5..9beafc55fb 100644 --- a/source3/libsmb/clifile.c +++ b/source3/libsmb/clifile.c @@ -1509,7 +1509,7 @@ static BOOL cli_set_ea(struct cli_state *cli, uint16 setup, char *param, unsigne if (ea_namelen == 0 && ea_len == 0) { data_len = 4; - data = SMB_MALLOC(data_len); + data = (char *)SMB_MALLOC(data_len); if (!data) { return False; } @@ -1517,7 +1517,7 @@ static BOOL cli_set_ea(struct cli_state *cli, uint16 setup, char *param, unsigne SIVAL(p,0,data_len); } else { data_len = 4 + 4 + ea_namelen + 1 + ea_len; - data = SMB_MALLOC(data_len); + data = (char *)SMB_MALLOC(data_len); if (!data) { return False; } diff --git a/source3/libsmb/clilist.c b/source3/libsmb/clilist.c index e18bb185d5..a006c47ae0 100644 --- a/source3/libsmb/clilist.c +++ b/source3/libsmb/clilist.c @@ -335,7 +335,7 @@ int cli_list_new(struct cli_state *cli,const char *Mask,uint16 attribute, /* grab the data for later use */ /* and add them to the dirlist pool */ - dirlist = SMB_REALLOC(dirlist,dirlist_len + data_len); + dirlist = (char *)SMB_REALLOC(dirlist,dirlist_len + data_len); if (!dirlist) { DEBUG(0,("cli_list_new: Failed to expand dirlist\n")); @@ -461,7 +461,8 @@ int cli_list_old(struct cli_state *cli,const char *Mask,uint16 attribute, first = False; - dirlist = SMB_REALLOC(dirlist,(num_received + received)*DIR_STRUCT_SIZE); + dirlist = (char *)SMB_REALLOC( + dirlist,(num_received + received)*DIR_STRUCT_SIZE); if (!dirlist) { DEBUG(0,("cli_list_old: failed to expand dirlist")); return 0; diff --git a/source3/libsmb/clirap.c b/source3/libsmb/clirap.c index 26f22f2131..a33baed536 100644 --- a/source3/libsmb/clirap.c +++ b/source3/libsmb/clirap.c @@ -847,7 +847,7 @@ BOOL cli_qfileinfo_test(struct cli_state *cli, int fnum, int level, char **poutd return False; } - *poutdata = memdup(rdata, data_len); + *poutdata = (char *)memdup(rdata, data_len); if (!*poutdata) { SAFE_FREE(rdata); SAFE_FREE(rparam); diff --git a/source3/libsmb/clireadwrite.c b/source3/libsmb/clireadwrite.c index 883bc1260d..02fa804f41 100644 --- a/source3/libsmb/clireadwrite.c +++ b/source3/libsmb/clireadwrite.c @@ -265,11 +265,11 @@ static BOOL cli_issue_write(struct cli_state *cli, int fnum, off_t offset, BOOL large_writex = False; if (size > cli->bufsize) { - cli->outbuf = SMB_REALLOC(cli->outbuf, size + 1024); + cli->outbuf = (char *)SMB_REALLOC(cli->outbuf, size + 1024); if (!cli->outbuf) { return False; } - cli->inbuf = SMB_REALLOC(cli->inbuf, size + 1024); + cli->inbuf = (char *)SMB_REALLOC(cli->inbuf, size + 1024); if (cli->inbuf == NULL) { SAFE_FREE(cli->outbuf); return False; diff --git a/source3/libsmb/clistr.c b/source3/libsmb/clistr.c index c61445c073..6191f99ea9 100644 --- a/source3/libsmb/clistr.c +++ b/source3/libsmb/clistr.c @@ -49,10 +49,10 @@ size_t clistr_pull_fn(const char *function, unsigned int line, size_t clistr_align_out(struct cli_state *cli, const void *p, int flags) { - return align_string(cli->outbuf, p, flags); + return align_string(cli->outbuf, (const char *)p, flags); } size_t clistr_align_in(struct cli_state *cli, const void *p, int flags) { - return align_string(cli->inbuf, p, flags); + return align_string(cli->inbuf, (const char *)p, flags); } diff --git a/source3/libsmb/clitrans.c b/source3/libsmb/clitrans.c index 4f9f21b848..27207e72e2 100644 --- a/source3/libsmb/clitrans.c +++ b/source3/libsmb/clitrans.c @@ -207,7 +207,7 @@ BOOL cli_receive_trans(struct cli_state *cli,int trans, /* allocate it */ if (total_data!=0) { - *data = SMB_REALLOC(*data,total_data); + *data = (char *)SMB_REALLOC(*data,total_data); if (!(*data)) { DEBUG(0,("cli_receive_trans: failed to enlarge data buffer\n")); goto out; @@ -215,7 +215,7 @@ BOOL cli_receive_trans(struct cli_state *cli,int trans, } if (total_param!=0) { - *param = SMB_REALLOC(*param,total_param); + *param = (char *)SMB_REALLOC(*param,total_param); if (!(*param)) { DEBUG(0,("cli_receive_trans: failed to enlarge param buffer\n")); goto out; @@ -511,7 +511,7 @@ BOOL cli_receive_nt_trans(struct cli_state *cli, /* allocate it */ if (total_data) { - *data = SMB_REALLOC(*data,total_data); + *data = (char *)SMB_REALLOC(*data,total_data); if (!(*data)) { DEBUG(0,("cli_receive_nt_trans: failed to enlarge data buffer to %d\n",total_data)); goto out; @@ -519,7 +519,7 @@ BOOL cli_receive_nt_trans(struct cli_state *cli, } if (total_param) { - *param = SMB_REALLOC(*param,total_param); + *param = (char *)SMB_REALLOC(*param,total_param); if (!(*param)) { DEBUG(0,("cli_receive_nt_trans: failed to enlarge param buffer to %d\n", total_param)); goto out; diff --git a/source3/libsmb/libsmbclient.c b/source3/libsmb/libsmbclient.c index db788f46e9..c64c3dfb39 100644 --- a/source3/libsmb/libsmbclient.c +++ b/source3/libsmb/libsmbclient.c @@ -1281,7 +1281,7 @@ smbc_read_ctx(SMBCCTX *context, } /*d_printf(">>>fstat: resolved path as %s\n", targetpath);*/ - ret = cli_read(targetcli, file->cli_fd, buf, offset, count); + ret = cli_read(targetcli, file->cli_fd, (char *)buf, offset, count); if (ret < 0) { @@ -1365,7 +1365,7 @@ smbc_write_ctx(SMBCCTX *context, /*d_printf(">>>write: resolved path as %s\n", targetpath);*/ - ret = cli_write(targetcli, file->cli_fd, 0, buf, offset, count); + ret = cli_write(targetcli, file->cli_fd, 0, (char *)buf, offset, count); if (ret <= 0) { @@ -2246,7 +2246,7 @@ add_dirent(SMBCFILE *dir, size = sizeof(struct smbc_dirent) + name_length + comment_len + 2; - dirent = SMB_MALLOC(size); + dirent = (struct smbc_dirent *)SMB_MALLOC(size); if (!dirent) { @@ -6230,7 +6230,7 @@ smbc_init_context(SMBCCTX *context) * lazy for the moment */ pid = sys_getpid(); - context->netbios_name = SMB_MALLOC(17); + context->netbios_name = (char *)SMB_MALLOC(17); if (!context->netbios_name) { errno = ENOMEM; return NULL; diff --git a/source3/libsmb/smb_signing.c b/source3/libsmb/smb_signing.c index fd5d8bf06f..e000d539b4 100644 --- a/source3/libsmb/smb_signing.c +++ b/source3/libsmb/smb_signing.c @@ -323,7 +323,8 @@ static void simple_packet_signature(struct smb_basic_signing_context *data, static void client_sign_outgoing_message(char *outbuf, struct smb_sign_info *si) { unsigned char calc_md5_mac[16]; - struct smb_basic_signing_context *data = si->signing_context; + struct smb_basic_signing_context *data = + (struct smb_basic_signing_context *)si->signing_context; if (!si->doing_signing) return; @@ -378,7 +379,8 @@ static BOOL client_check_incoming_message(char *inbuf, struct smb_sign_info *si, unsigned char calc_md5_mac[16]; unsigned char *server_sent_mac; - struct smb_basic_signing_context *data = si->signing_context; + struct smb_basic_signing_context *data = + (struct smb_basic_signing_context *)si->signing_context; if (!si->doing_signing) return True; @@ -433,7 +435,8 @@ We were expecting seq %u\n", reply_seq_number+i, reply_seq_number )); static void simple_free_signing_context(struct smb_sign_info *si) { - struct smb_basic_signing_context *data = si->signing_context; + struct smb_basic_signing_context *data = + (struct smb_basic_signing_context *)si->signing_context; struct outstanding_packet_lookup *list; struct outstanding_packet_lookup *next; @@ -649,7 +652,8 @@ BOOL client_set_trans_sign_state_off(struct cli_state *cli, uint16 mid) static void srv_sign_outgoing_message(char *outbuf, struct smb_sign_info *si) { unsigned char calc_md5_mac[16]; - struct smb_basic_signing_context *data = si->signing_context; + struct smb_basic_signing_context *data = + (struct smb_basic_signing_context *)si->signing_context; uint32 send_seq_number = data->send_seq_num-1; uint16 mid; @@ -690,7 +694,8 @@ static void srv_sign_outgoing_message(char *outbuf, struct smb_sign_info *si) static BOOL srv_check_incoming_message(char *inbuf, struct smb_sign_info *si, BOOL must_be_ok) { BOOL good; - struct smb_basic_signing_context *data = si->signing_context; + struct smb_basic_signing_context *data = + (struct smb_basic_signing_context *)si->signing_context; uint32 reply_seq_number = data->send_seq_num; uint32 saved_seq; unsigned char calc_md5_mac[16]; diff --git a/source3/registry/reg_cachehook.c b/source3/registry/reg_cachehook.c index 32885be8e2..ae8420776a 100644 --- a/source3/registry/reg_cachehook.c +++ b/source3/registry/reg_cachehook.c @@ -79,7 +79,7 @@ REGISTRY_HOOK* reghook_cache_find( const char *keyname ) /* prepend the string with a '\' character */ len = strlen( keyname ); - if ( !(key = SMB_MALLOC( len + 2 )) ) { + if ( !(key = (char *)SMB_MALLOC( len + 2 )) ) { DEBUG(0,("reghook_cache_find: malloc failed for string [%s] !?!?!\n", keyname)); return NULL; @@ -94,7 +94,7 @@ REGISTRY_HOOK* reghook_cache_find( const char *keyname ) DEBUG(10,("reghook_cache_find: Searching for keyname [%s]\n", key)); - hook = pathtree_find( cache_tree, key ) ; + hook = (REGISTRY_HOOK *)pathtree_find( cache_tree, key ) ; SAFE_FREE( key ); diff --git a/source3/registry/reg_db.c b/source3/registry/reg_db.c index d73b27521d..b05e4957b8 100644 --- a/source3/registry/reg_db.c +++ b/source3/registry/reg_db.c @@ -313,7 +313,7 @@ static BOOL regdb_store_keys_internal( const char *key, REGSUBKEY_CTR *ctr ) /* allocate some initial memory */ - if (!(buffer = SMB_MALLOC(sizeof(pstring)))) { + if (!(buffer = (char *)SMB_MALLOC(sizeof(pstring)))) { return False; } buflen = sizeof(pstring); @@ -329,7 +329,7 @@ static BOOL regdb_store_keys_internal( const char *key, REGSUBKEY_CTR *ctr ) len += tdb_pack( buffer+len, buflen-len, "f", regsubkey_ctr_specific_key(ctr, i) ); if ( len > buflen ) { /* allocate some extra space */ - if ((buffer = SMB_REALLOC( buffer, len*2 )) == NULL) { + if ((buffer = (char *)SMB_REALLOC( buffer, len*2 )) == NULL) { DEBUG(0,("regdb_store_keys: Failed to realloc memory of size [%d]\n", len*2)); ret = False; goto done; diff --git a/source3/registry/reg_objects.c b/source3/registry/reg_objects.c index 33c2660331..2a898f0170 100644 --- a/source3/registry/reg_objects.c +++ b/source3/registry/reg_objects.c @@ -177,7 +177,8 @@ REGISTRY_VALUE* dup_registry_value( REGISTRY_VALUE *val ) if ( val->data_p && val->size ) { - if ( !(copy->data_p = memdup( val->data_p, val->size )) ) { + if ( !(copy->data_p = (uint8 *)memdup( val->data_p, + val->size )) ) { DEBUG(0,("dup_registry_value: memdup() failed for [%d] bytes!\n", val->size)); SAFE_FREE( copy ); @@ -302,7 +303,8 @@ int regval_ctr_addvalue( REGVAL_CTR *ctr, const char *name, uint16 type, fstrcpy( ctr->values[ctr->num_values]->valuename, name ); ctr->values[ctr->num_values]->type = type; - ctr->values[ctr->num_values]->data_p = TALLOC_MEMDUP( ctr, data_p, size ); + ctr->values[ctr->num_values]->data_p = (uint8 *)TALLOC_MEMDUP( + ctr, data_p, size ); ctr->values[ctr->num_values]->size = size; ctr->num_values++; @@ -341,7 +343,8 @@ int regval_ctr_copyvalue( REGVAL_CTR *ctr, REGISTRY_VALUE *val ) fstrcpy( ctr->values[ctr->num_values]->valuename, val->valuename ); ctr->values[ctr->num_values]->type = val->type; - ctr->values[ctr->num_values]->data_p = TALLOC_MEMDUP( ctr, val->data_p, val->size ); + ctr->values[ctr->num_values]->data_p = (uint8 *)TALLOC_MEMDUP( + ctr, val->data_p, val->size ); ctr->values[ctr->num_values]->size = val->size; ctr->num_values++; } diff --git a/source3/registry/reg_perfcount.c b/source3/registry/reg_perfcount.c index a0edf4513f..febae62ad0 100644 --- a/source3/registry/reg_perfcount.c +++ b/source3/registry/reg_perfcount.c @@ -177,7 +177,7 @@ static uint32 _reg_perfcount_multi_sz_from_tdb(TDB_CONTEXT *tdb, } /* First encode the name_index */ working_size = (kbuf.dsize + 1)*sizeof(uint16); - buf1 = SMB_REALLOC(buf1, buffer_size + working_size); + buf1 = (char *)SMB_REALLOC(buf1, buffer_size + working_size); if(!buf1) { buffer_size = 0; return buffer_size; @@ -187,7 +187,7 @@ static uint32 _reg_perfcount_multi_sz_from_tdb(TDB_CONTEXT *tdb, buffer_size += working_size; /* Now encode the actual name */ working_size = (dbuf.dsize + 1)*sizeof(uint16); - buf1 = SMB_REALLOC(buf1, buffer_size + working_size); + buf1 = (char *)SMB_REALLOC(buf1, buffer_size + working_size); if(!buf1) { buffer_size = 0; return buffer_size; @@ -234,7 +234,7 @@ uint32 reg_perfcount_get_counter_help(uint32 base_index, char **retbuf) /* Now terminate the MULTI_SZ with a double unicode NULL */ buf1 = *retbuf; - buf1 = SMB_REALLOC(buf1, buffer_size + 2); + buf1 = (char *)SMB_REALLOC(buf1, buffer_size + 2); if(!buf1) { buffer_size = 0; } else { @@ -279,7 +279,7 @@ uint32 reg_perfcount_get_counter_names(uint32 base_index, char **retbuf) /* Now terminate the MULTI_SZ with a double unicode NULL */ buf1 = *retbuf; - buf1 = SMB_REALLOC(buf1, buffer_size + 2); + buf1 = (char *)SMB_REALLOC(buf1, buffer_size + 2); if(!buf1) { buffer_size = 0; } else { diff --git a/source3/registry/reg_printing.c b/source3/registry/reg_printing.c index 338bc7af6a..d8c25d802d 100644 --- a/source3/registry/reg_printing.c +++ b/source3/registry/reg_printing.c @@ -922,7 +922,7 @@ static void fill_in_driver_values( NT_PRINTER_DRIVER_INFO_LEVEL_3 *info3, REGVAL length = strlen(filename); - buffer = SMB_REALLOC( buffer, buffer_size + (length + 1)*sizeof(uint16) ); + buffer = (char *)SMB_REALLOC( buffer, buffer_size + (length + 1)*sizeof(uint16) ); if ( !buffer ) { break; } @@ -935,7 +935,7 @@ static void fill_in_driver_values( NT_PRINTER_DRIVER_INFO_LEVEL_3 *info3, REGVAL /* terminated by double NULL. Add the final one here */ - buffer = SMB_REALLOC( buffer, buffer_size + 2 ); + buffer = (char *)SMB_REALLOC( buffer, buffer_size + 2 ); if ( !buffer ) { buffer_size = 0; } else { diff --git a/source3/registry/regfio.c b/source3/registry/regfio.c index f164d4e19d..768255a9fa 100644 --- a/source3/registry/regfio.c +++ b/source3/registry/regfio.c @@ -1646,7 +1646,9 @@ static BOOL create_vk_record( REGF_FILE *file, REGF_VK_REC *vk, REGISTRY_VALUE * if ( vk->data_size > sizeof(uint32) ) { uint32 data_size = ( (vk->data_size+sizeof(uint32)) & 0xfffffff8 ) + 8; - vk->data = TALLOC_MEMDUP( file->mem_ctx, regval_data_p(value), vk->data_size ); + vk->data = (uint8 *)TALLOC_MEMDUP( file->mem_ctx, + regval_data_p(value), + vk->data_size ); if (vk->data == NULL) { return False; } -- cgit