From 11fd0bc3fdbe7b5eb9266a728a81d0bcac91fe32 Mon Sep 17 00:00:00 2001 From: giraffedata Date: Fri, 28 Jun 2019 23:07:55 +0000 Subject: Promote Stable to Super_stable git-svn-id: http://svn.code.sf.net/p/netpbm/code/super_stable@3640 9d0c8265-081b-0410-96cb-a4ca84ce46f8 --- converter/ppm/ppmtopcx.c | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) (limited to 'converter/ppm/ppmtopcx.c') diff --git a/converter/ppm/ppmtopcx.c b/converter/ppm/ppmtopcx.c index edc44149..fa68edc5 100644 --- a/converter/ppm/ppmtopcx.c +++ b/converter/ppm/ppmtopcx.c @@ -12,6 +12,10 @@ ** ** 11/Dec/94: first version ** 12/Dec/94: added handling of "packed" format (16 colors or less) +** +** ZSoft PCX File Format Technical Reference Manual +** http://bespin.org/~qz/pc-gpe/pcx.txt +** http://web.archive.org/web/20100206055706/http://www.qzx.com/pc-gpe/pcx.txt */ #include @@ -79,7 +83,7 @@ parseCommandLine(int argc, char ** argv, was passed to us as the argv array. We also trash *argv. -----------------------------------------------------------------------------*/ optEntry *option_def; - /* Instructions to optParseOptions3 on how to parse our options. + /* Instructions to pm_optParseOptions3 on how to parse our options. */ optStruct3 opt; @@ -111,7 +115,7 @@ parseCommandLine(int argc, char ** argv, opt.short_allowed = FALSE; /* We have no short (old-fashioned) options */ opt.allowNegNum = FALSE; /* We have no parms that are negative numbers */ - optParseOptions3( &argc, argv, opt, sizeof(opt), 0 ); + pm_optParseOptions3( &argc, argv, opt, sizeof(opt), 0 ); /* Uses and sets argc, argv, and some of *cmdline_p and others. */ if (!xposSpec) @@ -158,6 +162,8 @@ parseCommandLine(int argc, char ** argv, pm_error("Program takes at most one argument " "(input file specification). You specified %d", argc-1); + + free(option_def); } @@ -632,6 +638,16 @@ generateStandardPalette(struct pcxCmapEntry ** const pcxcmapP, putPcxColorInHash(cht, pcxColor, colorIndex, maxval); } + /* Set remaining slots in palette to black. The values are not + meaningful, but this suppresses a Valgrind warning about our writing + undefined values to the file and makes our output constant with input. + */ + for ( ; colorIndex < MAXCOLORS; ++colorIndex) { + pcxcmap[colorIndex].r = 0; + pcxcmap[colorIndex].g = 0; + pcxcmap[colorIndex].b = 0; + } + *chtP = cht; *colorsP = stdPaletteSize; } -- cgit 1.4.1