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; }