From 68285699da68490681b330f0d345079b231c11cf Mon Sep 17 00:00:00 2001 From: Ulf Jordan Date: Sat, 9 Aug 2008 19:34:56 +0000 Subject: Fix signedness problem in memcmp. Signed-off-by: Ulf Jordan Acked-by: Peter Stuge git-svn-id: svn://svn.coreboot.org/coreboot/trunk@3491 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1 --- payloads/libpayload/include/libpayload.h | 2 +- payloads/libpayload/libc/memory.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'payloads') diff --git a/payloads/libpayload/include/libpayload.h b/payloads/libpayload/include/libpayload.h index 188039e0f4..ff69eaad2f 100644 --- a/payloads/libpayload/include/libpayload.h +++ b/payloads/libpayload/include/libpayload.h @@ -178,7 +178,7 @@ u8 hex2bin(u8 h); void *memset(void *s, int c, size_t n); void *memcpy(void *dst, const void *src, size_t n); void *memmove(void *dst, const void *src, size_t n); -int memcmp(const char *s1, const char *s2, size_t len); +int memcmp(const void *s1, const void *s2, size_t len); /* libc/printf.c */ int snprintf(char *str, size_t size, const char *fmt, ...); diff --git a/payloads/libpayload/libc/memory.c b/payloads/libpayload/libc/memory.c index 57c31e0bb3..eb9fecc94c 100644 --- a/payloads/libpayload/libc/memory.c +++ b/payloads/libpayload/libc/memory.c @@ -107,8 +107,8 @@ void *memmove(void *dst, const void *src, size_t n) * @return If len is 0, return zero. If the areas match, return zero. * Otherwise return non-zero. */ -int memcmp(const char *s1, const char *s2, size_t len) +int memcmp(const void *s1, const void *s2, size_t len) { - for (; len && *s1++ == *s2++; len--) ; + for (; len && *(char *)s1++ == *(char *)s2++; len--) ; return len; } -- cgit v1.2.3