Author: stuge Date: 2008-08-09 21:34:56 +0200 (Sat, 09 Aug 2008) New Revision: 3491
Modified: trunk/payloads/libpayload/include/libpayload.h trunk/payloads/libpayload/libc/memory.c Log: Fix signedness problem in memcmp.
Signed-off-by: Ulf Jordan jordan@chalmers.se Acked-by: Peter Stuge peter@stuge.se
Modified: trunk/payloads/libpayload/include/libpayload.h =================================================================== --- trunk/payloads/libpayload/include/libpayload.h 2008-08-08 18:36:14 UTC (rev 3490) +++ trunk/payloads/libpayload/include/libpayload.h 2008-08-09 19:34:56 UTC (rev 3491) @@ -178,7 +178,7 @@ 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, ...);
Modified: trunk/payloads/libpayload/libc/memory.c =================================================================== --- trunk/payloads/libpayload/libc/memory.c 2008-08-08 18:36:14 UTC (rev 3490) +++ trunk/payloads/libpayload/libc/memory.c 2008-08-09 19:34:56 UTC (rev 3491) @@ -107,8 +107,8 @@ * @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; }