From 925336fe011635da550369b9db527f034fbc587d Mon Sep 17 00:00:00 2001 From: giraffedata Date: Sun, 20 Mar 2022 17:26:12 +0000 Subject: Release 10.86.32 git-svn-id: http://svn.code.sf.net/p/netpbm/code/stable@4311 9d0c8265-081b-0410-96cb-a4ca84ce46f8 --- converter/other/pnmtorle.c | 36 +++++++++++++++++++++++++++++------- doc/HISTORY | 15 +++++++++++++++ editor/pamsistoaglyph.c | 7 +++++-- other/pambayer.c | 38 ++++++++++++++++++++++++++++++++++++++ other/pamx/window.c | 2 +- version.mk | 2 +- 6 files changed, 89 insertions(+), 11 deletions(-) diff --git a/converter/other/pnmtorle.c b/converter/other/pnmtorle.c index 8908c356..7c378246 100644 --- a/converter/other/pnmtorle.c +++ b/converter/other/pnmtorle.c @@ -207,12 +207,35 @@ write_rle_data(void) { +static void +skip_data(FILE * const fp, + int const width, + int const height, + gray const maxval, + int const format) { + + xel * xelrow; + unsigned int scan; + + MALLOCARRAY(xelrow, width); + if (xelrow == NULL) + pm_error("Failed to allocate memory for row of %u pixels", width); + + for(scan=0; scan < height; ++scan) + pnm_readpnmrow(fp, xelrow, width, maxval, format); + + free(xelrow); +} + + + int main(int argc, char ** argv) { const char * pnmname; const char * outname; int oflag; + int eof; pnm_init(&argc, argv); @@ -245,18 +268,17 @@ main(int argc, char ** argv) { hdr.rle_file = rle_open_f( hdr.cmd, outname, "wb" ); - if (header) + for (eof = 0; !eof; ) { read_pnm_header(); - else { - int eof; - for (eof = 0; !eof; ) { - read_pnm_header(); + + if (header) + skip_data(fp, width, height, maxval, format); + else { rle_addhist(argv, NULL, &hdr); write_rle_header(); write_rle_data(); - - pnm_nextimage(fp, &eof); } + pnm_nextimage(fp, &eof); } pm_close(fp); diff --git a/doc/HISTORY b/doc/HISTORY index 1c911ad4..f775d24b 100644 --- a/doc/HISTORY +++ b/doc/HISTORY @@ -4,6 +4,21 @@ Netpbm. CHANGE HISTORY -------------- +22.03.20 BJH Release 10.86.32 + + pamx: Fix bug: top-justifies image in all cases where it should + bottom-justify. Always broken. (pamx was new in Netpbm 10.34 + (June 2006). + + pnmtorle: Fix bug: -h works only on first image. + + pamsistoaglyph: Fix invalid memory reference and incorrect + output on depth 1 input. Always broken. (pamsistoaglyph was + new in Netpbm 10.47 (June 2009). Thanks Scott Pakin. + + pambayer: Fix bogus colors at edges. Always broken (pambayer + was new in Release 10.30 (October 2005)). + 22.02.13 BJH Release 10.86.31 libnetpbm, various programs: fix bug: bogus warning that a color diff --git a/editor/pamsistoaglyph.c b/editor/pamsistoaglyph.c index 6b093520..f9e25518 100644 --- a/editor/pamsistoaglyph.c +++ b/editor/pamsistoaglyph.c @@ -6,7 +6,7 @@ * * ---------------------------------------------------------------------- * - * Copyright (C) 2009 Scott Pakin + * Copyright (C) 2009-2022 Scott Pakin * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -127,7 +127,10 @@ readAsGray( const char * const fileName, for (col = 0; col < pamP->width; ++col) { double YP, CbP, CrP; - pnm_YCbCrtuple( tuplerow[col], &YP, &CbP, &CrP ); + if (pamP->depth >= 3) + pnm_YCbCrtuple(tuplerow[col], &YP, &CbP, &CrP); + else + YP = (double) tuplerow[col][0]; grayArray[row][col] = (gray) (YP * maxGrayVal / (double)pamP->maxval); } diff --git a/other/pambayer.c b/other/pambayer.c index 7fc1f809..9cffc8f0 100644 --- a/other/pambayer.c +++ b/other/pambayer.c @@ -78,6 +78,8 @@ parseCommandLine(int argc, const char ** argv, pm_optParseOptions3(&argc, (char **)argv, opt, sizeof(opt), 0); /* Uses and sets argc, argv, and some of *cmdlineP and others. */ + free(option_def); + if (argc-1 < 1) cmdlineP->inputFilespec = "-"; else if (argc-1 > 1) @@ -100,6 +102,41 @@ parseCommandLine(int argc, const char ** argv, +static void +clearTuples(const struct pam * const pamP, + tuple ** const outtuples) { + + unsigned int row; + unsigned int col; + unsigned int plane; + + if(pamP->height <= 4 || pamP->width <= 4) { + for(row=0; row < pamP->height; ++row) + for(col=0; col < pamP->width; ++col) + for (plane=0; plane < pamP->depth; ++plane) + outtuples[row][col][plane] = 0; + } + else { + for(col = 0; col < pamP->width; ++col) + for (plane = 0; plane < pamP->depth; ++plane) { + outtuples[0][col][plane] = 0; + outtuples[1][col][plane] = 0; + outtuples[pamP->height-2][col][plane] = 0; + outtuples[pamP->height-1][col][plane] = 0; + } + + for(row = 2; row < pamP->height - 2; ++row) + for (plane = 0; plane < pamP->depth; ++plane) { + outtuples[row][0][plane] = 0; + outtuples[row][1][plane] = 0; + outtuples[row][pamP->width-2][plane] = 0; + outtuples[row][pamP->width-1][plane] = 0; + } + } +} + + + static void calc_4(const struct pam * const pamP, tuple ** const intuples, @@ -319,6 +356,7 @@ main(int argc, const char **argv) { makeOutputPam(&inpam, &outpam); outtuples = pnm_allocpamarray(&outpam); + clearTuples(&outpam, outtuples); for (plane = 0; plane < 3; ++plane) { struct compAction const compAction = compActionTable[plane]; diff --git a/other/pamx/window.c b/other/pamx/window.c index d907163b..d44008c9 100644 --- a/other/pamx/window.c +++ b/other/pamx/window.c @@ -366,7 +366,7 @@ placeImage(viewer * const viewerP, pixy = (viewerP->height - height) / 2; else { if ((pixy < 0) && (pixy + height < viewerP->height)) - pixy = viewerP->height - viewerP->height; + pixy = viewerP->height - height; if (pixy > 0) pixy = 0; } diff --git a/version.mk b/version.mk index 986afc5b..ad4cadaf 100644 --- a/version.mk +++ b/version.mk @@ -1,3 +1,3 @@ NETPBM_MAJOR_RELEASE = 10 NETPBM_MINOR_RELEASE = 86 -NETPBM_POINT_RELEASE = 31 +NETPBM_POINT_RELEASE = 32 -- cgit 1.4.1