mirror of
https://github.com/samba-team/samba.git
synced 2025-03-27 22:50:26 +03:00
Clean up some const and other compiler warnings.
Autobuild-User: Jeremy Allison <jra@samba.org> Autobuild-Date: Thu May 5 00:59:40 CEST 2011 on sn-devel-104
This commit is contained in:
parent
ff215f5c89
commit
1c714850d5
@ -36,7 +36,9 @@
|
||||
|
||||
/* defining this gives us the posix getpwnam_r() calls on solaris
|
||||
Thanks to heimdal for this */
|
||||
#ifndef _POSIX_PTHREAD_SEMANTICS
|
||||
#define _POSIX_PTHREAD_SEMANTICS
|
||||
#endif
|
||||
|
||||
#define NSS_WRAPPER_NOT_REPLACE
|
||||
#include "../replace/replace.h"
|
||||
|
@ -329,7 +329,7 @@ _PUBLIC_ char *strchr_m(const char *src, char c)
|
||||
|
||||
for (s = src; *s && !(((unsigned char)s[0]) & 0x80); s++) {
|
||||
if (*s == c)
|
||||
return (char *)s;
|
||||
return discard_const_p(char, s);
|
||||
}
|
||||
|
||||
if (!*s)
|
||||
@ -397,7 +397,7 @@ _PUBLIC_ char *strrchr_m(const char *s, char c)
|
||||
break;
|
||||
}
|
||||
/* No - we have a match ! */
|
||||
return (char *)cp;
|
||||
return discard_const_p(char , cp);
|
||||
}
|
||||
} while (cp-- != s);
|
||||
if (!got_mb)
|
||||
@ -492,7 +492,7 @@ char *strstr_m(const char *src, const char *findstr)
|
||||
|
||||
/* for correctness */
|
||||
if (!findstr[0]) {
|
||||
return (char*)src;
|
||||
return discard_const_p(char, src);
|
||||
}
|
||||
|
||||
/* Samba does single character findstr calls a *lot*. */
|
||||
@ -509,7 +509,7 @@ char *strstr_m(const char *src, const char *findstr)
|
||||
findstr_len = strlen(findstr);
|
||||
|
||||
if (strncmp(s, findstr, findstr_len) == 0) {
|
||||
return (char *)s;
|
||||
return discard_const_p(char, s);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -22,8 +22,8 @@
|
||||
#include "includes.h"
|
||||
|
||||
/* Copy into a smb_ucs2_t from a possibly unaligned buffer. Return the copied smb_ucs2_t */
|
||||
#define COPY_UCS2_CHAR(dest,src) (((unsigned char *)(dest))[0] = ((unsigned char *)(src))[0],\
|
||||
((unsigned char *)(dest))[1] = ((unsigned char *)(src))[1], (dest))
|
||||
#define COPY_UCS2_CHAR(dest,src) (((unsigned char *)(dest))[0] = ((const unsigned char *)(src))[0],\
|
||||
((unsigned char *)(dest))[1] = ((const unsigned char *)(src))[1], (dest))
|
||||
|
||||
|
||||
/* return an ascii version of a ucs2 character */
|
||||
|
@ -591,7 +591,7 @@ char *print_sockaddr(char *dest,
|
||||
size_t destlen,
|
||||
const struct sockaddr_storage *psa)
|
||||
{
|
||||
return print_sockaddr_len(dest, destlen, (struct sockaddr *)psa,
|
||||
return print_sockaddr_len(dest, destlen, (const struct sockaddr *)psa,
|
||||
sizeof(struct sockaddr_storage));
|
||||
}
|
||||
|
||||
|
@ -623,13 +623,13 @@ static void wbcDomainControllerInfoExDestructor(void *ptr)
|
||||
{
|
||||
struct wbcDomainControllerInfoEx *i =
|
||||
(struct wbcDomainControllerInfoEx *)ptr;
|
||||
free((char *)(i->dc_unc));
|
||||
free((char *)(i->dc_address));
|
||||
free((char *)(i->domain_guid));
|
||||
free((char *)(i->domain_name));
|
||||
free((char *)(i->forest_name));
|
||||
free((char *)(i->dc_site_name));
|
||||
free((char *)(i->client_site_name));
|
||||
free(discard_const_p(char, i->dc_unc));
|
||||
free(discard_const_p(char, i->dc_address));
|
||||
free(discard_const_p(char, i->domain_guid));
|
||||
free(discard_const_p(char, i->domain_name));
|
||||
free(discard_const_p(char, i->forest_name));
|
||||
free(discard_const_p(char, i->dc_site_name));
|
||||
free(discard_const_p(char, i->client_site_name));
|
||||
}
|
||||
|
||||
static wbcErr wbc_create_domain_controller_info_ex(const struct winbindd_response *resp,
|
||||
@ -758,7 +758,7 @@ static void wbcNamedBlobDestructor(void *ptr)
|
||||
struct wbcNamedBlob *b = (struct wbcNamedBlob *)ptr;
|
||||
|
||||
while (b->name != NULL) {
|
||||
free((char *)(b->name));
|
||||
free(discard_const_p(char, b->name));
|
||||
free(b->blob.data);
|
||||
b += 1;
|
||||
}
|
||||
|
@ -374,7 +374,7 @@ error_exit_file:
|
||||
[0x%x], got attr 0x%x, should be 0x%x\n",
|
||||
open_attrs_table[j],
|
||||
(uint16_t)attr,
|
||||
open_attrs_table[j]|FILE_ATTRIBUTE_DIRECTORY);
|
||||
(int)open_attrs_table[j]|FILE_ATTRIBUTE_DIRECTORY);
|
||||
CHECK_MAX_FAILURES(error_exit_dir);
|
||||
}
|
||||
|
||||
|
@ -1846,6 +1846,7 @@ done:
|
||||
return ret;
|
||||
}
|
||||
|
||||
#if 0
|
||||
static bool test_inheritance_flags(struct torture_context *tctx,
|
||||
struct smbcli_state *cli)
|
||||
{
|
||||
@ -2073,6 +2074,7 @@ done:
|
||||
smbcli_deltree(cli->tree, BASEDIR);
|
||||
return ret;
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
test dynamic acl inheritance
|
||||
@ -2244,6 +2246,8 @@ done:
|
||||
CHECK_STATUS_FOR_BIT_ACTION(status, bits, do {} while (0)); \
|
||||
} while (0)
|
||||
|
||||
#if 0
|
||||
|
||||
/* test what access mask is needed for getting and setting security_descriptors
|
||||
Test copied to smb2/acls.c for SMB2. */
|
||||
static bool test_sd_get_set(struct torture_context *tctx,
|
||||
@ -2433,6 +2437,7 @@ done:
|
||||
return ret;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/*
|
||||
basic testing of security descriptor calls
|
||||
@ -2450,11 +2455,14 @@ struct torture_suite *torture_raw_acls(TALLOC_CTX *mem_ctx)
|
||||
torture_suite_add_1smb_test(suite, "owner", test_owner_bits);
|
||||
torture_suite_add_1smb_test(suite, "inheritance", test_inheritance);
|
||||
|
||||
/* torture_suite_add_1smb_test(suite, "INHERITFLAGS", test_inheritance_flags); */
|
||||
#if 0
|
||||
torture_suite_add_1smb_test(suite, "INHERITFLAGS", test_inheritance_flags);
|
||||
#endif
|
||||
torture_suite_add_1smb_test(suite, "dynamic", test_inheritance_dynamic);
|
||||
/* XXX This test does not work against XP or Vista.
|
||||
#if 0
|
||||
/* XXX This test does not work against XP or Vista. */
|
||||
torture_suite_add_1smb_test(suite, "GETSET", test_sd_get_set);
|
||||
*/
|
||||
#endif
|
||||
|
||||
return suite;
|
||||
}
|
||||
|
@ -152,7 +152,7 @@ static const char *rdwr_string(enum rdwr_mode m)
|
||||
status = smb_raw_setpathinfo(cli->tree, &sfinfo); \
|
||||
if (!NT_STATUS_IS_OK(status)) { \
|
||||
torture_warning(tctx, "(%s) Failed to set attrib 0x%x on %s\n", \
|
||||
__location__, sattrib, fname); \
|
||||
__location__, (int)sattrib, fname); \
|
||||
}} while (0)
|
||||
|
||||
/*
|
||||
|
@ -779,7 +779,7 @@ static bool torture_raw_qfileinfo_internals(struct torture_context *torture,
|
||||
s1 = fnum_find("BASIC_INFO");
|
||||
if (s1 && is_ipc) {
|
||||
if (s1->basic_info.out.attrib != FILE_ATTRIBUTE_NORMAL) {
|
||||
printf("(%d) attrib basic_info/nlink incorrect - %d should be %d\n", __LINE__, s1->basic_info.out.attrib, FILE_ATTRIBUTE_NORMAL);
|
||||
printf("(%d) attrib basic_info/nlink incorrect - %d should be %d\n", __LINE__, s1->basic_info.out.attrib, (int)FILE_ATTRIBUTE_NORMAL);
|
||||
ret = false;
|
||||
}
|
||||
}
|
||||
|
@ -1629,6 +1629,7 @@ static bool test_stream_create_disposition(struct torture_context *tctx,
|
||||
return ret;
|
||||
}
|
||||
|
||||
#if 0
|
||||
/* Test streaminfo with enough streams on a file to fill up the buffer. */
|
||||
static bool test_stream_large_streaminfo(struct torture_context *tctx,
|
||||
struct smbcli_state *cli)
|
||||
@ -1674,6 +1675,7 @@ static bool test_stream_large_streaminfo(struct torture_context *tctx,
|
||||
smbcli_deltree(cli->tree, BASEDIR);
|
||||
return ret;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Test the effect of setting attributes on a stream. */
|
||||
static bool test_stream_attributes(struct torture_context *tctx,
|
||||
@ -1913,8 +1915,10 @@ struct torture_suite *torture_raw_streams(TALLOC_CTX *tctx)
|
||||
torture_suite_add_1smb_test(suite, "attr", test_stream_attributes);
|
||||
torture_suite_add_1smb_test(suite, "sumtab", test_stream_summary_tab);
|
||||
|
||||
/* torture_suite_add_1smb_test(suite, "LARGESTREAMINFO", */
|
||||
/* test_stream_large_streaminfo); */
|
||||
#if 0
|
||||
torture_suite_add_1smb_test(suite, "LARGESTREAMINFO",
|
||||
test_stream_large_streaminfo);
|
||||
#endif
|
||||
|
||||
return suite;
|
||||
}
|
||||
|
@ -1662,6 +1662,7 @@ done:
|
||||
CHECK_STATUS_FOR_BIT_ACTION(status, bits, do {} while (0)); \
|
||||
} while (0)
|
||||
|
||||
#if 0
|
||||
/* test what access mask is needed for getting and setting security_descriptors */
|
||||
/* Note: This test was copied from raw/acls.c. */
|
||||
static bool test_sd_get_set(struct torture_context *tctx, struct smb2_tree *tree)
|
||||
@ -1849,6 +1850,7 @@ done:
|
||||
|
||||
return ret;
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
basic testing of SMB2 ACLs
|
||||
@ -1863,9 +1865,10 @@ struct torture_suite *torture_smb2_acls_init(void)
|
||||
torture_suite_add_1smb2_test(suite, "INHERITANCE", test_inheritance);
|
||||
torture_suite_add_1smb2_test(suite, "INHERITFLAGS", test_inheritance_flags);
|
||||
torture_suite_add_1smb2_test(suite, "DYNAMIC", test_inheritance_dynamic);
|
||||
/* XXX This test does not work against XP or Vista.
|
||||
#if 0
|
||||
/* XXX This test does not work against XP or Vista. */
|
||||
torture_suite_add_1smb2_test(suite, "GETSET", test_sd_get_set);
|
||||
*/
|
||||
#endif
|
||||
|
||||
suite->description = talloc_strdup(suite, "SMB2-ACLS tests");
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user