1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-24 21:34:56 +03:00

r17334: Some C++ warnings

This commit is contained in:
Volker Lendecke 2006-07-31 04:30:55 +00:00 committed by Gerald (Jerry) Carter
parent be9aaffdac
commit 8ae7ed1f3c
12 changed files with 26 additions and 24 deletions

View File

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

View File

@ -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') {

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -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]);

View File

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

View File

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