summaryrefslogtreecommitdiff
path: root/source4/lib
diff options
context:
space:
mode:
Diffstat (limited to 'source4/lib')
-rw-r--r--source4/lib/tdb/common/tdbutil.c2
-rw-r--r--source4/lib/util.c7
-rw-r--r--source4/lib/util_unistr.c6
3 files changed, 9 insertions, 6 deletions
diff --git a/source4/lib/tdb/common/tdbutil.c b/source4/lib/tdb/common/tdbutil.c
index 596a79f52e..0e0a6eca28 100644
--- a/source4/lib/tdb/common/tdbutil.c
+++ b/source4/lib/tdb/common/tdbutil.c
@@ -82,7 +82,7 @@ static void (*TdbCatchSignal(int signum,void (*handler)(int )))(int)
static TDB_DATA make_tdb_data(const char *dptr, size_t dsize)
{
TDB_DATA ret;
- ret.dptr = dptr;
+ ret.dptr = discard_const_p(char, dptr);
ret.dsize = dsize;
return ret;
}
diff --git a/source4/lib/util.c b/source4/lib/util.c
index 910a35217c..2862a40bd7 100644
--- a/source4/lib/util.c
+++ b/source4/lib/util.c
@@ -944,8 +944,11 @@ BOOL all_zero(const char *ptr, uint_t size)
we get new errors.
Please only add more calls to this function when you find it
- _really_ hard to fix const warnings. Our aim is to eventually not
- need this function at all,
+ _really_ hard to fix const warnings. Our aim is to eventually use
+ this function in only a very few places.
+
+ Also, please call this via the discard_const_p() macro interface, as that
+ makes the return type safe.
*/
void *discard_const(const void *ptr)
{
diff --git a/source4/lib/util_unistr.c b/source4/lib/util_unistr.c
index 1d7d0de19a..2d4b2e8fa8 100644
--- a/source4/lib/util_unistr.c
+++ b/source4/lib/util_unistr.c
@@ -224,10 +224,10 @@ wide strchr()
smb_ucs2_t *strchr_w(const smb_ucs2_t *s, smb_ucs2_t c)
{
while (*s != 0) {
- if (c == *s) return s;
+ if (c == *s) return discard_const_p(smb_ucs2_t, s);
s++;
}
- if (c == *s) return s;
+ if (c == *s) return discard_const_p(smb_ucs2_t, s);
return NULL;
}
@@ -244,7 +244,7 @@ smb_ucs2_t *strrchr_w(const smb_ucs2_t *s, smb_ucs2_t c)
if (len == 0) return NULL;
p += (len - 1);
do {
- if (c == *p) return p;
+ if (c == *p) return discard_const_p(smb_ucs2_t, p);
} while (p-- != s);
return NULL;
}