summaryrefslogtreecommitdiff
path: root/lib/util
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 /lib/util
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
Diffstat (limited to 'lib/util')
-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
3 files changed, 7 insertions, 7 deletions
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));
}