summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2011-05-04 14:57:37 -0700
committerJeremy Allison <jra@samba.org>2011-05-05 00:59:40 +0200
commit1c714850d5068864b1f04a4211223dec11a30d67 (patch)
treeb890a5ba8a0f900f667ce79210ac0a4593f02642
parentff215f5c89c91a22c910400c8ac81d82d7459ba0 (diff)
downloadsamba-1c714850d5068864b1f04a4211223dec11a30d67.tar.gz
samba-1c714850d5068864b1f04a4211223dec11a30d67.tar.bz2
samba-1c714850d5068864b1f04a4211223dec11a30d67.zip
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
-rw-r--r--lib/nss_wrapper/nss_wrapper.c2
-rw-r--r--lib/util/charset/util_str.c8
-rw-r--r--lib/util/charset/util_unistr_w.c4
-rw-r--r--lib/util/util_net.c2
-rw-r--r--nsswitch/libwbclient/wbc_util.c16
-rw-r--r--source4/torture/basic/attr.c2
-rw-r--r--source4/torture/raw/acls.c14
-rw-r--r--source4/torture/raw/open.c2
-rw-r--r--source4/torture/raw/qfileinfo.c2
-rw-r--r--source4/torture/raw/streams.c8
-rw-r--r--source4/torture/smb2/acls.c7
11 files changed, 42 insertions, 25 deletions
diff --git a/lib/nss_wrapper/nss_wrapper.c b/lib/nss_wrapper/nss_wrapper.c
index cfa5a68712..8767fbfd89 100644
--- a/lib/nss_wrapper/nss_wrapper.c
+++ b/lib/nss_wrapper/nss_wrapper.c
@@ -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"
diff --git a/lib/util/charset/util_str.c b/lib/util/charset/util_str.c
index 71a37787ae..4f4ca93cfd 100644
--- a/lib/util/charset/util_str.c
+++ b/lib/util/charset/util_str.c
@@ -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);
}
}
}
diff --git a/lib/util/charset/util_unistr_w.c b/lib/util/charset/util_unistr_w.c
index a550e52776..22f22ab754 100644
--- a/lib/util/charset/util_unistr_w.c
+++ b/lib/util/charset/util_unistr_w.c
@@ -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 */
diff --git a/lib/util/util_net.c b/lib/util/util_net.c
index a8a05da138..7d678c9b14 100644
--- a/lib/util/util_net.c
+++ b/lib/util/util_net.c
@@ -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));
}
diff --git a/nsswitch/libwbclient/wbc_util.c b/nsswitch/libwbclient/wbc_util.c
index d783ba36d8..af134ba7e5 100644
--- a/nsswitch/libwbclient/wbc_util.c
+++ b/nsswitch/libwbclient/wbc_util.c
@@ -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;
}
diff --git a/source4/torture/basic/attr.c b/source4/torture/basic/attr.c
index 09d1ae2968..9655f7a743 100644
--- a/source4/torture/basic/attr.c
+++ b/source4/torture/basic/attr.c
@@ -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);
}
diff --git a/source4/torture/raw/acls.c b/source4/torture/raw/acls.c
index 666d164c96..53de4e31f4 100644
--- a/source4/torture/raw/acls.c
+++ b/source4/torture/raw/acls.c
@@ -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;
}
diff --git a/source4/torture/raw/open.c b/source4/torture/raw/open.c
index 89042d77dc..beb629069f 100644
--- a/source4/torture/raw/open.c
+++ b/source4/torture/raw/open.c
@@ -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)
/*
diff --git a/source4/torture/raw/qfileinfo.c b/source4/torture/raw/qfileinfo.c
index 414084080b..ca5f66795e 100644
--- a/source4/torture/raw/qfileinfo.c
+++ b/source4/torture/raw/qfileinfo.c
@@ -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;
}
}
diff --git a/source4/torture/raw/streams.c b/source4/torture/raw/streams.c
index 5ce9b756ef..ae3bc2a713 100644
--- a/source4/torture/raw/streams.c
+++ b/source4/torture/raw/streams.c
@@ -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;
}
diff --git a/source4/torture/smb2/acls.c b/source4/torture/smb2/acls.c
index 3883ae5055..fa6c002da7 100644
--- a/source4/torture/smb2/acls.c
+++ b/source4/torture/smb2/acls.c
@@ -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");