kamath@reed.UUCP (Sean Kamath) (09/15/89)
In unpack.c (which unpacks to pk font), I found two bugs that made the output look really grundgy. Both bugs only occure on byte-swapped machines. The first bug has to do with where 'raster' is used to call 'flip'. Because raster (a pointer) is moved about thither and yon, the original address pointed to by raster must be saved for the call to 'flip'. The second bug is in the calculation of how many bytes to flip. In grubbing through download.c file, I found the same calculation for the length, but with the added line of checking to see if the length returned is negative. Sure enough, this check, not in the original unpack.c, corrects the count for unpacking. I found this bug by trying to run 'tex testfont' on cmr10 with \math set. Sean Kamath UUCP: {decvax allegra ucbcad ucbvax hplabs}!tektronix!reed!kamath CSNET: reed!kamath@Tektronix.CSNET || BITNET: kamath@reed.BITNET ARPA: kamath%reed.bitnet@cunyvm.cuny.edu US Snail: 3934 SE Boise, Portland, OR 97202-3126 (I hate 4 line .sigs!) #############CUT HERE###############CUT HERE###############CUT HERE####### *** unpack.c Thu Sep 14 21:22:35 1989 --- unpack.c.orig Thu Sep 14 21:16:37 1989 *************** *** 160,166 Boolean turnon ; shalfword hbit ; halfword count ; - halfword *raster_start = raster; /* keep original raster start */ realfunc = pkpackednum ; p = pack ; --- 160,165 ----- Boolean turnon ; shalfword hbit ; halfword count ; realfunc = pkpackednum ; p = pack ; *************** *** 237,249 if ( ( rowsleft != 0 ) || ( hbit != cwidth ) ) error ( "! error while unpacking; more bits than required" ) ; } ! /* ! * modified to handle really small char def and start from the right place ! */ ! if (*(char *)&bftest) { ! long i = (((long) cwidth + 15) / 16) *2 * (long) cheight; ! if (i <= 0) i = 2; ! flip(raster_start,i); ! } return(p-pack) ; } --- 236,242 ----- if ( ( rowsleft != 0 ) || ( hbit != cwidth ) ) error ( "! error while unpacking; more bits than required" ) ; } ! if (*(char *)&bftest) ! flip(raster, ((cwidth + 15) >> 4) * (long)cheight * 2) ; return(p-pack) ; }