On Sat, 9 Aug 2008, Peter Stuge wrote:
On Sat, Aug 09, 2008 at 02:09:22PM -0600, Jordan Crouse wrote:
Maybe cast to unsigned char or u8 instead?
Yes - we should cast to unsigned everywhere in here.
Here's a patch.
Looks good and compiles.
Acked-by: Ulf Jordan jordan@chalmers.se
libpayload: Use u8 for the comparison in memcmp()
Signed-off-by: Peter Stuge peter@stuge.se
Index: libc/memory.c
--- libc/memory.c (revision 3492) +++ libc/memory.c (working copy) @@ -109,6 +109,6 @@ */ int memcmp(const void *s1, const void *s2, size_t len) {
- for (; len && *(char *)s1++ == *(char *)s2++; len--) ;
- for (; len && *(u8 *)s1++ == *(u8 *)s2++; len--) ; return len;
}