From eff35b8a5415ce5e798db4da5e000a7bd3ed792c Mon Sep 17 00:00:00 2001 From: Jan Nieuwenhuizen Date: Sun, 26 May 2019 13:41:00 +0200 Subject: [PATCH] mescc: Mes C Library: Fix compile warnings. * lib/stdio/fputc.c (fputc): Oops, stream is a long. * lib/stdlib/malloc.c (malloc): Cast to char *. FIXME * lib/string/memchr.c (memchr): Cast to void *. * lib/string/memcmp.c (memcmp): Add const cast. --- lib/stdio/fputc.c | 2 +- lib/stdlib/malloc.c | 2 +- lib/string/memchr.c | 2 +- lib/string/memcmp.c | 4 ++-- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/stdio/fputc.c b/lib/stdio/fputc.c index 232b534a..4931e710 100644 --- a/lib/stdio/fputc.c +++ b/lib/stdio/fputc.c @@ -23,5 +23,5 @@ int fputc (int c, FILE * stream) { - return fdputc (c, (int) stream); + return fdputc (c, (long) stream); } diff --git a/lib/stdlib/malloc.c b/lib/stdlib/malloc.c index 940f95b5..e16f0036 100644 --- a/lib/stdlib/malloc.c +++ b/lib/stdlib/malloc.c @@ -24,7 +24,7 @@ void * malloc (size_t size) { if (!__brk) - __brk = brk (0); + __brk = (char *) brk (0); if (brk (__brk + size) == -1) return 0; char *p = __brk; diff --git a/lib/string/memchr.c b/lib/string/memchr.c index eac13a9f..66485d4b 100644 --- a/lib/string/memchr.c +++ b/lib/string/memchr.c @@ -27,7 +27,7 @@ memchr (void const *block, int c, size_t size) while (size--) { if (c == *p) - return p; + return (void *) p; p++; } return 0; diff --git a/lib/string/memcmp.c b/lib/string/memcmp.c index 1d67e202..5c28af8c 100644 --- a/lib/string/memcmp.c +++ b/lib/string/memcmp.c @@ -25,8 +25,8 @@ memcmp (void const *s1, void const *s2, size_t size) { if (!size) return 0; - char *a = s1; - char *b = s2; + char const *a = s1; + char const *b = s2; while (*a == *b && --size) { a++;