$NetBSD: patch-av,v 1.1 1999/01/10 23:52:17 tron Exp $ --- pnm/pnmtotiff.c.orig Thu Jan 27 17:59:25 1994 +++ pnm/pnmtotiff.c Sun Jan 10 23:48:40 1999 @@ -196,6 +196,7 @@ samplesperpixel = 1; bitspersample = pm_maxvaltobits( maxval ); photometric = PHOTOMETRIC_MINISBLACK; + i = 8 / bitspersample; bytesperrow = ( cols + i - 1 ) / i; } else @@ -276,20 +277,20 @@ for ( col = 0, xP = xels[row], tP = buf; col < cols; ++col, ++xP ) { - register unsigned char s; + register xelval s; s = PPM_GETR( *xP ); if ( maxval != 255 ) - s = (long) s * 255 / maxval; - *tP++ = s; + s = s * 255 / maxval; + *tP++ = (unsigned char)s; s = PPM_GETG( *xP ); if ( maxval != 255 ) - s = (long) s * 255 / maxval; - *tP++ = s; + s = s * 255 / maxval; + *tP++ = (unsigned char)s; s = PPM_GETB( *xP ); if ( maxval != 255 ) - s = (long) s * 255 / maxval; - *tP++ = s; + s = s * 255 / maxval; + *tP++ = (unsigned char)s; } } else