Clean up some const and other compiler warnings.
authorJeremy Allison <jra@samba.org>
Wed, 4 May 2011 21:57:37 +0000 (14:57 -0700)
committerJeremy Allison <jra@samba.org>
Wed, 4 May 2011 22:59:40 +0000 (00:59 +0200)
Autobuild-User: Jeremy Allison <jra@samba.org>
Autobuild-Date: Thu May  5 00:59:40 CEST 2011 on sn-devel-104

lib/nss_wrapper/nss_wrapper.c
lib/util/charset/util_str.c
lib/util/charset/util_unistr_w.c
lib/util/util_net.c
nsswitch/libwbclient/wbc_util.c
source4/torture/basic/attr.c
source4/torture/raw/acls.c
source4/torture/raw/open.c
source4/torture/raw/qfileinfo.c
source4/torture/raw/streams.c
source4/torture/smb2/acls.c

index cfa5a6871217df2a48708669e9493408f3dc6bb4..8767fbfd8921feadb358bf81695225f69fdf5a86 100644 (file)
@@ -36,7 +36,9 @@
 
 /* defining this gives us the posix getpwnam_r() calls on solaris
    Thanks to heimdal for this */
 
 /* defining this gives us the posix getpwnam_r() calls on solaris
    Thanks to heimdal for this */
+#ifndef _POSIX_PTHREAD_SEMANTICS
 #define _POSIX_PTHREAD_SEMANTICS
 #define _POSIX_PTHREAD_SEMANTICS
+#endif
 
 #define NSS_WRAPPER_NOT_REPLACE
 #include "../replace/replace.h"
 
 #define NSS_WRAPPER_NOT_REPLACE
 #include "../replace/replace.h"
index 71a37787aee7fecc424e7e05b51de0215664ec9a..4f4ca93cfdd8275589535c06a29b410226355b65 100644 (file)
@@ -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)
 
        for (s = src; *s && !(((unsigned char)s[0]) & 0x80); s++) {
                if (*s == c)
-                       return (char *)s;
+                       return discard_const_p(char, s);
        }
 
        if (!*s)
        }
 
        if (!*s)
@@ -397,7 +397,7 @@ _PUBLIC_ char *strrchr_m(const char *s, char c)
                                        break;
                                }
                                /* No - we have a match ! */
                                        break;
                                }
                                /* No - we have a match ! */
-                               return (char *)cp;
+                               return discard_const_p(char , cp);
                        }
                } while (cp-- != s);
                if (!got_mb)
                        }
                } while (cp-- != s);
                if (!got_mb)
@@ -492,7 +492,7 @@ char *strstr_m(const char *src, const char *findstr)
 
        /* for correctness */
        if (!findstr[0]) {
 
        /* for correctness */
        if (!findstr[0]) {
-               return (char*)src;
+               return discard_const_p(char, src);
        }
 
        /* Samba does single character findstr calls a *lot*. */
        }
 
        /* 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) {
                                findstr_len = strlen(findstr);
 
                        if (strncmp(s, findstr, findstr_len) == 0) {
-                               return (char *)s;
+                               return discard_const_p(char, s);
                        }
                }
        }
                        }
                }
        }
index a550e527763b4dd94fc0a9cd8b1a2869e0c91849..22f22ab754cefd73b90a406afcc9a5e4b378193b 100644 (file)
@@ -22,8 +22,8 @@
 #include "includes.h"
 
 /* Copy into a smb_ucs2_t from a possibly unaligned buffer. Return the copied smb_ucs2_t */
 #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 */
 
 
 /* return an ascii version of a ucs2 character */
index a8a05da1383b267430d77f89a48ca9de836d445f..7d678c9b149b28e49f39776b7b25db6e1dc6dd5f 100644 (file)
@@ -591,7 +591,7 @@ char *print_sockaddr(char *dest,
                        size_t destlen,
                        const struct sockaddr_storage *psa)
 {
                        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));
 }
 
                        sizeof(struct sockaddr_storage));
 }
 
index d783ba36d874954039274a09138d6f4164dbdb67..af134ba7e5b410abb0c5388507704687c0e8794b 100644 (file)
@@ -623,13 +623,13 @@ static void wbcDomainControllerInfoExDestructor(void *ptr)
 {
        struct wbcDomainControllerInfoEx *i =
                (struct wbcDomainControllerInfoEx *)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,
 }
 
 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) {
        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;
        }
                free(b->blob.data);
                b += 1;
        }
index 09d1ae29684900806a6f5c439a9a2cf2f2e3ebb7..9655f7a74387945eee897dbc6d70c8808de8bce6 100644 (file)
@@ -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,
                                [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);
                }
 
                        CHECK_MAX_FAILURES(error_exit_dir);
                }
 
index 666d164c969dd243b27d602cb6046444239a1fe8..53de4e31f411e3ed8ef602b7197ad4e26ff3a3ac 100644 (file)
@@ -1846,6 +1846,7 @@ done:
        return ret;
 }
 
        return ret;
 }
 
+#if 0
 static bool test_inheritance_flags(struct torture_context *tctx,
     struct smbcli_state *cli)
 {
 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;
 }
        smbcli_deltree(cli->tree, BASEDIR);
        return ret;
 }
+#endif
 
 /*
   test dynamic acl inheritance
 
 /*
   test dynamic acl inheritance
@@ -2244,6 +2246,8 @@ done:
        CHECK_STATUS_FOR_BIT_ACTION(status, bits, do {} while (0)); \
 } while (0)
 
        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, 
 /* 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;
 }
 
        return ret;
 }
 
+#endif
 
 /* 
    basic testing of security descriptor calls
 
 /* 
    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, "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);
        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);
        torture_suite_add_1smb_test(suite, "GETSET", test_sd_get_set);
-       */
+#endif
 
        return suite;
 }
 
        return suite;
 }
index 89042d77dc2cc74fed6051e3ed301421e66a73bf..beb629069f67e2ed6f4e71e0d0dcb04a45d7b0fb 100644 (file)
@@ -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", \
        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)
 
 /*
        }} while (0)
 
 /*
index 414084080b91cdd2c987be6be48a85d4d5d1d9e9..ca5f66795e69a0604f496d045f78396b2c513a42 100644 (file)
@@ -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) {
        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;
                }
        }
                        ret = false;
                }
        }
index 5ce9b756efccb7bb8129a75d4350c6e9f26680fd..ae3bc2a7131a9bf02a4924922ec86946d13f6b15 100644 (file)
@@ -1629,6 +1629,7 @@ static bool test_stream_create_disposition(struct torture_context *tctx,
        return ret;
 }
 
        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)
 /* 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;
 }
        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,
 
 /* 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, "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;
 }
 
        return suite;
 }
index 3883ae5055f18f5db66b2766c3d8404d8a6ee86b..fa6c002da7b6f32190b58973805f2a80b3b2d06a 100644 (file)
@@ -1662,6 +1662,7 @@ done:
        CHECK_STATUS_FOR_BIT_ACTION(status, bits, do {} while (0)); \
 } while (0)
 
        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)
 /* 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;
 }
 
        return ret;
 }
+#endif
 
 /*
    basic testing of SMB2 ACLs
 
 /*
    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);
        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);
        torture_suite_add_1smb2_test(suite, "GETSET", test_sd_get_set);
-       */
+#endif
 
        suite->description = talloc_strdup(suite, "SMB2-ACLS tests");
 
 
        suite->description = talloc_strdup(suite, "SMB2-ACLS tests");