On 2008-12-04 12:21:33 -0800, Erik Hovland wrote: > 4. Since getc returns int, the variable that stores it should be that type. > > If the variable that stores the return value of getc is smaller then > int (like a char in this case) then the return value is truncated.
This can be even implementation-defined or undefined behavior. BTW, shouldn't Mutt check for EOF (which can occur either because of end of file or because of error)? > diff --git a/hash.c b/hash.c > --- a/hash.c > +++ b/hash.c > @@ -39,7 +39,6 @@ int hash_string (const unsigned char *s, > while (*s) > h += (h << 7) + *s++; > h = (h * SOMEPRIME) % n; > - h = (h >= 0) ? h : h + n; > #endif > > return (signed) (h % n); Since h is the result of some value % n, then the % n in the return statement is useless. -- Vincent Lefèvre <[EMAIL PROTECTED]> - Web: <http://www.vinc17.org/> 100% accessible validated (X)HTML - Blog: <http://www.vinc17.org/blog/> Work: CR INRIA - computer arithmetic / Arenaire project (LIP, ENS-Lyon)
