From: Nadav Har'El <[email protected]> Committer: Nadav Har'El <[email protected]> Branch: master
memset_base(): avoid warnings in stricter C++ compiler If we try to compile memset.c with a C++ compiler, we get warnings on various implied pointer conversions. Let's make them explict, and this way the code can compile as either C or C++ code. I want to be able to compile it as C++ code because in the next patch I want to use it in fastlz/lzloader.cc. Signed-off-by: Nadav Har'El <[email protected]> --- diff --git a/libc/string/memset.c b/libc/string/memset.c --- a/libc/string/memset.c +++ b/libc/string/memset.c @@ -9,13 +9,13 @@ void *memset_base(void *dest, int c, size_t n) { - unsigned char *s = dest; + unsigned char *s = (unsigned char *)dest; c = (unsigned char)c; for (; ((uintptr_t)s & ALIGN) && n; n--) *s++ = c; if (n) { size_t *w, k = ONES * c; - for (w = (void *)s; n>=SS; n-=SS, w++) *w = k; - for (s = (void *)w; n; n--, s++) *s = c; + for (w = (size_t *)s; n>=SS; n-=SS, w++) *w = k; + for (s = (unsigned char *)w; n; n--, s++) *s = c; } return dest; } -- You received this message because you are subscribed to the Google Groups "OSv Development" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/osv-dev/000000000000c4c81505a66764c9%40google.com.
