Problem: Clang warning for int shift overflow.
Solution: Use unsigned and cast back to int. (Dominique Pelle)
get4c(fd)
FILE *fd;
{
- int n;
-
- n = getc(fd);
- n = (n << 8) + getc(fd);
- n = (n << 8) + getc(fd);
- n = (n << 8) + getc(fd);
- return n;
+ /* Use unsigned rather than int otherwise result is undefined
+ * when left-shift sets the MSB. */
+ unsigned n;
+
+ n = (unsigned)getc(fd);
+ n = (n << 8) + (unsigned)getc(fd);
+ n = (n << 8) + (unsigned)getc(fd);
+ n = (n << 8) + (unsigned)getc(fd);
+ return (int)n;
}
/*
static int included_patches[] =
{ /* Add new patch number below this line */
+/**/
+ 26,
/**/
25,
/**/