From e23781b3b304d1e69ad80af5ae9c0ed8d02cf996 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Sun, 30 Jul 2006 16:36:56 +0000 Subject: r17316: More C++ warnings -- 456 left (This used to be commit 1e4ee728df7eeafc1b4d533240acb032f73b4f5c) --- source3/include/smb_macros.h | 2 +- source3/lib/data_blob.c | 8 ++++---- source3/lib/messages.c | 4 ++-- source3/lib/util_file.c | 2 +- source3/lib/util_sid.c | 4 ++-- source3/lib/util_str.c | 15 ++++++++------- source3/lib/util_unistr.c | 14 ++++++++------ source3/modules/vfs_posixacl.c | 10 +++++----- source3/rpc_client/cli_echo.c | 2 +- source3/rpc_client/cli_spoolss.c | 7 ++++--- source3/rpc_parse/parse_misc.c | 8 +++++--- source3/rpc_parse/parse_prs.c | 13 +++++++------ source3/rpc_server/srv_eventlog_lib.c | 4 ++-- source3/rpcclient/cmd_echo.c | 4 ++-- source3/rpcclient/cmd_spoolss.c | 6 ++++-- source3/smbd/ipc.c | 4 ++-- source3/smbd/nttrans.c | 8 ++++---- source3/smbd/trans2.c | 6 +++--- source3/utils/net_rpc_printer.c | 4 ++-- 19 files changed, 67 insertions(+), 58 deletions(-) diff --git a/source3/include/smb_macros.h b/source3/include/smb_macros.h index e296ddd140..44f15734d9 100644 --- a/source3/include/smb_macros.h +++ b/source3/include/smb_macros.h @@ -285,7 +285,7 @@ copy an IP address from one buffer to another #define SMB_XMALLOC_ARRAY(type,count) (type *)smb_xmalloc_array(sizeof(type),(count)) /* limiting size of ipc replies */ -#define SMB_REALLOC_LIMIT(ptr,size) SMB_REALLOC(ptr,MAX((size),4*1024)) +#define SMB_REALLOC_LIMIT(ptr,size) (char *)SMB_REALLOC(ptr,MAX((size),4*1024)) /* The new talloc is paranoid malloc checker safe. */ diff --git a/source3/lib/data_blob.c b/source3/lib/data_blob.c index 860ef5ad10..4d5dda2435 100644 --- a/source3/lib/data_blob.c +++ b/source3/lib/data_blob.c @@ -47,9 +47,9 @@ DATA_BLOB data_blob(const void *p, size_t length) } if (p) { - ret.data = smb_xmemdup(p, length); + ret.data = (uint8 *)smb_xmemdup(p, length); } else { - ret.data = SMB_XMALLOC_ARRAY(unsigned char, length); + ret.data = SMB_XMALLOC_ARRAY(uint8, length); } ret.length = length; ret.free = free_data_blob; @@ -70,11 +70,11 @@ DATA_BLOB data_blob_talloc(TALLOC_CTX *mem_ctx, const void *p, size_t length) } if (p) { - ret.data = TALLOC_MEMDUP(mem_ctx, p, length); + ret.data = (uint8 *)TALLOC_MEMDUP(mem_ctx, p, length); if (ret.data == NULL) smb_panic("data_blob_talloc: talloc_memdup failed.\n"); } else { - ret.data = TALLOC(mem_ctx, length); + ret.data = (uint8 *)TALLOC(mem_ctx, length); if (ret.data == NULL) smb_panic("data_blob_talloc: talloc failed.\n"); } diff --git a/source3/lib/messages.c b/source3/lib/messages.c index 410e4af659..93e12ebe35 100644 --- a/source3/lib/messages.c +++ b/source3/lib/messages.c @@ -104,7 +104,7 @@ static void sig_usr1(void) static void ping_message(int msg_type, struct process_id src, void *buf, size_t len) { - const char *msg = buf ? buf : "none"; + const char *msg = buf ? (const char *)buf : "none"; DEBUG(1,("INFO: Received PING message from PID %s [%s]\n", procid_str_static(&src), msg)); @@ -236,7 +236,7 @@ static BOOL message_send_pid_internal(struct process_id pid, int msg_type, kbuf = message_key_pid(pid); - dbuf.dptr = (void *)SMB_MALLOC(len + sizeof(rec)); + dbuf.dptr = (char *)SMB_MALLOC(len + sizeof(rec)); if (!dbuf.dptr) return False; diff --git a/source3/lib/util_file.c b/source3/lib/util_file.c index ed7be3f6c1..77ee95cc38 100644 --- a/source3/lib/util_file.c +++ b/source3/lib/util_file.c @@ -353,7 +353,7 @@ char *file_pload(char *syscmd, size_t *size) total = 0; while ((n = read(fd, buf, sizeof(buf))) > 0) { - p = SMB_REALLOC(p, total + n + 1); + p = (char *)SMB_REALLOC(p, total + n + 1); if (!p) { DEBUG(0,("file_pload: failed to expand buffer!\n")); close(fd); diff --git a/source3/lib/util_sid.c b/source3/lib/util_sid.c index 09fe30f81b..4d31080ec9 100644 --- a/source3/lib/util_sid.c +++ b/source3/lib/util_sid.c @@ -531,7 +531,7 @@ char *sid_binstring(const DOM_SID *sid) { char *buf, *s; int len = sid_size(sid); - buf = SMB_MALLOC(len); + buf = (char *)SMB_MALLOC(len); if (!buf) return NULL; sid_linearize(buf, len, sid); @@ -549,7 +549,7 @@ char *sid_binstring_hex(const DOM_SID *sid) { char *buf, *s; int len = sid_size(sid); - buf = SMB_MALLOC(len); + buf = (char *)SMB_MALLOC(len); if (!buf) return NULL; sid_linearize(buf, len, sid); diff --git a/source3/lib/util_str.c b/source3/lib/util_str.c index 2580521c3b..6677d075bd 100644 --- a/source3/lib/util_str.c +++ b/source3/lib/util_str.c @@ -1074,7 +1074,7 @@ char *realloc_string_sub(char *string, const char *pattern, while ((p = strstr_m(s,pattern))) { if (ld > 0) { int offset = PTR_DIFF(s,string); - string = SMB_REALLOC(string, ls + ld + 1); + string = (char *)SMB_REALLOC(string, ls + ld + 1); if (!string) { DEBUG(0, ("realloc_string_sub: out of memory!\n")); SAFE_FREE(in); @@ -1143,7 +1143,8 @@ char *talloc_string_sub(TALLOC_CTX *mem_ctx, const char *src, while ((p = strstr_m(s,pattern))) { if (ld > 0) { int offset = PTR_DIFF(s,string); - string = TALLOC_REALLOC(mem_ctx, string, ls + ld + 1); + string = (char *)TALLOC_REALLOC(mem_ctx, string, + ls + ld + 1); if (!string) { DEBUG(0, ("talloc_string_sub: out of " "memory!\n")); @@ -1602,7 +1603,7 @@ char *binary_string_rfc2254(char *buf, int len) char *s; int i, j; const char *hex = "0123456789ABCDEF"; - s = SMB_MALLOC(len * 3 + 1); + s = (char *)SMB_MALLOC(len * 3 + 1); if (!s) return NULL; for (j=i=0;ia_type) { case SMB_ACL_USER: { - uid_t *puid = acl_get_qualifier(posix_ace); + uid_t *puid = (uid_t *)acl_get_qualifier(posix_ace); if (puid == NULL) { DEBUG(0, ("smb_acl_get_qualifier failed\n")); return False; @@ -183,7 +183,7 @@ static BOOL smb_ace_to_internal(acl_entry_t posix_ace, } case SMB_ACL_GROUP: { - gid_t *pgid = acl_get_qualifier(posix_ace); + gid_t *pgid = (uid_t *)acl_get_qualifier(posix_ace); if (pgid == NULL) { DEBUG(0, ("smb_acl_get_qualifier failed\n")); return False; @@ -219,9 +219,9 @@ static struct smb_acl_t *smb_acl_to_internal(acl_t acl) entry_id = ACL_NEXT_ENTRY; - result = SMB_REALLOC(result, sizeof(struct smb_acl_t) + - (sizeof(struct smb_acl_entry) * - (result->count+1))); + result = (struct smb_acl_t *)SMB_REALLOC( + result, sizeof(struct smb_acl_t) + + (sizeof(struct smb_acl_entry) * (result->count+1))); if (result == NULL) { DEBUG(0, ("SMB_REALLOC failed\n")); errno = ENOMEM; diff --git a/source3/rpc_client/cli_echo.c b/source3/rpc_client/cli_echo.c index 9818fad79b..b76b6e285f 100644 --- a/source3/rpc_client/cli_echo.c +++ b/source3/rpc_client/cli_echo.c @@ -78,7 +78,7 @@ NTSTATUS rpccli_echo_data(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, result = True; if (out_data) { - *out_data = TALLOC(mem_ctx, size); + *out_data = (char *)TALLOC(mem_ctx, size); if (!*out_data) { return NT_STATUS_NO_MEMORY; } diff --git a/source3/rpc_client/cli_spoolss.c b/source3/rpc_client/cli_spoolss.c index d6d4417da3..75c617c944 100644 --- a/source3/rpc_client/cli_spoolss.c +++ b/source3/rpc_client/cli_spoolss.c @@ -1609,7 +1609,7 @@ WERROR rpccli_spoolss_getprinterdata(struct rpc_pipe_client *cli, TALLOC_CTX *me /* Return output parameters */ - value->data_p = TALLOC_MEMDUP(mem_ctx, out.data, out.needed); + value->data_p = (uint8 *)TALLOC_MEMDUP(mem_ctx, out.data, out.needed); value->type = out.type; value->size = out.size; @@ -1662,7 +1662,7 @@ WERROR rpccli_spoolss_getprinterdataex(struct rpc_pipe_client *cli, TALLOC_CTX * /* Return output parameters */ - value->data_p = TALLOC_MEMDUP(mem_ctx, out.data, out.needed); + value->data_p = (uint8 *)TALLOC_MEMDUP(mem_ctx, out.data, out.needed); value->type = out.type; value->size = out.needed; @@ -1758,7 +1758,8 @@ WERROR rpccli_spoolss_enumprinterdata(struct rpc_pipe_client *cli, TALLOC_CTX *m if (value) { rpcstr_pull(value->valuename, out.value, sizeof(value->valuename), -1, STR_TERMINATE); - value->data_p = TALLOC_MEMDUP(mem_ctx, out.data, out.realdatasize); + value->data_p = (uint8 *)TALLOC_MEMDUP(mem_ctx, out.data, + out.realdatasize); value->type = out.type; value->size = out.realdatasize; } diff --git a/source3/rpc_parse/parse_misc.c b/source3/rpc_parse/parse_misc.c index cb7c06eb45..532b7ccc7f 100644 --- a/source3/rpc_parse/parse_misc.c +++ b/source3/rpc_parse/parse_misc.c @@ -518,7 +518,7 @@ BOOL smb_io_unistr(const char *desc, UNISTR *uni, prs_struct *ps, int depth) size_t create_rpc_blob(RPC_DATA_BLOB *str, size_t len) { - str->buffer = TALLOC_ZERO(get_talloc_ctx(), len); + str->buffer = (uint8 *)TALLOC_ZERO(get_talloc_ctx(), len); if (str->buffer == NULL) smb_panic("create_rpc_blob: talloc fail\n"); return len; @@ -617,7 +617,8 @@ void init_regval_buffer(REGVAL_BUFFER *str, const uint8 *buf, size_t len) if (buf != NULL) { SMB_ASSERT(str->buf_max_len >= str->buf_len); - str->buffer = TALLOC_ZERO(get_talloc_ctx(), str->buf_max_len); + str->buffer = (uint16 *)TALLOC_ZERO(get_talloc_ctx(), + str->buf_max_len); if (str->buffer == NULL) smb_panic("init_regval_buffer: talloc fail\n"); memcpy(str->buffer, buf, str->buf_len); @@ -723,7 +724,8 @@ void init_string2(STRING2 *str, const char *buf, size_t max_len, size_t str_len) /* store the string */ if(str_len != 0) { - str->buffer = TALLOC_ZERO(get_talloc_ctx(), str->str_max_len); + str->buffer = (uint8 *)TALLOC_ZERO(get_talloc_ctx(), + str->str_max_len); if (str->buffer == NULL) smb_panic("init_string2: malloc fail\n"); memcpy(str->buffer, buf, str_len); diff --git a/source3/rpc_parse/parse_prs.c b/source3/rpc_parse/parse_prs.c index 29a3e60aa9..820565f09f 100644 --- a/source3/rpc_parse/parse_prs.c +++ b/source3/rpc_parse/parse_prs.c @@ -158,7 +158,8 @@ char *prs_alloc_mem(prs_struct *ps, size_t size, unsigned int count) if (size) { /* We can't call the type-safe version here. */ - ret = _talloc_zero_array(ps->mem_ctx, size, count, "parse_prs"); + ret = (char *)_talloc_zero_array(ps->mem_ctx, size, count, + "parse_prs"); } return ret; } @@ -213,7 +214,7 @@ BOOL prs_set_buffer_size(prs_struct *ps, uint32 newsize) if (newsize == 0) { SAFE_FREE(ps->data_p); } else { - ps->data_p = SMB_REALLOC(ps->data_p, newsize); + ps->data_p = (char *)SMB_REALLOC(ps->data_p, newsize); if (ps->data_p == NULL) { DEBUG(0,("prs_set_buffer_size: Realloc failure for size %u.\n", @@ -265,7 +266,7 @@ BOOL prs_grow(prs_struct *ps, uint32 extra_space) new_size = MAX(RPC_MAX_PDU_FRAG_LEN,extra_space); - if((ps->data_p = SMB_MALLOC(new_size)) == NULL) { + if((ps->data_p = (char *)SMB_MALLOC(new_size)) == NULL) { DEBUG(0,("prs_grow: Malloc failure for size %u.\n", (unsigned int)new_size)); return False; } @@ -277,7 +278,7 @@ BOOL prs_grow(prs_struct *ps, uint32 extra_space) */ new_size = MAX(ps->buffer_size*2, ps->buffer_size + extra_space); - if ((ps->data_p = SMB_REALLOC(ps->data_p, new_size)) == NULL) { + if ((ps->data_p = (char *)SMB_REALLOC(ps->data_p, new_size)) == NULL) { DEBUG(0,("prs_grow: Realloc failure for size %u.\n", (unsigned int)new_size)); return False; @@ -306,7 +307,7 @@ BOOL prs_force_grow(prs_struct *ps, uint32 extra_space) return False; } - if((ps->data_p = SMB_REALLOC(ps->data_p, new_size)) == NULL) { + if((ps->data_p = (char *)SMB_REALLOC(ps->data_p, new_size)) == NULL) { DEBUG(0,("prs_force_grow: Realloc failure for size %u.\n", (unsigned int)new_size)); return False; @@ -1816,7 +1817,7 @@ return the contents of a prs_struct in a DATA_BLOB BOOL prs_data_blob(prs_struct *prs, DATA_BLOB *blob, TALLOC_CTX *mem_ctx) { blob->length = prs_offset(prs); - blob->data = talloc_zero_size(mem_ctx, blob->length); + blob->data = (uint8 *)talloc_zero_size(mem_ctx, blob->length); if (!prs_copy_all_data_out((char *)blob->data, prs)) return False; diff --git a/source3/rpc_server/srv_eventlog_lib.c b/source3/rpc_server/srv_eventlog_lib.c index 66be1dc34f..c853f932ae 100644 --- a/source3/rpc_server/srv_eventlog_lib.c +++ b/source3/rpc_server/srv_eventlog_lib.c @@ -90,7 +90,7 @@ struct trav_size_struct { static int eventlog_tdb_size_fn( TDB_CONTEXT * tdb, TDB_DATA key, TDB_DATA data, void *state ) { - struct trav_size_struct *tsize = state; + struct trav_size_struct *tsize = (struct trav_size_struct *)state; tsize->size += data.dsize; tsize->rec_count++; @@ -486,7 +486,7 @@ int write_eventlog_tdb( TDB_CONTEXT * the_tdb, Eventlog_entry * ee ) } /* alloc mem for the packed version */ - packed_ee = TALLOC( mem_ctx, ee->record.length + MARGIN ); + packed_ee = (uint8 *)TALLOC( mem_ctx, ee->record.length + MARGIN ); if ( !packed_ee ) { talloc_destroy( mem_ctx ); return 0; diff --git a/source3/rpcclient/cmd_echo.c b/source3/rpcclient/cmd_echo.c index 6d608ebaf1..4432f5b14b 100644 --- a/source3/rpcclient/cmd_echo.c +++ b/source3/rpcclient/cmd_echo.c @@ -60,7 +60,7 @@ static NTSTATUS cmd_echo_data(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, } size = atoi(argv[1]); - in_data = SMB_MALLOC(size); + in_data = (char *)SMB_MALLOC(size); for (i = 0; i < size; i++) in_data[i] = i & 0xff; @@ -129,7 +129,7 @@ static NTSTATUS cmd_echo_sink_data(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ } size = atoi(argv[1]); - in_data = SMB_MALLOC(size); + in_data = (char *)SMB_MALLOC(size); for (i = 0; i < size; i++) in_data[i] = i & 0xff; diff --git a/source3/rpcclient/cmd_spoolss.c b/source3/rpcclient/cmd_spoolss.c index d77c58ad95..b5672cb2a1 100644 --- a/source3/rpcclient/cmd_spoolss.c +++ b/source3/rpcclient/cmd_spoolss.c @@ -2030,13 +2030,15 @@ static WERROR cmd_spoolss_setprinterdata(struct rpc_pipe_client *cli, UNISTR2 data; init_unistr2(&data, argv[4], UNI_STR_TERMINATE); value.size = data.uni_str_len * 2; - value.data_p = TALLOC_MEMDUP(mem_ctx, data.buffer, value.size); + value.data_p = (uint8 *)TALLOC_MEMDUP(mem_ctx, data.buffer, + value.size); break; } case REG_DWORD: { uint32 data = strtoul(argv[4], NULL, 10); value.size = sizeof(data); - value.data_p = TALLOC_MEMDUP(mem_ctx, &data, sizeof(data)); + value.data_p = (uint8 *)TALLOC_MEMDUP(mem_ctx, &data, + sizeof(data)); break; } case REG_BINARY: { diff --git a/source3/smbd/ipc.c b/source3/smbd/ipc.c index e6dfc6506a..08381524c0 100644 --- a/source3/smbd/ipc.c +++ b/source3/smbd/ipc.c @@ -478,7 +478,7 @@ int reply_trans(connection_struct *conn, char *inbuf,char *outbuf, if (state->total_data) { /* Can't use talloc here, the core routines do realloc on the * params and data. */ - state->data = SMB_MALLOC(state->total_data); + state->data = (char *)SMB_MALLOC(state->total_data); if (state->data == NULL) { DEBUG(0,("reply_trans: data malloc fail for %u " "bytes !\n", (unsigned int)state->total_data)); @@ -498,7 +498,7 @@ int reply_trans(connection_struct *conn, char *inbuf,char *outbuf, if (state->total_param) { /* Can't use talloc here, the core routines do realloc on the * params and data. */ - state->param = SMB_MALLOC(state->total_param); + state->param = (char *)SMB_MALLOC(state->total_param); if (state->param == NULL) { DEBUG(0,("reply_trans: param malloc fail for %u " "bytes !\n", (unsigned int)state->total_param)); diff --git a/source3/smbd/nttrans.c b/source3/smbd/nttrans.c index 0b1bdcadbb..d107bf84d3 100644 --- a/source3/smbd/nttrans.c +++ b/source3/smbd/nttrans.c @@ -52,7 +52,7 @@ static char *nttrans_realloc(char **ptr, size_t size) smb_panic("nttrans_realloc() called with NULL ptr\n"); } - *ptr = SMB_REALLOC(*ptr, size); + *ptr = (char *)SMB_REALLOC(*ptr, size); if(*ptr == NULL) { return NULL; } @@ -2908,7 +2908,7 @@ int reply_nttrans(connection_struct *conn, if (state->total_data) { /* Can't use talloc here, the core routines do realloc on the * params and data. */ - if ((state->data = SMB_MALLOC(state->total_data)) == NULL) { + if ((state->data = (char *)SMB_MALLOC(state->total_data)) == NULL) { DEBUG(0,("reply_nttrans: data malloc fail for %u " "bytes !\n", (unsigned int)state->total_data)); TALLOC_FREE(state); @@ -2927,7 +2927,7 @@ int reply_nttrans(connection_struct *conn, if (state->total_param) { /* Can't use talloc here, the core routines do realloc on the * params and data. */ - if ((state->param = SMB_MALLOC(state->total_param)) == NULL) { + if ((state->param = (char *)SMB_MALLOC(state->total_param)) == NULL) { DEBUG(0,("reply_nttrans: param malloc fail for %u " "bytes !\n", (unsigned int)state->total_param)); SAFE_FREE(state->data); @@ -2950,7 +2950,7 @@ int reply_nttrans(connection_struct *conn, if(state->setup_count > 0) { DEBUG(10,("reply_nttrans: state->setup_count = %d\n", state->setup_count)); - state->setup = TALLOC(state, state->setup_count); + state->setup = (uint16 *)TALLOC(state, state->setup_count); if (state->setup == NULL) { DEBUG(0,("reply_nttrans : Out of memory\n")); SAFE_FREE(state->data); diff --git a/source3/smbd/trans2.c b/source3/smbd/trans2.c index 5acce13e52..8eb8790975 100644 --- a/source3/smbd/trans2.c +++ b/source3/smbd/trans2.c @@ -170,8 +170,8 @@ static struct ea_list *get_ea_list_from_file(TALLOC_CTX *mem_ctx, connection_str return NULL; } - for (i = 0, ea_namelist = TALLOC(mem_ctx, ea_namelist_size); i < 6; - ea_namelist = TALLOC_REALLOC_ARRAY(mem_ctx, ea_namelist, char, ea_namelist_size), i++) { + for (i = 0, ea_namelist = TALLOC_ARRAY(mem_ctx, char, ea_namelist_size); i < 6; + ea_namelist = TALLOC_REALLOC_ARRAY(mem_ctx, ea_namelist, char, ea_namelist_size), i++) { if (!ea_namelist) { return NULL; @@ -899,7 +899,7 @@ static int call_trans2open(connection_struct *conn, char *inbuf, char *outbuf, i } /* Realloc the size of parameters and data we will return */ - *pparams = SMB_REALLOC(*pparams, 30); + *pparams = (char *)SMB_REALLOC(*pparams, 30); if(*pparams == NULL ) { return ERROR_NT(NT_STATUS_NO_MEMORY); } diff --git a/source3/utils/net_rpc_printer.c b/source3/utils/net_rpc_printer.c index 50ab50bace..dc3cb42dbe 100644 --- a/source3/utils/net_rpc_printer.c +++ b/source3/utils/net_rpc_printer.c @@ -2171,7 +2171,7 @@ NTSTATUS rpc_printer_migrate_settings_internals(const DOM_SID *domain_sid, if (ctr_enum.printers_2[i].devmode != NULL) { /* copy devmode (info level 2) */ - ctr_dst.printers_2->devmode = + ctr_dst.printers_2->devmode = (struct devicemode *) TALLOC_MEMDUP(mem_ctx, ctr_enum.printers_2[i].devmode, sizeof(DEVICEMODE)); @@ -2332,7 +2332,7 @@ NTSTATUS rpc_printer_migrate_settings_internals(const DOM_SID *domain_sid, value.type = REG_SZ; value.size = data.uni_str_len * 2; - value.data_p = TALLOC_MEMDUP(mem_ctx, data.buffer, value.size); + value.data_p = (uint8 *)TALLOC_MEMDUP(mem_ctx, data.buffer, value.size); if (opt_verbose) display_reg_value(subkey, value); -- cgit