From 1cf1e648feed823244731eef5f56bd34e15cb045 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Mon, 31 Jul 2006 04:30:55 +0000 Subject: [PATCH] r17334: Some C++ warnings (This used to be commit 8ae7ed1f3cecbb5285313d17b5f9511e2e622f0b) --- source3/lib/account_pol.c | 2 +- source3/lib/debug.c | 10 +++++----- source3/lib/dprintf.c | 2 +- source3/lib/gencache.c | 4 ++-- source3/lib/interface.c | 2 +- source3/lib/ldap_escape.c | 4 ++-- source3/lib/privileges.c | 2 +- source3/lib/smbldap.c | 5 +++-- source3/lib/sysacls.c | 9 +++++---- source3/lib/util_pw.c | 4 ++-- source3/lib/xfile.c | 2 +- source3/popt/findme.c | 4 ++-- 12 files changed, 26 insertions(+), 24 deletions(-) diff --git a/source3/lib/account_pol.c b/source3/lib/account_pol.c index 8d844741f5d7..de5a37aea91b 100644 --- a/source3/lib/account_pol.c +++ b/source3/lib/account_pol.c @@ -94,7 +94,7 @@ char *account_policy_names_list(void) len += strlen(account_policy_names[i].string) + 1; } len++; - nl = SMB_MALLOC(len); + nl = (char *)SMB_MALLOC(len); if (!nl) { return NULL; } diff --git a/source3/lib/debug.c b/source3/lib/debug.c index bf75bdf3d3f5..00f6b0e72ff8 100644 --- a/source3/lib/debug.c +++ b/source3/lib/debug.c @@ -236,7 +236,7 @@ static char *debug_list_class_names_and_levels(void) } /* create single string list - add space for newline */ - b = buf = SMB_MALLOC(dim+1); + b = buf = (char *)SMB_MALLOC(dim+1); if (!buf) { err = True; goto done; @@ -320,7 +320,7 @@ int debug_add_class(const char *classname) new_ptr = SMB_REALLOC_ARRAY(new_ptr, int, debug_num_classes + 1); if (!new_ptr) return -1; - DEBUGLEVEL_CLASS = new_ptr; + DEBUGLEVEL_CLASS = (int *)new_ptr; DEBUGLEVEL_CLASS[ndx] = 0; /* debug_level is the pointer used for the DEBUGLEVEL-thingy */ @@ -337,13 +337,13 @@ int debug_add_class(const char *classname) new_ptr = SMB_REALLOC_ARRAY(new_ptr, BOOL, debug_num_classes + 1); if (!new_ptr) return -1; - DEBUGLEVEL_CLASS_ISSET = new_ptr; + DEBUGLEVEL_CLASS_ISSET = (int *)new_ptr; DEBUGLEVEL_CLASS_ISSET[ndx] = False; new_ptr = SMB_REALLOC_ARRAY(classname_table, char *, debug_num_classes + 1); if (!new_ptr) return -1; - classname_table = new_ptr; + classname_table = (char **)new_ptr; classname_table[ndx] = SMB_STRDUP(classname); if (! classname_table[ndx]) @@ -474,7 +474,7 @@ BOOL debug_parse_levels(const char *params_str) static void debug_message(int msg_type, struct process_id src, void *buf, size_t len) { - const char *params_str = buf; + const char *params_str = (const char *)buf; /* Check, it's a proper string! */ if (params_str[len-1] != '\0') { diff --git a/source3/lib/dprintf.c b/source3/lib/dprintf.c index 8ed2fa5d8cda..2312c3db0cbc 100644 --- a/source3/lib/dprintf.c +++ b/source3/lib/dprintf.c @@ -54,7 +54,7 @@ charset, but beware of it growing */ maxlen = ret*2; again: - p2 = SMB_MALLOC(maxlen); + p2 = (char *)SMB_MALLOC(maxlen); if (!p2) { SAFE_FREE(p); return -1; diff --git a/source3/lib/gencache.c b/source3/lib/gencache.c index 561a019429a8..d4582b34f9d2 100644 --- a/source3/lib/gencache.c +++ b/source3/lib/gencache.c @@ -260,7 +260,7 @@ BOOL gencache_get(const char *keystr, char **valstr, time_t *timeout) int status; char *fmt; - v = SMB_MALLOC(databuf.dsize + 1 - TIMEOUT_LEN); + v = (char *)SMB_MALLOC(databuf.dsize + 1 - TIMEOUT_LEN); if (!v) { return False; } @@ -372,7 +372,7 @@ void gencache_iterate(void (*fn)(const char* key, const char *value, time_t time SAFE_FREE(databuf.dptr); - valstr = SMB_MALLOC(databuf.dsize + 1 - TIMEOUT_LEN); + valstr = (char *)SMB_MALLOC(databuf.dsize + 1 - TIMEOUT_LEN); if (!valstr) { SAFE_FREE(entry); SAFE_FREE(keystr); diff --git a/source3/lib/interface.c b/source3/lib/interface.c index dea01c60111c..9d0b966390f5 100644 --- a/source3/lib/interface.c +++ b/source3/lib/interface.c @@ -187,7 +187,7 @@ void load_interfaces(void) total_probed = get_interfaces(ifaces, MAX_INTERFACES); if (total_probed > 0) { - probed_ifaces = memdup(ifaces, sizeof(ifaces[0])*total_probed); + probed_ifaces = (struct iface_struct *)memdup(ifaces, sizeof(ifaces[0])*total_probed); if (!probed_ifaces) { DEBUG(0,("ERROR: memdup failed\n")); exit(1); diff --git a/source3/lib/ldap_escape.c b/source3/lib/ldap_escape.c index fcb787e9e855..26230884341d 100644 --- a/source3/lib/ldap_escape.c +++ b/source3/lib/ldap_escape.c @@ -36,7 +36,7 @@ char *escape_ldap_string_alloc(const char *s) { size_t len = strlen(s)+1; - char *output = SMB_MALLOC(len); + char *output = (char *)SMB_MALLOC(len); const char *sub; int i = 0; char *p = output; @@ -68,7 +68,7 @@ char *escape_ldap_string_alloc(const char *s) if (sub) { len = len + 3; - output = SMB_REALLOC(output, len); + output = (char *)SMB_REALLOC(output, len); if (!output) { return NULL; } diff --git a/source3/lib/privileges.c b/source3/lib/privileges.c index d19592e58269..344d636f5e76 100644 --- a/source3/lib/privileges.c +++ b/source3/lib/privileges.c @@ -473,7 +473,7 @@ BOOL get_privileges_for_sids(SE_PRIV *privileges, DOM_SID *slist, int scount) static int priv_traverse_fn(TDB_CONTEXT *t, TDB_DATA key, TDB_DATA data, void *state) { - PRIV_SID_LIST *priv = state; + PRIV_SID_LIST *priv = (PRIV_SID_LIST *)state; int prefixlen = strlen(PRIVPREFIX); DOM_SID sid; fstring sid_string; diff --git a/source3/lib/smbldap.c b/source3/lib/smbldap.c index a63e1c1bcc33..a157ff132b7c 100644 --- a/source3/lib/smbldap.c +++ b/source3/lib/smbldap.c @@ -841,7 +841,8 @@ static int rebindproc_connect_with_state (LDAP *ldap_struct, ber_tag_t request, ber_int_t msgid, void *arg) { - struct smbldap_state *ldap_state = arg; + struct smbldap_state *ldap_state = + (struct smbldap_state *)arg; int rc; int version; @@ -1289,7 +1290,7 @@ int smbldap_search_paged(struct smbldap_state *ldap_state, /* construct cookie */ if (*cookie != NULL) { ber_printf(cookie_be, "{iO}", (ber_int_t) pagesize, *cookie); - ber_bvfree(*cookie); /* don't need it from last time */ + ber_bvfree((struct berval *)*cookie); /* don't need it from last time */ *cookie = NULL; } else { ber_printf(cookie_be, "{io}", (ber_int_t) pagesize, "", 0); diff --git a/source3/lib/sysacls.c b/source3/lib/sysacls.c index e8c33c2c956d..eba5fc44b6ca 100644 --- a/source3/lib/sysacls.c +++ b/source3/lib/sysacls.c @@ -141,7 +141,7 @@ char *sys_acl_to_text(SMB_ACL_T acl_d, ssize_t *len_p) */ len = 0; maxlen = 20 * acl_d->count; - if ((text = SMB_MALLOC(maxlen)) == NULL) { + if ((text = (char *)SMB_MALLOC(maxlen)) == NULL) { errno = ENOMEM; return NULL; } @@ -212,7 +212,7 @@ char *sys_acl_to_text(SMB_ACL_T acl_d, ssize_t *len_p) */ if ((len + nbytes) > maxlen) { maxlen += nbytes + 20 * (acl_d->count - i); - if ((text = SMB_REALLOC(text, maxlen)) == NULL) { + if ((text = (char *)SMB_REALLOC(text, maxlen)) == NULL) { errno = ENOMEM; return NULL; } @@ -243,8 +243,9 @@ SMB_ACL_T sys_acl_init(int count) * acl[] array, this actually allocates an ACL with room * for (count+1) entries */ - if ((a = SMB_MALLOC(sizeof(struct smb_acl_t) + - count * sizeof(struct smb_acl_entry))) == NULL) { + if ((a = (struct smb_acl_t *)SMB_MALLOC( + sizeof(struct smb_acl_t) + + count * sizeof(struct smb_acl_entry))) == NULL) { errno = ENOMEM; return NULL; } diff --git a/source3/lib/util_pw.c b/source3/lib/util_pw.c index 754899f420ee..dc184233a6db 100644 --- a/source3/lib/util_pw.c +++ b/source3/lib/util_pw.c @@ -74,7 +74,7 @@ struct passwd *getpwnam_alloc(TALLOC_CTX *mem_ctx, const char *name) if ((pwnam_cache[i] != NULL) && (strcmp(name, pwnam_cache[i]->pw_name) == 0)) { DEBUG(10, ("Got %s from pwnam_cache\n", name)); - return talloc_reference(mem_ctx, pwnam_cache[i]); + return (struct passwd *)talloc_reference(mem_ctx, pwnam_cache[i]); } } @@ -103,7 +103,7 @@ struct passwd *getpwnam_alloc(TALLOC_CTX *mem_ctx, const char *name) pwnam_cache[i] = tcopy_passwd(pwnam_cache, temp); if (pwnam_cache[i]!= NULL && mem_ctx != NULL) { - return talloc_reference(mem_ctx, pwnam_cache[i]); + return (struct passwd *)talloc_reference(mem_ctx, pwnam_cache[i]); } return tcopy_passwd(NULL, pwnam_cache[i]); diff --git a/source3/lib/xfile.c b/source3/lib/xfile.c index ef33c7894f75..8a6776b5f919 100644 --- a/source3/lib/xfile.c +++ b/source3/lib/xfile.c @@ -80,7 +80,7 @@ static int x_allocate_buffer(XFILE *f) { if (f->buf) return 1; if (f->bufsize == 0) return 0; - f->buf = SMB_MALLOC(f->bufsize); + f->buf = (char *)SMB_MALLOC(f->bufsize); if (!f->buf) return 0; f->next = f->buf; return 1; diff --git a/source3/popt/findme.c b/source3/popt/findme.c index a950e50018b1..b28981ba1f49 100644 --- a/source3/popt/findme.c +++ b/source3/popt/findme.c @@ -22,8 +22,8 @@ const char * findProgramPath(const char * argv0) { if (path == NULL) return NULL; - start = pathbuf = alloca(strlen(path) + 1); - buf = malloc(strlen(path) + strlen(argv0) + sizeof("/")); + start = pathbuf = (char *)alloca(strlen(path) + 1); + buf = (char *)malloc(strlen(path) + strlen(argv0) + sizeof("/")); if (buf == NULL) return NULL; /* XXX can't happen */ strcpy(pathbuf, path); -- 2.34.1