From 8a675787a2e526b42853621e83c8573ac61df546 Mon Sep 17 00:00:00 2001 From: Felix von Leitner Date: Fri, 12 Mar 2004 23:20:42 +0000 Subject: [PATCH] fix embarassing bug --- byte/byte_diff.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/byte/byte_diff.c b/byte/byte_diff.c index 4cd09e3..55e95b4 100644 --- a/byte/byte_diff.c +++ b/byte/byte_diff.c @@ -6,16 +6,16 @@ * one[len-1]. When the strings are different, byte_diff does not read * bytes past the first difference. */ int byte_diff(const void* a, unsigned long len, const void* b) { - register const char* s=a; - register const char* t=b; - register const char* u=t+len; + register const unsigned char* s=a; + register const unsigned char* t=b; + register const unsigned char* u=t+len; register int j; j=0; for (;;) { - if (t==u) break; if ((j=(*s-*t))) break; ++s; ++t; - if (t==u) break; if ((j=(*s-*t))) break; ++s; ++t; - if (t==u) break; if ((j=(*s-*t))) break; ++s; ++t; - if (t==u) break; if ((j=(*s-*t))) break; ++s; ++t; + if (t==u) break; if ((j=((unsigned int)*s-*t))) break; ++s; ++t; + if (t==u) break; if ((j=((unsigned int)*s-*t))) break; ++s; ++t; + if (t==u) break; if ((j=((unsigned int)*s-*t))) break; ++s; ++t; + if (t==u) break; if ((j=((unsigned int)*s-*t))) break; ++s; ++t; } return j; }