On Sat, Aug 09, 2008 at 09:27:58PM +0200, Ulf Jordan wrote:
> On Sat, 9 Aug 2008, Stefan Reinauer wrote:
> >void * is a good idea here.
> 
> I sent a patch along those lines in this thread earlier today
> (10:21:43 +0200 (CEST)), chaning to void * in libpayload.h and
> memory.c. Does it do the right thing?

If not, it is very close.


On Sat, Aug 09, 2008 at 10:21:43AM +0200, Ulf Jordan wrote:
> Fix signedness problem in memcmp.
> 
> Signed-off-by: Ulf Jordan <[EMAIL PROTECTED]>
> 
> Index: libpayload/include/libpayload.h
> ===================================================================
> --- libpayload/include/libpayload.h   (revision 3478)
> +++ libpayload/include/libpayload.h   (arbetskopia)
> @@ -179,7 +179,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, ...);
> Index: libpayload/libc/memory.c
> ===================================================================
> --- libpayload/libc/memory.c  (revision 3478)
> +++ libpayload/libc/memory.c  (arbetskopia)
> @@ -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;
>  }

Maybe cast to unsigned char or u8 instead?

I'm good with this though.

Acked-by: Peter Stuge <[EMAIL PROTECTED]>

--
coreboot mailing list
[email protected]
http://www.coreboot.org/mailman/listinfo/coreboot

Reply via email to