Fix const warnings.
authorJeremy Allison <jra@samba.org>
Fri, 14 Oct 2011 20:51:26 +0000 (13:51 -0700)
committerJeremy Allison <jra@samba.org>
Fri, 14 Oct 2011 20:51:26 +0000 (13:51 -0700)
lib/util/charset/util_unistr_w.c

index 7e0ece383f209021086d5382d7ccc4ebc4c7456b..72bd19855c672e02b775ffc97bd7f5d2b4194009 100644 (file)
@@ -130,7 +130,7 @@ smb_ucs2_t *strnrchr_w(const smb_ucs2_t *s, smb_ucs2_t c, unsigned int n)
                }
 
                if (!n) {
-                       return (smb_ucs2_t *)p;
+                       return discard_const_p(smb_ucs2_t, p);
                }
        } while (p-- != s);
        return NULL;
@@ -142,7 +142,7 @@ smb_ucs2_t *strnrchr_w(const smb_ucs2_t *s, smb_ucs2_t c, unsigned int n)
 
 smb_ucs2_t *strstr_w(const smb_ucs2_t *s, const smb_ucs2_t *ins)
 {
-       smb_ucs2_t *r;
+       const smb_ucs2_t *r;
        size_t inslen;
 
        if (!s || !*s || !ins || !*ins) {
@@ -150,11 +150,11 @@ smb_ucs2_t *strstr_w(const smb_ucs2_t *s, const smb_ucs2_t *ins)
        }
 
        inslen = strlen_w(ins);
-       r = (smb_ucs2_t *)s;
+       r = s;
 
        while ((r = strchr_w(r, *ins))) {
                if (strncmp_w(r, ins, inslen) == 0) {
-                       return r;
+                       return discard_const_p(smb_ucs2_t, r);
                }
                r++;
        }