bert@let.rug.nl (Bert Bos) (11/29/90)
The pgmcolor program for artificially coloring gray scale images was posted to alt.sources on Nov 19. I received a patch from Brian Reynolds fixing two bugs that somehow didn't show up on my system: missing types for argc and argv in main() and a missing memory allocation via pgm_allocrow() in doAbsolute(). So now the original should be called version 1.0 and the new program is 1.1. I'm sorry about the format of the patch: it's a context diff, not a "new style context diff". Anyone know where to get the new diff program? -------------------------- CUT HERE ---------------------------------------- *** pgmcolor.c.orig Thu Nov 29 12:27:24 1990 --- pgmcolor.c Thu Nov 29 12:27:39 1990 *************** *** 1,7 /* pgmcolor -- Make a false color image from a portable gray map Copyright: Bert Bos <bert@let.rug.nl> ! Date: 19 Nov 1990 Usage: pgmcolor [-v] [-a] palette [pgmfile] --- 1,7 ----- /* pgmcolor -- Make a false color image from a portable gray map Copyright: Bert Bos <bert@let.rug.nl> ! Version 1.1 (29 Nov 1990) Usage: pgmcolor [-v] [-a] palette [pgmfile] *************** *** 18,23 assigned to graylevels 0, 1, 2, etc. regardless of the existence of this levels in the PGM file. */ #include <stdio.h> --- 18,26 ----- assigned to graylevels 0, 1, 2, etc. regardless of the existence of this levels in the PGM file. + Version 1.0 (19 Nov 1990) + Version 1.1 (29 Nov 1990) patches by Brian Reynolds: added missing types for + argc & argv; added missing pgm_allocrow() call. */ #include <stdio.h> *************** *** 128,133 /* Loop over rows of PGM file */ newrow = ppm_allocrow(colsG); for (row = 0; row < rowsG; row++) { pgm_readpgmrow(infile, grayrow, colsG, maxvalG, formatG); for (col = 0; col < colsG; col++) --- 131,137 ----- /* Loop over rows of PGM file */ newrow = ppm_allocrow(colsG); + grayrow = pgm_allocrow(colsG); for (row = 0; row < rowsG; row++) { pgm_readpgmrow(infile, grayrow, colsG, maxvalG, formatG); for (col = 0; col < colsG; col++) *************** *** 214,219 /* main -- main routine of pgmcolor */ int main(argc, argv) { FILE *infile, *palette; --- 218,225 ----- /* main -- main routine of pgmcolor */ int main(argc, argv) + int argc; + char *argv[]; { FILE *infile, *palette; -------------------------- CUT HERE ---------------------------------------- -- "Always remember, however, that there's Bert Bos (bert@let.rug.nl) usually a simpler and better way to do Alfa-informatica something than the first way that pops RijksUniversiteit Groningen into your head." (D.E. Knuth, TeXbook) Groningen, The Netherlands