diff --git a/netpbm-10.83.01.tar.xz b/netpbm-10.83.01.tar.xz deleted file mode 100644 index 47e9987261c8c2821f806053c60c1bf3314bb0b1..0000000000000000000000000000000000000000 Binary files a/netpbm-10.83.01.tar.xz and /dev/null differ diff --git a/netpbm-11.02.00.tar.xz b/netpbm-11.02.00.tar.xz new file mode 100644 index 0000000000000000000000000000000000000000..96eafe2b21bb75f15ce0141cac03dd4a5080110e Binary files /dev/null and b/netpbm-11.02.00.tar.xz differ diff --git a/netpbm-CAN-2005-2471.patch b/netpbm-CAN-2005-2471.patch index 24495de178d0f01ecc88d7db3c1f1db1ca35dd9b..ae17d6bcb44bb0bc6f9f4f17dd7f4a9d08124f8c 100644 --- a/netpbm-CAN-2005-2471.patch +++ b/netpbm-CAN-2005-2471.patch @@ -9,9 +9,9 @@ diff -urNp a/converter/other/pstopnm.c b/converter/other/pstopnm.c + "-dPARANOIDSAFER", "-"); } - execl(ghostscriptProg, arg0, deviceopt, outfileopt, gopt, ropt, "-q", -- "-dNOPAUSE", "-dSAFER", "-", NULL); -+ "-dNOPAUSE", "-dPARANOIDSAFER", "-", NULL); + execl(ghostscriptProg, arg0, deviceopt, outfileopt, gopt, ropt, +- textalphabitsopt, "-q", "-dNOPAUSE", "-dSAFER", "-", NULL); ++ "-q", "-dNOPAUSE", "-dPARANOIDSAFER", "-", NULL); pm_error("execl() of Ghostscript ('%s') failed, errno=%d (%s)", ghostscriptProg, errno, strerror(errno)); diff --git a/netpbm-bmptopnm.patch b/netpbm-bmptopnm.patch index 90954274b685bcbaed87e340e5de6b2737f81db1..d09016463f3984b673b81837ebe66c7529c17c79 100644 --- a/netpbm-bmptopnm.patch +++ b/netpbm-bmptopnm.patch @@ -1,7 +1,9 @@ ---- netpbm-10.35/converter/other/bmptopnm.c.bmptopnm 2007-01-29 13:08:46.000000000 +0100 -+++ netpbm-10.35/converter/other/bmptopnm.c 2007-01-29 13:32:21.000000000 +0100 -@@ -1262,7 +1262,7 @@ readBmp(FILE * const ifP, - xel ** const colormapP, +diff --git a/converter/other/bmptopnm.c b/converter/other/bmptopnm.c +index 3f66634..ca4f944 100644 +--- a/converter/other/bmptopnm.c ++++ b/converter/other/bmptopnm.c +@@ -1494,7 +1494,7 @@ readBmp(FILE * const ifP, + unsigned int * const cmapSizeP, bool const verbose) { - xel * colormap; /* malloc'ed */ diff --git a/netpbm-c99.patch b/netpbm-c99.patch new file mode 100644 index 0000000000000000000000000000000000000000..ed0a8870ea387f49dd00ebc942738e2895e0481f --- /dev/null +++ b/netpbm-c99.patch @@ -0,0 +1,46 @@ +Include "pm.h" for the declaration of the overflow_add function. This +avoids an implicit function declaration. Future C compilers will +require that all functions are declared explicitly. Implicit function +declarations are a language feature that was removed in 1999. + +Likewise, include "pm.h" for the newly added declarations of realloc2. +This fixes a pointer truncation bug in pjtoppm. + +Both issues are specific to downstream patches. + +diff --git a/converter/pbm/pbmtoppa/pbm.c b/converter/pbm/pbmtoppa/pbm.c +index 1c8d236219b297e1..d63cab63b13f2051 100644 +--- a/converter/pbm/pbmtoppa/pbm.c ++++ b/converter/pbm/pbmtoppa/pbm.c +@@ -12,6 +12,7 @@ + #include + #include + ++#include "pm.h" + #include "ppapbm.h" + + int make_pbm_stat(pbm_stat* pbm,FILE* fptr) +diff --git a/converter/ppm/pjtoppm.c b/converter/ppm/pjtoppm.c +index c458c06457c2b9bd..5e93a6acb8d6f198 100644 +--- a/converter/ppm/pjtoppm.c ++++ b/converter/ppm/pjtoppm.c +@@ -10,6 +10,7 @@ + ** implied warranty. + */ + ++#include "pm.h" + #include "ppm.h" + #include "mallocvar.h" + +diff --git a/lib/pm.h b/lib/pm.h +index 5037c2519c565fbc..435445d5e7f52fbf 100644 +--- a/lib/pm.h ++++ b/lib/pm.h +@@ -457,6 +457,7 @@ pm_parse_height(const char * const arg); + + void *malloc2(int, int); + void *malloc3(int, int, int); ++void *realloc2(void * a, int b, int c); + #define overflow2(a,b) __overflow2(a,b) + void __overflow2(int, int); + void overflow3(int, int, int); diff --git a/netpbm-docfix.patch b/netpbm-docfix.patch index 33b3b77dcbb7cad3f02bea43897d93f90dc7965c..fe85568a09c50f86beb5bc7493f5764ea35288d4 100644 --- a/netpbm-docfix.patch +++ b/netpbm-docfix.patch @@ -1,7 +1,21 @@ -diff -urNp old/userguide/cameratopam.html new/userguide/cameratopam.html ---- old/userguide/cameratopam.html 2017-09-05 09:05:16.000000000 +0200 -+++ new/userguide/cameratopam.html 2017-09-05 13:16:33.622352535 +0200 -@@ -25,10 +25,10 @@ cameratopam - convert raw camera image t +diff --git a/converter/pbm/pbmtoepson.c b/converter/pbm/pbmtoepson.c +index 122a438..5d67746 100644 +--- a/converter/pbm/pbmtoepson.c ++++ b/converter/pbm/pbmtoepson.c +@@ -75,7 +75,7 @@ parseCommandLine(int argc, + &dpiSpec, 0); + OPTENT3(0, "adjacent", OPT_FLAG, NULL, + &adjacentSpec, 0); +- OPTENT3(0, "nonadjacent", OPT_FLAG, NULL, ++ OPTENT3(0, "noadjacent", OPT_FLAG, NULL, + &nonadjacentSpec, 0); + + opt.opt_table = option_def; +diff --git a/userguide/cameratopam.html b/userguide/cameratopam.html +index b50bfeb..3af9008 100644 +--- a/userguide/cameratopam.html ++++ b/userguide/cameratopam.html +@@ -24,10 +24,10 @@ cameratopam - convert raw camera image to PAM [-balance_camera] [-red_scale=float] [-blue_scale=float] @@ -14,7 +28,7 @@ diff -urNp old/userguide/cameratopam.html new/userguide/cameratopam.html [-linear] [-verbose] -@@ -106,7 +106,7 @@ the default. +@@ -110,7 +110,7 @@ the default.
Further adjust the color balance by multiplying the red and blue channels by these values. Both default to 1.0. @@ -23,7 +37,7 @@ diff -urNp old/userguide/cameratopam.html new/userguide/cameratopam.html
Change the output brightness. Default is 1.0. -@@ -114,14 +114,14 @@ channels by these values. Both default +@@ -118,14 +118,14 @@ channels by these values. Both default to 1.0.
By default, cameratoapm clips all colors to prevent pink hues in the highlights. Combine this option with @@ -40,47 +54,49 @@ diff -urNp old/userguide/cameratopam.html new/userguide/cameratopam.html
For cameras based on the Fuji Super CCD SR, this option causes cameratopam to use the secondary sensors, in effect -diff -urNp old/userguide/fiascotopnm.html new/userguide/fiascotopnm.html ---- old/userguide/fiascotopnm.html 2017-09-05 09:05:16.000000000 +0200 -+++ new/userguide/fiascotopnm.html 2017-09-05 13:32:51.810458154 +0200 -@@ -51,7 +51,7 @@ the output file(s) are written to the fi +diff --git a/userguide/fiascotopnm.html b/userguide/fiascotopnm.html +index c33f701..fa84441 100644 +--- a/userguide/fiascotopnm.html ++++ b/userguide/fiascotopnm.html +@@ -56,7 +56,7 @@ the output file(s) are written to the first (writable) directory of this list. Otherwise, the current directory is used to store the output file(s). --
-z, --fast -+
-r, --fast -
+-
-z, --fast ++
-r, --fast +
Decompress images in the 4:2:0 format; i.e., each chroma channel is decompressed to an image of halved width and height. Use this option -@@ -83,7 +83,7 @@ given amount N. N is 1 (mi - is 70. When N=0, then the smoothing amount specified in the +@@ -88,7 +88,7 @@ given amount N. N is 1 (minimum) to 100 (maximum); default + is 70. When N=0, then the smoothing amount specified in the FIASCO file is used (defined by the FIASCO coder). --
-F N, --fps=N -+
-F N, --framerate=N -
- Set number of frames per second to N. When using this option, +-
-F N, --fps=N ++
-F N, --framerate=N +
+ Set number of frames per second to N. When using this option, the frame rate specified in the FIASCO file is overridden. -@@ -113,13 +113,8 @@ following methods (in the specified orde -
  • --config=name - +@@ -118,13 +118,8 @@ following methods (in the specified order): +
  • --config=name + --
    -h, --info --
    +-
    -h, --info +-
    -Print brief help, then exit. - --
    -H, --help --
    +-
    -H, --help +-
    -Print detailed help, then exit. -+
    -h, --help ++
    -h, --help +Print help, then exit. - + -diff -urNp old/userguide/pamperspective.html new/userguide/pamperspective.html ---- old/userguide/pamperspective.html 2017-09-05 09:05:16.000000000 +0200 -+++ new/userguide/pamperspective.html 2017-09-05 13:23:15.869997105 +0200 -@@ -220,7 +220,7 @@ default rectangle as the "frame." The vi +diff --git a/userguide/pamperspective.html b/userguide/pamperspective.html +index 018f18a..13073d2 100644 +--- a/userguide/pamperspective.html ++++ b/userguide/pamperspective.html +@@ -223,7 +223,7 @@ default rectangle as the "frame." The visible part is always a rectangle the axes of which are parallel to those of the frame.

    The frame options are additive. All the parts of the image @@ -89,31 +105,20 @@ diff -urNp old/userguide/pamperspective.html new/userguide/pamperspective.html --include (or their defaults) are in the visible part. The visible part is the smallest possible rectangle that contains the parts specified those three ways. -diff -urNp old/converter/pbm/pbmtoepson.c new/converter/pbm/pbmtoepson.c ---- old/converter/pbm/pbmtoepson.c 2018-01-04 14:26:14.740024843 +0100 -+++ new/converter/pbm/pbmtoepson.c 2018-01-04 14:28:47.970518766 +0100 -@@ -75,7 +75,7 @@ parseCommandLine(int ar - &dpiSpec, 0); - OPTENT3(0, "adjacent", OPT_FLAG, NULL, - &adjacentSpec, 0); -- OPTENT3(0, "nonadjacent", OPT_FLAG, NULL, -+ OPTENT3(0, "noadjacent", OPT_FLAG, NULL, - &nonadjacentSpec, 0); - - opt.opt_table = option_def; -diff -urNp old/userguide/pbmtoepson.html new/userguide/pbmtoepson.html ---- old/userguide/pbmtoepson.html 2018-01-04 14:26:14.586024719 +0100 -+++ new/userguide/pbmtoepson.html 2018-01-04 14:27:56.466847698 +0100 -@@ -18,7 +18,7 @@ pbmtoepson - convert a PBM image into Ep +diff --git a/userguide/pbmtoepson.html b/userguide/pbmtoepson.html +index baacf7b..e74a7fe 100644 +--- a/userguide/pbmtoepson.html ++++ b/userguide/pbmtoepson.html +@@ -16,7 +16,7 @@ pbmtoepson - convert a PBM image into Epson printer graphics [-dpi=n] - [-protocol={escp9|escp}] + [-protocol={escp9|escp}] [-adjacent] -[-nonadjacent] +[-noadjacent] - [pbmfile] + [pbmfile] -@@ -74,7 +74,7 @@ print density for you consistent with yo +@@ -75,7 +75,7 @@ print density for you consistent with your other options.

    This option was new in Netpbm 10.23 (July 2004).

    -adjacent diff --git a/netpbm-fiasco-overflow.patch b/netpbm-fiasco-overflow.patch deleted file mode 100644 index 850dbc3084f5b01d4d5c66cc179aec8b64724c05..0000000000000000000000000000000000000000 --- a/netpbm-fiasco-overflow.patch +++ /dev/null @@ -1,12 +0,0 @@ -diff -up netpbm-10.47.09/converter/other/fiasco/lib/image.h.fiasco-overflow netpbm-10.47.09/converter/other/fiasco/lib/image.h ---- netpbm-10.47.09/converter/other/fiasco/lib/image.h.fiasco-overflow 2010-01-25 09:00:48.000000000 +0100 -+++ netpbm-10.47.09/converter/other/fiasco/lib/image.h 2010-01-27 10:29:48.000000000 +0100 -@@ -29,7 +29,7 @@ typedef struct image - * Image data - */ - { -- char id [7]; -+ char id [8]; - unsigned reference_count; - unsigned width; /* Width of the image */ - unsigned height; /* Height of the image */ diff --git a/netpbm-libdir-so.patch b/netpbm-libdir-so.patch new file mode 100644 index 0000000000000000000000000000000000000000..558daae113f85918990a1dcdfddf631d9badad02 --- /dev/null +++ b/netpbm-libdir-so.patch @@ -0,0 +1,48 @@ +diff --git a/lib/Makefile b/lib/Makefile +index bc758df..7f51b41 100644 +--- a/lib/Makefile ++++ b/lib/Makefile +@@ -221,7 +221,7 @@ libpm.o: compile.h + .PHONY: install.lib + ifeq ($(NETPBMLIBTYPE),unixshared) + # install a Unix-style shared library +-install.lib: $(PKGDIR)/lib $(PKGDIR)/sharedlink ++install.lib: $(PKGDIR)/lib + cd $(PKGDIR)/lib ; rm -f libnetpbm.$(NETPBMLIBSUFFIX).$(MAJ).* + $(INSTALL) -c -m $(INSTALL_PERM_LIBD) \ + libnetpbm.$(NETPBMLIBSUFFIX).$(MAJ).$(MIN) $(PKGDIR)/lib/ +@@ -263,27 +263,26 @@ $(INTERFACE_HEADERS:%=%_installhdr): $(PKGDIR)/include/netpbm + $(SRCDIR)/lib/$(@:%_installhdr=%) $(PKGDIR)/include/netpbm/ + + .PHONY: install.staticlib +-install.staticlib: $(PKGDIR)/staticlink ++install.staticlib: $(PKGDIR)/lib + $(INSTALL) -c -m $(INSTALL_PERM_LIBS) libnetpbm.$(STATICLIBSUFFIX) \ +- $(PKGDIR)/staticlink ++ $(PKGDIR)/lib + + # Install a shared library stub -- the ".so" file used at link time to + # prepare a program for dynamically linking a library at run time + .PHONY: install.sharedlibstub +-install.sharedlibstub: $(PKGDIR)/sharedlink ++install.sharedlibstub: $(PKGDIR)/lib + ifeq ($(NETPBMLIBTYPE),unixshared) + # install the link-time (.so) links to the runtime libraries +- cd $(PKGDIR)/sharedlink ; \ ++ cd $(PKGDIR)/lib ; \ + rm -f libnetpbm.$(NETPBMLIBSUFFIX); \ +- $(SYMLINK) ../lib/libnetpbm.$(NETPBMLIBSUFFIX).$(MAJ) \ ++ $(SYMLINK) libnetpbm.$(NETPBMLIBSUFFIX).$(MAJ) \ + libnetpbm.$(NETPBMLIBSUFFIX) + endif + ifeq ($(NETPBMLIBTYPE),dll) +- $(INSTALL) -c -m $(INSTALL_PERM_LIBS) libnetpbm.dll.a \ +- $(PKGDIR)/sharedlink ++ $(INSTALL) -c -m $(INSTALL_PERM_LIBS) libnetpbm.dll.a $(PKGDIR)/link + endif + ifeq ($(NETPBMLIBTYPE),dylib) +- cd $(PKGDIR)/sharedlink/ ; \ ++ cd $(PKGDIR)/link/ ; \ + rm -f libnetpbm.dylib; \ + $(SYMLINK) ../lib/libnetpbm.$(MAJ).$(MIN).dylib libnetpbm.dylib + endif diff --git a/netpbm-manfix.patch b/netpbm-manfix.patch index 54df85f531e67738f3a96a1f8b56bc27335cf29a..10f635d37e1975fc30e49adf98b10f97ee1ed554 100644 --- a/netpbm-manfix.patch +++ b/netpbm-manfix.patch @@ -1,184 +1,540 @@ -diff -urNp old/userguide/avstopam.html new/userguide/avstopam.html ---- old/userguide/avstopam.html 2017-09-05 13:58:08.338559550 +0200 -+++ new/userguide/avstopam.html 2017-09-05 14:00:27.371039472 +0200 -@@ -1,8 +1,7 @@ - -- -+ - - Avstopam User Manual -- - - +diff -urNp a/userguide/avstopam.html b/userguide/avstopam.html +--- a/userguide/avstopam.html 2022-01-03 16:56:37.731614243 +0100 ++++ b/userguide/avstopam.html 2022-01-03 16:58:29.889416006 +0100 +@@ -2,12 +2,13 @@ + Avstopam User Manual -diff -urNp old/userguide/escp2topbm.html new/userguide/escp2topbm.html ---- old/userguide/escp2topbm.html 2017-09-05 13:58:08.335559561 +0200 -+++ new/userguide/escp2topbm.html 2017-09-05 14:01:20.226842694 +0200 -@@ -6,6 +6,7 @@ Updated: 14 July 2015 -
    - Table Of Contents - -+

    NAME

    - escp2topbm - convert an ESC/P2 printer file to a PBM image - -

    SYNOPSIS

    -diff -urNp old/userguide/faxformat.html new/userguide/faxformat.html ---- old/userguide/faxformat.html 2017-09-05 13:58:08.337559553 +0200 -+++ new/userguide/faxformat.html 2017-09-05 14:02:33.322571279 +0200 +

    avstopam

    +-Updated: 07 February 2010 +-
    +-Table Of Contents ++ ++

    Updated: 07 February 2010

    ++ ++

    Table Of Contents

    +

    NAME

    + +-

    avstopam - convert an AVS X image to a Netpbm image ++

    avstopam - convert an AVS X image to a Netpbm image

    + +

    SYNOPSIS

    + +@@ -16,40 +17,40 @@ Updated: 07 February 2010 + +

    DESCRIPTION

    + +-

    This program is part of Netpbm. ++

    This program is part of Netpbm.

    + +

    avstopam reads a Stardent AVS X image as input and produces a Netpbm +-image as output. ++image as output.

    + +

    avsfile is the input file, which defaults to Standard Input. +-Output is always on Standard Output. ++Output is always on Standard Output.

    + +

    OPTIONS

    + +

    There are no command line options defined specifically + for avstopam, but it recognizes the options common to all + programs based on libnetpbm (See +-Common Options.) ++Common Options.)

    + +

    AUTHOR

    + +

    Copyright © 2010 Scott Pakin, +-scott+pbm@pakin.org ++scott+pbm@pakin.org

    + +

    SEE ALSO

    + +-

    pamtoavs, pam ++

    pamtoavs, pam

    + +
    + +

    Table Of Contents

    + + + +diff -urNp a/userguide/faxformat.html b/userguide/faxformat.html +--- a/userguide/faxformat.html 2022-01-03 16:56:37.731614243 +0100 ++++ b/userguide/faxformat.html 2022-01-03 16:58:29.890416013 +0100 @@ -5,10 +5,11 @@ Updated: 03 December 2008 -
    +
    -+

    SYNOPSIS

    ++

    SYNOPSIS

    This page, part of the Netpbm user's guide, describes FAX formats in relation to Netpbm facilities. - -+

    DESCRIPTION

    ++

    DESCRIPTION

    The ITU (formerly CCITT) publishes standards for operation of fax machines (the idea is to provide a way to be sure that a fax machine is able to receive a fax sent by another). These standards incidentally specify graphics file -diff -urNp old/userguide/pampaintspill.html new/userguide/pampaintspill.html ---- old/userguide/pampaintspill.html 2017-09-05 13:58:08.338559550 +0200 -+++ new/userguide/pampaintspill.html 2017-09-05 14:03:32.625351620 +0200 -@@ -1,8 +1,7 @@ - -- -+ - - Pampaintspill User Manual -- - +diff -urNp a/userguide/libnetpbm_ug.html b/userguide/libnetpbm_ug.html +--- a/userguide/libnetpbm_ug.html 2022-01-03 16:56:37.732614250 +0100 ++++ b/userguide/libnetpbm_ug.html 2022-01-03 16:58:29.891416020 +0100 +@@ -374,7 +374,7 @@ plain format. +

    Reference

    - -@@ -11,6 +10,7 @@ - -

    Table Of Contents

    - -+

    NAME

    -

    pampaintspill - smoothly spill colors into the background

    - -

    SYNOPSIS

    -diff -urNp old/userguide/pamrecolor.html new/userguide/pamrecolor.html ---- old/userguide/pamrecolor.html 2017-09-05 13:58:08.336559557 +0200 -+++ new/userguide/pamrecolor.html 2017-09-05 14:04:34.714122098 +0200 -@@ -1,8 +1,7 @@ -- -+ - - - Pamrecolor User Manual -- - +

    The Libnetpbm Netpbm Image +-Processing Manual describes the the libnetpbm functions for ++Processing Manual describes the libnetpbm functions for + processing image data. - -@@ -11,7 +10,7 @@ +

    The Libnetpbm Utility Manual +diff -urNp a/userguide/pamfunc.html b/userguide/pamfunc.html +--- a/userguide/pamfunc.html 2022-01-03 16:56:37.730614236 +0100 ++++ b/userguide/pamfunc.html 2022-01-03 16:58:29.892416027 +0100 +@@ -60,7 +60,7 @@ output image. + and bit string (such as and with 01001000). For the arithmetic functions, the + function arguments and results are the fraction that a sample is of the + maxval, i.e. normal interpretation of PAM tuples. But for the bit string +-functions, the value is the the bit string whose value as a binary cipher is ++functions, the value is the bit string whose value as a binary cipher is + the sample value, and the maxval indicates the width of the bit string. -

    Updated: 31 July 2010

    +

    Arithmetic functions

    +diff -urNp a/userguide/pammixmulti.html b/userguide/pammixmulti.html +--- a/userguide/pammixmulti.html 2022-01-03 16:56:37.731614243 +0100 ++++ b/userguide/pammixmulti.html 2022-01-03 16:58:29.893416034 +0100 +@@ -7,8 +7,8 @@ Updated: 18 November 2018 + Table Of Contents + --

    Table Of Contents

    -+

    Table Of Contents

    +-

    NAME

    +-

    pammixmulti - blend together multiple PAM images ++

    NAME

    ++

    pammixmulti - blend together multiple PAM images

    -

    NAME

    -diff -urNp old/userguide/pamsistoaglyph.html new/userguide/pamsistoaglyph.html ---- old/userguide/pamsistoaglyph.html 2017-09-05 13:58:08.334559565 +0200 -+++ new/userguide/pamsistoaglyph.html 2017-09-05 14:05:25.865944327 +0200 -@@ -1,8 +1,7 @@ - -- -+ - - Pamsistoaglyph User Manual -- - +

    SYNOPSIS

    +@@ -22,14 +22,14 @@ Updated: 18 November 2018 +

    Minimum unique abbreviation of an option is acceptable. You can use a + single hyphen instead of double hyphens to denote options. You can use white + space in place of the equals sign to separate an option name from its +-value. ++value.

    - -diff -urNp old/userguide/pamstereogram.html new/userguide/pamstereogram.html ---- old/userguide/pamstereogram.html 2017-09-05 13:58:08.337559553 +0200 -+++ new/userguide/pamstereogram.html 2017-09-05 14:13:28.523959069 +0200 -@@ -1,5 +1,5 @@ -- -- -+ -+ - - Pamstereogram User Manual - -@@ -10,7 +10,7 @@ - -

    Updated: 19 June 2015

    - --

    Table Of Contents

    -+

    Table Of Contents

    +

    DESCRIPTION

    +-

    This file is part of Netpbm. ++

    This file is part of Netpbm.

    -

    NAME

    -diff -urNp old/userguide/pamtoavs.html new/userguide/pamtoavs.html ---- old/userguide/pamtoavs.html 2017-09-05 13:58:08.329559583 +0200 -+++ new/userguide/pamtoavs.html 2017-09-05 14:05:49.299863901 +0200 -@@ -1,5 +1,5 @@ - -- -+ - - Pamtoavs User Manual - -diff -urNp old/userguide/pamtooctaveimg.html new/userguide/pamtooctaveimg.html ---- old/userguide/pamtooctaveimg.html 2017-09-05 13:58:08.335559561 +0200 -+++ new/userguide/pamtooctaveimg.html 2017-09-05 14:06:21.825752356 +0200 -@@ -1,8 +1,7 @@ - -- -+ - - Pamtooctaveimg User Manual -- - +

    pammixmulti mixes two or more images to produce a new image. The +-program provides multiple ways to interpret "mix." ++program provides multiple ways to interpret "mix."

    + +

    OPTIONS

    +@@ -37,7 +37,7 @@ program provides multiple ways to interp +

    In addition to the options common to all programs based on libnetpbm + (most notably -quiet, see + Common Options), pammixmulti recognizes the following +-command line options: ++command line options:

    + +
    +
    --blend=average|random|mask
    +@@ -50,7 +50,7 @@ output is produced by selecting the corr + images, chosen at random on a per-pixel basis. With + --blend=mask, each pixel in the output is produced by a + weighted average of the corresponding pixels from all the input images based +-on the grayscale level of an additional mask image. ++on the grayscale level of an additional mask image.

    +
  • + +
    --maskfile=filename
    +@@ -60,7 +60,7 @@ grayscale mask file to control the blend + not grayscale, the first channel is treated as gray). Where the mask file is + black, the first image is selected. Where the mask file is white, the last + image is selected. Intermediate levels of gray select intermediate +-images. ++images.

    + + +
    --stdev=number
    +@@ -77,7 +77,7 @@ that includes roughly equal amounts of t + and 2 but less of the corresponding pixel from image 3. As number + tends towards the number of input images (going beyond that has diminishing + impact), the output tends to look more +-like --blend=average. number defaults to 0.25. ++like --blend=average. number defaults to 0.25.

    + + +
    --randomseed integer +@@ -85,45 +85,45 @@ like --blend=average. numberThis is the seed for the random number generator used with + --blend=random + +-

    Use this to ensure you get the same image on separate invocations. ++

    Use this to ensure you get the same image on separate invocations.

    + + + +

    ARGUMENTS

    + +-

    You supply the names of the files to mix as non-option arguments. ++

    You supply the names of the files to mix as non-option arguments.

    + + +

    EXAMPLES

    + +-

    Average a bunch of PPM images to produce a new PAM image: ++

    Average a bunch of PPM images to produce a new PAM image:

    +
    
    +     pammixmulti input*.ppm >output.ppm
    + 
    + +

    Mix these same images by taking each pixel from a randomly selected input +-image: ++image:

    + +
    
    +     pammixmulti --blend=random input*.ppm >output.ppm
    + 
    + +

    Use a mask image to control the fading among input images on a +-pixel-by-pixel basis: ++pixel-by-pixel basis:

    + +
    
    +     pammixmulti --blend=mask --maskfile=mask.pgm >output.pam \
    +        one.pam two.pam three.pam four.pam
    + 
    + +-

    Do the same but with more abrupt transitions: ++

    Do the same but with more abrupt transitions:

    + +
    
    +     pammixmulti --blend=mask --maskfile=mask.pgm --stdev=0.0 >output.pam \
    +        one.pam two.pam three.pam four.pam
    + 
    + +-

    and now with more gradual transitions: ++

    and now with more gradual transitions:

    + +
    
    +     pammixmulti --blend=mask --maskfile=mask.pgm --stdev=1.0 >output.pam \
    +@@ -133,12 +133,12 @@ pixel-by-pixel basis:
    + 
    + 

    HISTORY

    + +-

    pammixmulti was new in Netpbm 10.85 (December 2018). ++

    pammixmulti was new in Netpbm 10.85 (December 2018).

    + + +

    AUTHOR

    + +-

    Copyright 2018 Scott Pakin, scott+pbm@pakin.org. ++

    Copyright 2018 Scott Pakin, scott+pbm@pakin.org.

    + +

    SEE ALSO

    + +@@ -146,20 +146,20 @@ pixel-by-pixel basis: + ppmmix, + pamarith, + pnm, +-pam ++pam

    + + +

    Table Of Contents

    + + + + +diff -urNp a/userguide/pampaintspill.html b/userguide/pampaintspill.html +--- a/userguide/pampaintspill.html 2022-01-03 16:56:37.730614236 +0100 ++++ b/userguide/pampaintspill.html 2022-01-03 17:05:08.124277395 +0100 +@@ -7,7 +7,7 @@ Updated: 02 November 2021 + Table Of Contents + +

    NAME

    +-pampaintspill - smoothly spill colors into the background ++

    pampaintspill - smoothly spill colors into the background

    + +

    SYNOPSIS

    + +@@ -19,17 +19,17 @@ pampaintspill - smoothly spill colors in + [--downsample=number] + [--near=number] + [--power=number] [filename] +-[-randomseed=integer] ++[-randomseed=integer]

    + + +

    Minimum unique abbreviations of option are acceptable. You may use + double hyphens instead of single hyphen to denote options. You may use + white space in place of the equals sign to separate an option name +-from its value. ++from its value.

    + +

    DESCRIPTION

    + +-

    This program is part of Netpbm. ++

    This program is part of Netpbm.

    + +

    pampaintspill produces a smooth color gradient from all of the + non-background-colored pixels in an input image, effectively "spilling +@@ -40,27 +40,27 @@ paint" onto the background. pampaint +

  • pampaintspill accepts any number of paint + sources (non-background-colored pixels), which can lie anywhere + on the canvas. pamgradient accepts exactly +- four paint sources, one in each corner of the image. ++ four paint sources, one in each corner of the image.
  • + +
  • pampaintspill requires an input image while + pamgradient generates a new image from +- scratch. ++ scratch.
  • + +
  • pampaintspill can produce tileable output and + can control how tightly the gradient colors bind to their source +- pixels. ++ pixels.
  • + + +

    Results are generally best when the input image contains just a few, crisp + spots of color. Use your drawing program's pencil tool — as opposed to a +-paintbrush or airbrush tool — with a small nib. ++paintbrush or airbrush tool — with a small nib.

    + +

    OPTIONS

    + +

    In addition to the options common to all programs based on libnetpbm + (most notably -quiet, see + Common Options), pampaintspill recognizes the following +-command line options: ++command line options:

    + +
    +
    --bgcolor=color
    +@@ -116,46 +116,46 @@ command line options: + 2.0) make the paint sources stand out in the output image by pushing the + gradients away from them. + +-
    -randomseed=integer ++
    -randomseed=integer
    +
    This is the seed for the random number generator that generates the +- pixels. ++ pixels.
    + +-

    Use this to ensure you get the same image on separate invocations. ++

    Use this to ensure you get the same image on separate invocations.

    + +-

    This option was new in Netpbm 10.94 (March 2021). ++

    This option was new in Netpbm 10.94 (March 2021).

    +
    + + +

    SEE ALSO

    + + + +

    HISTORY

    + +-

    pampaintspill was new in Netpbm 10.50 (March 2010). ++

    pampaintspill was new in Netpbm 10.50 (March 2010).

    + + + + +

    Copyright © 2010–2021 Scott Pakin, +-scott+pbm@pakin.org. ++scott+pbm@pakin.org.

    + +

    Table Of Contents

    + + + + +diff -urNp a/userguide/pamrecolor.html b/userguide/pamrecolor.html +--- a/userguide/pamrecolor.html 2022-01-03 16:56:37.731614243 +0100 ++++ b/userguide/pamrecolor.html 2022-01-03 16:58:29.894416041 +0100 +@@ -2,9 +2,9 @@ + Pamrecolor User Manual -diff -urNp old/userguide/pnmflip.html new/userguide/pnmflip.html ---- old/userguide/pnmflip.html 2017-09-05 13:58:08.336559557 +0200 -+++ new/userguide/pnmflip.html 2017-09-05 14:07:15.065963977 +0200 -@@ -4,9 +4,11 @@ - -

    pnmflip

    -
    -+

    NAME

    -

    pnmflip was replaced in Netpbm 10.13 (December 2002) by - pamflip. - -+

    DESCRIPTION

    -

    pamflip is mostly backward compatible with pnmflip, - but works on PAM images too. - -diff -urNp old/userguide/pnmmercator.html new/userguide/pnmmercator.html ---- old/userguide/pnmmercator.html 2017-09-05 13:58:08.334559565 +0200 -+++ new/userguide/pnmmercator.html 2017-09-05 14:08:08.305214742 +0200 -@@ -1,7 +1,6 @@ -- -+ - - -- - PnmMercator User Manual - - -diff -urNp old/userguide/ppmtogif.html new/userguide/ppmtogif.html ---- old/userguide/ppmtogif.html 2017-09-05 13:58:08.337559553 +0200 -+++ new/userguide/ppmtogif.html 2017-09-05 14:09:51.450583126 +0200 -@@ -4,11 +4,14 @@ - -

    ppmtogif

    -
    -+

    NAME

    +

    pamrecolor

    +-Updated: 31 July 2010 ++

    Updated: 31 July 2010 +
    +-Table Of Contents ++Table Of Contents

    + +

    NAME

    + pamrecolor - alter colors without affecting luminance +@@ -22,15 +22,15 @@ pamrecolor - alter colors without affect + [-randomseed=integer] + + [infile] +- ++

    + +

    Minimum unique abbreviation of option is acceptable. You may use double + hyphens instead of single hyphen to denote options. You may use white +-space in place of the equals sign to separate an option name from its value. ++space in place of the equals sign to separate an option name from its value.

    + +

    DESCRIPTION

    + +-

    This program is part of Netpbm. ++

    This program is part of Netpbm.

    + +

    pamrecolor changes an image's colors to be as close as + possible to given target colors but with the constraint that the +@@ -39,17 +39,17 @@ image will look identical if both are co + (e.g. with + ppmtopgm). You can have pamrecolor select + target colors randomly, specify a single hue for the entire image, or take the +-target colors from a target image. ++target colors from a target image.

    + +

    In addition to real Netpbm images, pamrecolor works on pseudo-Netpbm + images based on arbitrary color spaces. You can define the color space +-explicitly or choose one of many that pamrecolor knows by name. ++explicitly or choose one of many that pamrecolor knows by name.

    + +

    The output is a PAM image on standard output. Options control the + exact format of the PAM. If you want a PNM (PBM, PGM, or PPM) image, + use pamtopnm on the output. There is no + need to convert if you will use the image as input to a current Netpbm +-program, but many other programs don't know what a PAM is. ++program, but many other programs don't know what a PAM is.

    + + +

    OPTIONS

    +@@ -57,7 +57,7 @@ program, but many other programs don't k +

    In addition to the options common to all programs based on libnetpbm + (most notably -quiet, see + Common Options), pamrecolor recognizes the following +-command line options: ++command line options:

    + +
    + +@@ -76,9 +76,9 @@ the raster have different meaning. Many + images actually use a variation with a different color space. For example, + GIMP uses sRGB internally and if you + have GIMP generate a Netpbm image file, it really generates a variation of +-the format that uses sRGB. ++the format that uses sRGB.

    + +-

    pamrecolor knows the following color spaces (name values): ++

    pamrecolor knows the following color spaces (name values):

    + +
    +
    adobe
    +@@ -109,7 +109,7 @@ the format that uses sRGB. +

    The default is "ntsc" because this is the color space that the Netpbm + formats and many graphics utilities use. As a counterexample, + GIMP uses sRGB as its native color +-space. ++space.

    + +

    The luminance values pamrecolor uses for each of the above come from + Bruce Lindbloom's +diff -urNp a/userguide/pbmtog3.html b/userguide/pbmtog3.html +--- a/userguide/pbmtog3.html 2022-01-03 16:56:37.732614250 +0100 ++++ b/userguide/pbmtog3.html 2022-01-03 16:58:29.894416041 +0100 +@@ -36,7 +36,7 @@ use those encodings. +

    In addition to the options common to all programs based on libnetpbm + (most notably -quiet, see + Common Options), pbmtog3 recognizes the following +-command line options: ++command line options:

    + +
    +
    -reversebits +@@ -80,7 +80,7 @@ You cannot specify both. +

    HISTORY

    + +

    Before Netpbm 10.79 (June 2017), there was a different program by the same +-name in Netpbm, which was written by by Paul Haeberli ++name in Netpbm, which was written by Paul Haeberli + <paul@manray.sgi.com> in 1989 + and then modified extensively by others. + +diff -urNp a/userguide/ppmtogif.html b/userguide/ppmtogif.html +--- a/userguide/ppmtogif.html 2022-01-03 16:56:37.733614257 +0100 ++++ b/userguide/ppmtogif.html 2022-01-03 16:58:29.895416049 +0100 +@@ -5,17 +5,17 @@ + +

    NAME

    + +-ppmtogif - replaced by pamtogif +- +-

    DESCRIPTION

    ++

    ppmtogif - replaced by pamtogif

    + +

    This program is part of Netpbm. + ++

    SYNOPSIS

    ppmtogif was replaced in Netpbm 10.37 (December 2006) by pamtogif. -+

    SYNOPSIS

    -

    pamtogif is mostly backward compatible with ppmtogif. +

    pamtogif is mostly backward compatible with ppmtogif. -+

    DESCRIPTION

    -

    One way pamtogif is not backward compatible with ppmtogif ++

    DESCRIPTION

    +

    One way pamtogif is not backward compatible with ppmtogif is that to specify a transparency (alpha) mask with ppmtogif, you supply the transparency as a separate pseudo-PGM image and use the diff --git a/netpbm-manual-pages.patch b/netpbm-manual-pages.patch deleted file mode 100644 index b5fbbeae6db49e13decdb1f07c53a3b750b8c11a..0000000000000000000000000000000000000000 --- a/netpbm-manual-pages.patch +++ /dev/null @@ -1,1343 +0,0 @@ -diff -urNp old/userguide/libnetpbm_ug.html new/userguide/libnetpbm_ug.html ---- old/userguide/libnetpbm_ug.html 2017-09-05 14:20:09.734743404 +0200 -+++ new/userguide/libnetpbm_ug.html 2017-09-05 14:47:30.496705483 +0200 -@@ -374,7 +374,7 @@ plain format. -

    Reference

    - -

    The Libnetpbm Netpbm Image --Processing Manual describes the the libnetpbm functions for -+Processing Manual describes the libnetpbm functions for - processing image data. - -

    The Libnetpbm Utility Manual -diff -urNp old/userguide/pamfunc.html new/userguide/pamfunc.html ---- old/userguide/pamfunc.html 2017-09-05 14:20:09.738743398 +0200 -+++ new/userguide/pamfunc.html 2017-09-05 14:47:41.760644848 +0200 -@@ -57,7 +57,7 @@ output image. - and bit string (such as and with 01001000). For the arithmetic functions, the - function arguments and results are the fraction that a sample is of the - maxval, i.e. normal interpretation of PAM tuples. But for the bit string --functions, the value is the the bit string whose value as a binary cipher is -+functions, the value is the bit string whose value as a binary cipher is - the sample value, and the maxval indicates the width of the bit string. - -

    Arithmetic functions

    -diff -urNp old/userguide/pbmtextps.html new/userguide/pbmtextps.html ---- old/userguide/pbmtextps.html 2017-09-05 14:20:09.736743401 +0200 -+++ new/userguide/pbmtextps.html 2017-09-05 14:47:58.840553598 +0200 -@@ -185,7 +185,7 @@ edge of the type. See Margins for details. - -

    Sizes are in points, as a floating point number. -diff -urNp old/userguide/pbmtog3.html new/userguide/pbmtog3.html ---- old/userguide/pbmtog3.html 2017-09-05 14:20:09.735743403 +0200 -+++ new/userguide/pbmtog3.html 2017-09-05 14:48:55.648255793 +0200 -@@ -77,7 +77,7 @@ You cannot specify both. -

    HISTORY

    - -

    Before Netpbm 10.79 (June 2017), there was a different program by the same --name in Netpbm, which was written by by Paul Haeberli -+name in Netpbm, which was written by Paul Haeberli - <paul@manray.sgi.com> in 1989 - and then modified extensively by others. - -diff -urNp old/userguide/ppmtompeg.html new/userguide/ppmtompeg.html ---- old/userguide/ppmtompeg.html 2017-09-05 14:20:09.739743396 +0200 -+++ new/userguide/ppmtompeg.html 1970-01-01 01:00:00.000000000 +0100 -@@ -1,1291 +0,0 @@ -- -- -- --Ppmtompeg User Manual -- -- --

    Ppmtompeg

    --Updated: 23 July 2006 --
    --Table Of Contents -- --

    NAME

    --ppmtompeg - encode an MPEG-1 bitstream -- --

    SYNOPSIS

    -- --ppmtompeg --[options] --parameter-file -- --

    DESCRIPTION

    -- --

    This program is part of Netpbm. -- --

    ppmtompeg produces an MPEG-1 video stream. MPEG-1 is the --first great video compression method, and is what is used in Video CDs --(VCD). ppmtompeg originated in the year 1995. DVD uses a more --advanced method, MPEG-2. There is an even newer method called MPEG-4 --which is also called Divx. I don't know where one finds that used. -- --

    There's technically a difference between a compression method for --video and an actual file (stream) format for a movie, and I don't know --if it can be validly said that the format of the stream --ppmtompeg produces is MPEG-1. -- --

    Mencoder from the Mplayer --package is probably superior for most video format generation --needs, if for no other reason than that it is more popular. -- --

    The programming library PM2V --generates MPEG-2 streams. -- --

    Use Mplayer (not part of Netpbm) --to do the reverse conversion: to create a series of PNM files from an MPEG --stream. -- --

    param_file is a parameter file which includes a list of --input files and other parameters. The file is described in detail --below. -- --

    To understand this program, you need to understand something about --the complex MPEG-1 format. One source of information about this --standard format is the section Introduction to MPEG in the Compression FAQ. -- --

    OPTIONS

    -- --

    The -gop, -combine_gops, -frames, and ---combine_frames options are all mutually exclusive. -- --

    --
    -stat stat_file -- --
    This option causes ppmtompeg to append the statistics that --it write to Standard Output to the file stat_file as well. The --statistics use the following abbreviations: bits per block (bpb), bits --per frame (bpf), seconds per frame (spf), and bits per second (bps). -- --

    These statistics include how many I, P, and B frames there were, --and information about compression and quality. -- -- --

    -quiet num_seconds -- --
    causes ppmtompeg not to report remaining time more often --than every num_seconds seconds (unless the time estimate rises, --which will happen near the beginning of the run). A negative value --tells ppmtompeg not to report at all. 0 is the default --(reports once after each frame). Note that the time remaining is an --estimate and does not take into account time to read in frames. -- --
    -realquiet
    causes ppmtompeg to run silently, --with the only screen output being errors. Particularly useful when --reading input from stdin. -- --
    ---no_frame_summary -- --
    This option prevents ppmtompeg from printing a summary --line for each frame -- --
    -float_dct -- --
    forces ppmtompeg to use a more accurate, yet more --computationally expensive version of the DCT. -- --
    -gop gop_num --
    --causes ppmtompeg to encode only the numbered GOP (first GOP is 0). The --parameter file is the same as for normal usage. The output file will be --the normal output file with the suffix .gop.gop_num. --ppmtompeg does not output any sequence information. -- --
    -combine_gops -- --
    causes ppmtompeg simply to combine some GOP files into a --single MPEG output stream. ppmtompeg inserts a sequence header --and trailer. In this case, the parameter file needs only to contain --the SIZE value, an output file, and perhaps a list of input GOP --files (see below). -- --If you don't supply a list of input GOP files is used, then --ppmtompeg assumes you're using the same parameter file you used --when you created the input (with the -gop option) and --calculates the corresponding gop filenames itself. If this is not the --case, you can specify input GOP files in the same manner as normal --input files -- except instead of using INPUT_DIR, INPUT, and --END_INPUT, use GOP_INPUT_DIR, GOP_INPUT, and GOP_END_INPUT. If no --input GOP files are specified, then the default is to use the output --file name with suffix .gop.gop_num, with gop_num --starting from 0, as the input files. -- --

    Thus, unless you're mixing and matching GOP files from different --sources, you can simply use the same parameter file for creating the --GOP files (-gop) and for later turning them into an MPEG stream --(-combine_gops). -- -- --

    -frames first_frame last_frame -- --
    This option causes ppmtompeg to encode only the frames numbered --first_frame to last_frame, inclusive. The parameter --file is the same as for normal usage. The output will be placed in --separate files, one per frame, with the file names being the normal --output file name with the suffix .frame.frame_num. No --GOP header information is output. (Thus, the parameter file need not --include the GOP_SIZE value) -- --

    Use ppmtompeg -combine_frames to combine these frames later into --an MPEG stream. -- -- --

    -combine_frames -- --
    This option causes ppmtompeg simply to combine some --individual MPEG frames (such as you might have created with an earlier --run of ppmtompeg -frames) into a single MPEG stream. Sequence --and GOP headers are inserted appropriately. In this case, the --parameter file needs to contain only the SIZE value, the GOP_SIZE --value, an output file, and perhaps a list of frame files (see below). -- --

    The parameter file may specify input frame files in the same manner --as normal input files -- except instead of using INPUT_DIR, INPUT, and --END_INPUT, use FRAME_INPUT_DIR, FRAME_INPUT, and FRAME_END_INPUT. If --no input frame files are specified, then the default is to use the --output file name with suffix .frame.frame_num, with --frame_num starting from 0, as the input files. -- -- -- --

    -nice -- --
    This option causes ppmtompeg to run any remote processes --"nicely," i.e. at low priority. (This is relevant only if you are --running ppmtompeg in parallel mode. Otherwise, there are no --remote processes). See 'man nice.' -- --
    -max_machines num_machines -- --
    This option causes ppmtompeg to use no more than --num_machines machines as slaves for use in parallel encoding. -- --
    -snr -- --
    This option causes ppmtompeg to include the signal-to-noise --ratio in the reported statistics. Prints SNR (Y U V) and peak SNR (Y --U V) for each frame. In summary, prints averages of luminance only --(Y). SNR is defined as 10*log(variance of original/variance of --error). Peak SNR is defined as 20*log(255/RMSE). Note that --ppmtompeg runs a little slower when you use this option. -- --
    -mse -- --
    This option causes ppmtompeg to report the mean squared --error per block. It also automatically reports the quality of the --images, so there is no need to specify -snr then. -- --
    -bit_rate_info rate_file -- --
    This option makes ppmtompeg write bit rate information --into the file rate_file. Bit rate information is bits per frame, and --also bits per I-frame-to-I-frame. -- --
    -mv_histogram -- --
    This option causes ppmtompeg to print a histogram of the --motion vectors as part of statistics. There are three histograms -- --one for P frame, one for forward B frame, and one for backward B frame --motion vectors. -- --

    The output is in the form of a matrix, each entry corresponding to one --motion vector in the search window. The center of the matrix --represents (0,0) motion vectors. -- --

    -debug_sockets -- --
    This option causes ppmtompeg to print to Standard Output --messages that narrate the communication between the machines when you run --ppmtompeg in parallel mode. -- --
    -debug_machines -- --
    This option causes ppmtompeg to print to Standard Output --messages that narrate the progress of the conversion on the various --machines when you run ppmtompeg in parallel --mode. -- --
    -- --

    PARAMETER FILE

    -- --

    The parameter file must contain the following --lines (except when using the -combine_gops or -combine_frames --options): -- --

    -- --
    PATTERN pattern -- --
    This statement specifies the pattern (sequence) of I frames, P frames, --and B frames. pattern is just a sequence of the letters I, P, and --B with nothing between. Example: -- --
    --    PATTERN IBBPBBPBBPBBPBB
    --
    -- --

    See I Frames, P Frames, B Frames. -- --

    OUTPUT output file --
    This names the file where the output MPEG stream goes. -- --
    INPUT_DIR directory -- --
    This statement tells where the input images (frames) come from. --If each frame is in a separate file, directory is the directory --where they all are. You may use . to refer to the current --directory. A null directory refers to the root directory of the --system file tree. -- --

    To have ppmtompeg read all the frames serially from Standard --Input, specify --

    --    INPUT_DIR stdin
    --
    -- --
    INPUT --
    --This line must be followed by a list of the input files (in display order) --and then the line END_INPUT. -- --

    There are three types of lines between INPUT and END_INPUT. First, --a line may simply be the name of an input file. Second, the line --may be of the form single_star_expr --[x-y]. --single_star_expr can have a single * in it. It is --replaced by all the numbers between x and y inclusive. So, for --example, the line tennis*.ppm [12-15] refers to the files --tennis12.ppm, tennis13.ppm, tennis14.ppm, tennis15.ppm. -- --

    Uniform zero-padding occurs, as well. For example, the line --football.*.ppm [001-130] refers to the files football.001.ppm, --football.002.ppm, ..., football.009.ppm, football.010.ppm, ..., --football.130.ppm. -- --

    The third type of line is: single_star_expr --[x-y+s], where the --line is treated exactly as above, except that we skip by s. Thus, the --line football.*.ppm [001-130+4] refers to the files --football.001.ppm, football.005.ppm, football.009.ppm, --football.013.ppm, etc. -- --

    Furthermore, a line may specify a shell command to execute to --generate lines to be interpreted as described above, as if those lines --were in the parameter file instead. Use back ticks, like in the --Bourne Shell, like this: -- --

    --    `cat myfilelist`
    --
    -- --

    --If input is from Standard Input (per the INPUT_DIR statement), --ppmtompeg ignores the INPUT/END_INPUT block, but --it still must be present. -- --

    BASE_FILE_FORMAT {PPM | PNM | YUV | -- JPEG | JMOVIE} -- --
    ppmtompeg must convert all input files to one of the --following formats as a first step of processing: PNM, YUV, JPEG(v4), --or JMOVIE. (The conversion may be trivial if your input files are --already in one of these formats). This line specifies which of the --four formats. PPM is actually a subset of PNM. The separate --specification is allowed for backward compatibility. Use PNM instead --of PPM in new applications. -- --
    INPUT_CONVERT conversion_command -- --
    You must specify how to convert a file to the base file format. --If no conversion is necessary, then you would just say: -- --
    --     INPUT_CONVERT *
    --     
    -- --

    Otherwise, conversion_command is a shell command that causes --an image in the format your specified with BASE_FILE_FORMAT to --be written to Standard Output. ppmtompeg executes the command --once for each line between INPUT and END_INPUT (which is --normally, but not necessarily, a file name). In the conversion --command, ppmtompeg replaces each '*' with the contents of that --line. -- -- If you had a bunch of gif files, you might say: --

    --     INPUT_CONVERT giftopnm *
    --     
    -- -- If you have a bunch of separate a.Y, a.U, and a.V files (where -- the U and V have already been subsampled), then you might say: -- --
    --     INPUT_CONVERT cat *.Y *.U *.V
    --     
    -- --

    Input conversion is not allowed with input from stdin, so use -- --

    --     INPUT_CONVERT *
    --     
    -- --as described above. -- --
    SIZE widthxheight -- --
    -- --

    width and height are the width and height of each --frame in pixels. -- --

    When ppmtompeg can get this information from the input image --files, it ignores the SIZE parameter and you may omit it. -- --

    When the image files are in YUV format, the files don't contain --dimension information, so SIZE is required. -- --

    When ppmtompeg is running in parallel mode, not all of the --processes in the network have access to the image files, so --SIZE is required and must give the same dimensions as the --input image files. -- --

    YUV_SIZE widthxheight -- --
    This is an obsolete synonym of SIZE. -- --
    YUV_FORMAT {ABEKAS | PHILLIPS | UCB | -- EYUV | pattern} -- --
    This is meaningful only when BASE_FILE_FORMAT specifies --YUV format, and then it is required. It specifies the sub-format of --the YUV class. -- -- --
    GOP_SIZE n -- --
    n is the number of frames in a Group of Pictures. Except that --because a GOP must start with an I frame, ppmtompeg makes a GOP as --much longer than n as it has to to make the next GOP start with an --I frame. -- --

    Normally, it makes sense to make your GOP size a multiple of your --pattern length (the latter is determined by the PATTERN parameter file --statement). -- --

    See Group Of Pictures. -- --

    SLICES_PER_FRAME n --
    n is roughly the number of slices per frame. Note, at --least one MPEG player may complain if slices do not start at the left --side of an image. To ensure this does not happen, make sure the --number of rows is divisible by SLICES_PER_FRAME. -- --
    PIXEL {FULL | HALF} -- --
    use half-pixel motion vectors, or just full-pixel ones It is --usually important that you use half-pixel motion vectors, because it --results in both better quality and better compression. -- -- --
    RANGE n --
    Use a search range of n pixels in each of the four directions --from a subject pixel. (So the search window is a square n*2 pixels --on a side). -- --
    PSEARCH_ALG {EXHAUSTIVE | TWOLEVEL | -- SUBSAMPLE | LOGARITHMIC} -- --
    This statement tells ppmtompeg what kind of search -- technique (algorithm) to use for P frames. You select the desired -- combination of speed and compression. EXHAUSTIVE gives the -- best compression, but LOGARITHMIC is the fastest. -- TWOLEVEL is an exhaustive full-pixel search, followed by a -- local half- pixel search around the best full-pixel vector (the -- PIXEL option is ignored for this search technique). -- --
    BSEARCH_ALG {SIMPLE | CROSS2 | EXHAUSTIVE} -- --
    This statement tells ppmtompeg what kind of search -- technique (algorithm) to use for B frames. SIMPLE means -- find best forward and backward vectors, then interpolate. -- CROSS2 means find those two vectors, then see what backward -- vector best matches the best forward vector, and vice versa. -- EXHAUSTIVE does an n-squared search and is -- extremely slow in relation to the others (CROSS2 -- is about half as fast as SIMPLE). -- --
    IQSCALE n --
    Use n as the qscale for I frames. -- See Qscale. -- --
    PQSCALE n --
    Use n as the qscale for P frames. -- See Qscale. -- --
    BQSCALE n --
    Use n as the qscale for B frames. -- See Qscale. -- --
    REFERENCE_FRAME {ORIGINAL | DECODED}
    This --statement determines whether ppmtompeg uses the original images --or the decoded images when computing motion vectors. Using decoded --images is more accurate and should increase the playback quality of --the output, but it makes the encoding take longer and seems to give --worse compression. It also causes some complications with parallel --encoding. (see the section on parallel encoding). One thing you can --do as a trade-off is select ORIGINAL here, and lower the --qscale (see QSCALE if the quality is not good enough. -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
    Original or Decoded? (Normalized)
    ReferenceCompressionSpeedQuality IQuality PQuality B
    Decoded100010001000969919
    Original88513731000912884
    -- -- -- --
    -- --

    The following lines are optional: -- --

    -- --
    FORCE_ENCODE_LAST_FRAME -- --
    This statement is obsolete. It does nothing. -- --

    Before Netpbm 10.26 (January 2005), ppmtompeg would drop --trailing B frames from your movie, since a movie can't end with a B --frame. (See I Frames, P Frames, B Frames. --You would have to specify FORCE_ENCODE_LAST_FRAME to stop --that from happening and get the same function that ppmtompeg --has today. -- -- --

    NIQTABLE -- --
    This statement specifies a custom non-intra quantization table. --If you don't specify this statement, ppmtompeg uses a default --non-intra quantization table. -- --

    --The 8 lines immediately following NIQTABLE specify the quantization --table. Each line defines a table row and consists of 8 integers, --whitespace-delimited, which define the table columns. -- --

    IQTABLE -- --
    This is analogous to NIQTABLE, but for the intra quantization table. -- --
    ASPECT_RATIO ratio -- --
    This statement specifies the aspect ratio for ppmtompeg to --specify in the MPEG output. I'm not sure what this is used for. -- --

    ratio must be 1.0, 0.6735, 0.7031, 0.7615, 0.8055, 0.8437, --0.8935, 0.9157, 0.9815, 1.0255, 1.0695, 1.0950, 1.1575, or 1.2015. -- --

    FRAME_RATE rate --
    This specifies the frame rate for ppmtompeg to specify in the --MPEG output. Some players use this value to determine the playback rate. -- --

    rate must be 23.976, 24, 25, 29.97, 30, 50, 59.94, or 60. -- --

    BIT_RATE rate --
    This specifies the bit rate for Constant Bit Rate (CBR) encoding. -- --

    rate must be an integer. -- --

    BUFFER_SIZE size -- --
    This specifies the value --ppmtompeg is to specify in the MPEG output for the Video --Buffering Verifier (VBV) buffer size needed to decode the sequence. -- --

    A Video Verifying Buffer is a buffer in which a decoder keeps the --decoded bits in order to match the uneven speed of the decoding with --the required constant playback speed. -- --

    As ppmtompeg encodes the image, it simulates the decoding --process in terms of how many bits would be in the VBV as each frame gets --decoded, assuming a VBV of the size you indicate. -- --

    If you specify the WARN_VBV_UNDERFLOW statement, --ppmtompeg issues a warning each time the simulation underflows --the buffer, which suggests that an underflow would occur on playback, --which suggests the buffer is too small. -- --

    If you specify the WARN_VBV_OVERFLOW statement, --ppmtompeg issues a warning each time the simulation overflows --the buffer, which suggests that an overflow would occur on playback, --which suggests the buffer is too small. -- --

    WARN_VBV_UNDERFLOW --
    WARN_VBV_OVERFLOW -- --
    See BUFFER_SIZE. -- --

    These options were new in Netpbm 10.26 (January 2005). Before that, --ppmtompeg issued the warnings always. -- --

    -- -- --The following statements apply only to parallel operation: -- --
    -- --
    PARALLEL -- --
    This statement, paired with END PARALLEL, is what causes --ppmtompeg to operate in parallel mode. See Parallel Operation. -- --
    END PARALLEL -- --
    This goes with PARALLEL. -- --
    PARALLEL_TEST_FRAMES n -- --
    The master starts off by measuring each slave's speed. It does --this by giving each slave n frames to encode and noting how --long the slave takes to finish. These are not just test frames, --though -- they're real frames and the results become part of the --output. --ppmtompeg is old and measures time in undivided seconds, so --to get useful timings, specify enough frames that it will take at --least 5 seconds to process them. The default is 10. -- --

    If you specify FORCE_I_ALIGN, ppmtompeg will increase --the test frames value enough to maintain the alignment. -- --

    If there aren't enough frames for every slave to have the indicated --number of test frames, ppmtompeg will give some slaves fewer. -- -- --

    PARALLEL_TIME_CHUNKS t -- --
    When you specify this statement, the master attempts to feed work --to the slaves in chunks that take t seconds to process. It uses --the speed measurement it made when it started up (see PARALLEL_TEST_FRAMES) --to decide how many frames to put in the chunk. This statement obviously --doesn't affect the first batch of work sent to each slave, which is the --one used to measure the slave's speed. -- --

    Smaller values of t increase communication, but improve load --balancing. The default is 30 seconds. -- --

    You may specify only one of PARALLEL_TIME_CHUNKS, PARALLEL_CHUNK_TAPER, --and PARALLEL_PERFECT. PARALLEL_CHUNK_TAPER is usually best. -- --

    PARALLEL_CHUNK_TAPER -- --
    When you specify this statement, the master distributes work like --with PARALLEL_TIME_CHUNKS, except that the master chooses the number --of seconds for the chunks. It starts with a large number and, as it --gets closer to finishing the job, reduces it. That way, it reduces --scheduling overhead when precise scheduling isn't helpful, but still --prevents a slave from finishing early after all the work has already --been handed out to the other slaves, and then sitting idle while --there's still work to do. -- --

    You may specify only one of PARALLEL_TIME_CHUNKS, PARALLEL_CHUNK_TAPER, --and PARALLEL_PERFECT. PARALLEL_CHUNK_TAPER is usually best. -- -- --

    PARALLEL_PERFECT -- --
    If this statement is present, ppmtompeg schedules on the --assumption that each machine is about the same speed. The master will --simply divide up the frames evenly between the slaves -- each --slave gets the same number of frames. If some slaves are faster than --others, they will finish first and remain idle while the slower slaves --continue. -- --

    This has the advantage of minimal scheduling overhead. Where slaves --have different speeds, though, it makes inefficient use of the fast --ones. Where slaves are the same speed, it also has the disadvantage --that they all finish at the same time and feed their output to the --single Combine Server in a burst, which makes less efficient use of --the Combine Server and thus can increase the total elapsed time. -- --

    You may specify only one of PARALLEL_TIME_CHUNKS, PARALLEL_CHUNK_TAPER, --and PARALLEL_PERFECT. PARALLEL_CHUNK_TAPER is usually best. -- --

    RSH remote_shell_command -- --
    ppmtompeg executes the shell command --remote_shell_command to start a process on another machine. --The default command is rsh, and whatever command you specify --must have compatible semantics. ssh is usually compatible. --The command ppmtompeg uses is one like this: --ssh remote.host.com -l username shellcommand. -- --

    Be sure to set up .rhosts files or SSH key authorizations --where needed. Otherwise, you'll have to type in passwords. -- --

    On some HP machines, rsh is the restricted shell, and you want --to specify remsh. -- --

    FORCE_I_ALIGN -- --
    This statement forces each slave to encode a chunk of frames which --is a multiple of the pattern length (see PATTERN). Since the --first frame in any pattern is an I frame, this forces each chunk --encoded by a slave to begin with an I frame. -- --

    This document used to say there was an argument to --FORCE_I_ALIGN which was the number of frames ppmtompeg --would use (and was required to be a multiple of the pattern length). --But ppmtompeg has apparently always ignored that argument, and --it does now. -- --

    KEEP_TEMP_FILES -- --
    This statement causes ppmtompeg not to delete the temporary --files it uses to transmit encoded frames to the combine server. This --means you will be left with a file for each frame, the same as you --would get with the -frames option. -- --

    This is mostly useful for debugging. -- --

    This works only if you're using a shared filesystem to communicate --between the servers. -- --

    This option was new in Netpbm 10.26 (January 2005). -- --

    -- -- --

    Parameter File Notes

    -- --

    If you use the -combine_gops option, then you need to specify --only the SIZE and OUTPUT values in the parameter file. In --addition, the parameter file may specify input GOP files in the same --manner as normal input files -- except instead of using INPUT_DIR, --INPUT, and END_INPUT, use GOP_INPUT_DIR, GOP_INPUT, and GOP_END_INPUT. --If you specify no input GOP files, then ppmtompeg uses by default the --output file name with suffix .gop.gop_num, with gop_num --starting from 0, as the input files. -- --

    If you use the -combine_frames option, then you need to --specify only the SIZE, GOP_SIZE, and OUTPUT values in the --parameter file. In addition, the parameter file may specify input --frame files in the same manner as normal input files -- except instead --of using INPUT_DIR, INPUT, and END_INPUT, use FRAME_INPUT_DIR, --FRAME_INPUT, and FRAME_END_INPUT. If no input frame files are --specified, then the default is to use the output file name with suffix --.frame.frame_num, with frame_num starting from 0, --as the input files. -- --

    Any number of spaces and tabs may come between each option and value. Lines --beginning with # are ignored. Any other lines are ignored except for --those between INPUT and END_INPUT. This allows you to use the same --parameter file for normal usage and for -combine_gops and ---combine_frames. -- --

    The file format is case-sensitive so all keywords should be in --upper case. -- --

    The statements may appear in any order, except that the order within --a block statement (such as INPUT ... END INPUT) is significant. -- --

    ppmtompeg is prepared to handle up to 16 B frames between --reference frames when encoding with input from stdin. (To build a --modified ppmtompeg with a higher limit, change the constant --B_FRAME_RUN in frame.c and recompile). -- --

    GENERAL USAGE INFORMATION

    -- --

    Qscale

    -- --

    The quantization scale values (qscale) give a trade-off between --quality and compression. Using different Qscale values has very little --effect on speed. The qscale values can be set separately for I, P, and --B frames. -- --

    You select the qscale values with the IQSCALE, --PQSCALE, and BSCALE parameter file statements. -- --

    A qscale value is an integer from 1 to 31. Larger numbers give --better compression, but worse quality. In the following, the quality --numbers are peak signal-to-noise ratio, defined as: --signal-to-noise formula --where MSE is the mean squared error. -- -- --

    Flower garden tests: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
    Qscale vs Quality
    QscaleI FramesP FramesB Frames
    143.246.346.5
    632.634.634.3
    1128.629.530.0
    1626.326.828.6
    2124.725.027.9
    2623.523.927.5
    3122.623.027.3
    -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
    Qscale vs Compression
    QscaleI FramesP FramesB Frames
    1222
    671015
    11111843
    16152997
    211941173
    262456256
    312873330
    -- -- --

    Search Techniques

    -- --

    There are several different motion vector search techniques --available. There are different techniques available for P frame --search and B frame search. Using different search techniques present --little difference in quality, but a large difference in compression --and speed. -- --

    There are 4 types of P frame search: Exhaustive, TwoLevel, --SubSample, and Logarithmic. -- --

    There are 3 types of B frame search: Exhaustive, Cross2, and --Simple. -- --The recommended search techniques are TwoLevel and Logarithmic for --P frame search, and Cross2 and Simple for B frame search. Here are --some numbers comparing the different search methods: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
    P frame Motion Vector Search (Normalized)
    TechniqueCompression1Speed 2Quality 3
    Exhaustive100010001000
    SubSample100824561000
    TwoLevel100932371000
    Logarithmic10858229998
    -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
    B frame Motion Vector Search (Normalized)
    TechniqueCompression1Speed2Quality3
    Exhaustive100010001000
    Cross29751000996
    Simple9381765991
    -- -- 1Smaller numbers are better --compression. -- -- 2Larger numbers mean faster --execution. -- -- 3Larger numbers mean better quality. -- --

    For some reason, Simple seems to give better compression, but it --depends on the image sequence. -- --

    Select the search techniques with the PSEARCH_ALG and --BSEARCH_ALG parameter file statements. -- -- -- --

    Group Of Pictures (GOP)

    -- --

    A Group of Pictures (GOP) is a roughly independently decodable --sequence of frames. An MPEG video stream is made of one or more --GOP's. You may specify how many frames should be in each GOP with the --GOP_SIZE parameter file statement. A GOP always starts with an --I frame. -- --

    Instead of encoding an entire sequence, you can encode a single --GOP. To do this, use the -gop command option. You can later --join the resulting GOP files at any time by running ppmtompeg --with the -combine_gops command option. -- -- --

    Slices

    -- --

    A slice is an independently decodable unit in a frame. It can be --as small as one macroblock, or it can be as big as the entire frame. --Barring transmission error, adding slices does not change quality or --speed; the only effect is slightly worse compression. More slices are --used for noisy transmission so that errors are more recoverable. Since --usually errors are not such a problem, we usually just use one slice --per frame. -- --

    Control the slice size with the SLICES_PER_FRAME parameter --file statement. -- --

    Some MPEG playback systems require that each slice consist of whole --rows of macroblocks. If you are encoding for this kind of player, if --the height of the image is H pixels, then you should set the --SLICES_PER_FRAME to some number which divides H/16. For example, if --the image is 240 pixels (15 macroblocks) high, then you should use --only 15, 5, 3, or 1 slices per frame. -- --

    Note: these MPEG playback systems are really wrong, since the MPEG --standard says this doesn't have to be so. -- -- -- --

    Search Window

    -- --

    The search window is the window in which ppmtompeg searches --for motion vectors. The window is a square. You can specify the size --of the square, and whether to allow half-pixel motion vectors or not, --with the RANGE and PIXEL parameter file statements. -- --

    I Frames, P Frames, B Frames

    -- --

    In MPEG-1, a movie is represented as a sequence of MPEG frames, --each of which is an I Frame, a P Frame, or a B Frame. Each represents --an actual frame of the movie (don't get confused by the dual use of --the word "frame." A movie frame is a graphical image. An MPEG frame --is a set of data that describes a movie frame). -- --

    An I frame ("intra" frame) describes a movie frame in isolation -- --without respect to any other frame in the movie. A P frame --("predictive" frame) describes a movie frame by describing how it --differs from the movie frame described by the latest preceding I or --P frame. A B frame ("bidirectional" frame) describes a movie frame by --describing how it differs from the movie frames described by the --nearest I or P frame before and after it. -- --

    Note that the first frame of a movie must be described by an I --frame (because there is no previous movie frame) and the last movie --frame must be described by an I or P frame (because there is no --subsequent movie frame). -- --

    Beyond that, you can choose which frames are represented by which --types. You specify a pattern, such as IBPBP and ppmtompeg --simply repeats it over and over throughout the movie. The pattern --affects speed, quality, and stream size. Here is a chart which shows --some of the trade-offs: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
    Comparison of I/P/B Frames (Normalized)
    Frame TypeSizeSpeedQuality
    I frames100010001000
    P frames409609969
    B frames72260919
    -- --(this is with constant qscale) -- --

    A standard sequence is IBBPBBPBBPBBPBB. -- --

    Select the sequence with the PATTERN parameter file statement. -- --

    Since the last MPEG frame cannot be a B frame (see above), if the --pattern you specify indicates a B frame for the last movie frame of --the movie, ppmtompeg makes it an I frame instead. -- --

    Before Netpbm 10.26 (January 2005), ppmtompeg instead drops --the trailing B frames by default, and you need the --FORCE_ENCODE_LAST_FRAME parameter file statement to make it do --this. -- --

    The MPEG frames don't appear in the MPEG-1 stream in the same order that --the corresponding movie frames appear in the movie -- the B frames come after --the I and P frames on which they are based. For example, if the movie is --4 frames that you will represent with the pattern IBBP, the MPEG-1 stream --will start with an I frame describing movie frame 0. The next frame in --the MPEG-1 stream is a P frame describing movie frame 3. The last two --frames in the MPEG-1 stream are B frames describing movie frames 1 and 2, --respectively. -- -- --

    Specifying Input and Output Files

    -- --

    Specify the input frame images with the INPUT_DIR, --INPUT, END_INPUT, BASE_FILE_FORMAT, --SIZE, YUV_FORMAT and INPUT_CONVERT parameter --file statements. -- --

    Specify the output file with the OUTPUT parameter file statement. -- -- --

    Statistics

    -- --

    ppmtompeg can generate a variety of statistics about the --encoding. See the -stat, -snr, -mv_histogram, ---quiet, -no_frame_summary, and -bit_rate_info --options. -- -- --

    PARALLEL OPERATION

    -- --

    You can run ppmtompeg on multiple machines at once, encoding --the same MPEG stream. When you do, the machines are used as shown in --the following diagram. We call this "parallel mode." -- --

    ppmtompeg-par.gif -- --

    To do parallel processing, put the statement -- --

    --    PARALLEL
    --
    -- --in the parameter file, followed by a listing of the machines, one --machine per line, then -- --
    --    END_PARALLEL
    --
    -- --Each of the machine lines must be in one of two forms. If the machine --has filesystem access to the input files, then the line is: -- --

    --machine user executable -- --

    The executable is normally ppmtompeg (you may need to give --the complete path if you've built for different architectures). If --the machine does not have filesystem access to the input files, the line --is: -- --

    REMOTE machine user executable --parameter file -- --

    The -max_machines command option limits the number of --machines ppmtompeg will use. If you specify more machines in --the parameter file than -max_machines allows, ppmtompeg --uses only the machines listed first. This is handy if you want to --experiment with different amounts of parallelism. -- --

    In general, you should use full path file names when describing --executables and parameter files. This includes the parameter --file argument on the original invocation of ppmtompeg. -- --

    All file names must be the same on all systems (so if e.g. you're --using an NFS filesystem, you must make sure it is mounted at the same --mountpoint on all systems). -- --

    Because not all of the processes involved in parallel operation --have easy access to the input files, you must specify the SIZE --parameter file statement when you do parallel operation. -- --

    The machine on which you originally invoke ppmtompeg is the --master machine. It hosts a "combine server,", a --"decode server," and a number of "i/o servers," --all as separate processes. The other machines in the network (listed --in the parameter file) are slave machines. Each hosts a single --process that continuously requests work from the master and does it. --The slave process does the computation to encode MPEG frames. It --processes frames in batches identified by the master. -- --

    The master uses a remote shell command to start a process on a --slave machine. By default, it uses an rsh shell command to do --this. But use the RSH parameter file statement to control --this. The shell command the master executes remotely is --ppmtompeg, but with options to indicate that it is to perform --slave functions. -- --

    The various machines talk to each other over TCP connections. Each --machine finds and binds to a free TCP port number and tells its --partners the port number. These port numbers are at least 2048. -- --

    Use the PARALLEL_TEST_FRAMES, PARALLEL_TIME_CHUNKS, and --PARALLEL_PERFECT parameter file statements to control the way the --master divides up work among the slaves. -- --

    Use the -nice command option to cause all slave processes to run --"nicely," i.e. as low priority processes. That way, this substantial and --long-running CPU load will have minimal impact on other, possibly --interactive, users of the systems. -- --  --

    SPEED

    -- --

    Here is a look at ppmtompeg speed, in single-node (not parallel) --operation: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
    Compression Speed
    Machine TypeMacroblocks per second1
    HP 9000/755280
    DEC 3000/400247
    HP 9000/750191
    Sparc 10104
    DEC 500068
    --1A macroblock is a 16x16 pixel square -- --

    The measurements in the table are with inputs and outputs via a --conventional locally attached filesystem. If you are using a network --filesystem over a single 10 MB/s Ethernet, that constrains your speed more --than your CPU speed. In that case, don't expect to get better than 4 --or 5 frames per second no matter how fast your CPUs are. -- --

    Network speed is even more of a bottleneck when the slaves do not --have filesystem access to the input files -- i.e. you declare them --REMOTE. -- --

    Where I/O is the bottleneck, size of the input frames can make a big --difference. So YUV input is better than PPM, and JPEG is better than --both. -- --

    When you're first trying to get parallel mode working, be sure to --use the -debug_machines option so you can see what's going on. --Also, -debug_sockets can help you diagnose communication --problems. -- -- --

    AUTHORS

    -- -- -- --
    --  --

    Table Of Contents

    -- -- -- diff --git a/netpbm-noppmtompeg.patch b/netpbm-noppmtompeg.patch deleted file mode 100644 index f5fbd57b3809e09f0ca59c7033ba1229f322d9f0..0000000000000000000000000000000000000000 --- a/netpbm-noppmtompeg.patch +++ /dev/null @@ -1,13 +0,0 @@ -diff --git a/converter/ppm/Makefile b/converter/ppm/Makefile -index b97349d..f68170f 100644 ---- a/converter/ppm/Makefile -+++ b/converter/ppm/Makefile -@@ -7,7 +7,7 @@ VPATH=.:$(SRCDIR)/$(SUBDIR) - - include $(BUILDDIR)/config.mk - --SUBDIRS = hpcdtoppm ppmtompeg -+SUBDIRS = hpcdtoppm - - PORTBINARIES = 411toppm eyuvtoppm gouldtoppm ilbmtoppm imgtoppm \ - leaftoppm mtvtoppm neotoppm \ diff --git a/netpbm-pamtojpeg2k.patch b/netpbm-pamtojpeg2k.patch index 9615ce736c935fbc757ca4767d17006d9c9ed065..8fbd8996e00cf54b4bad07d594c44babc5c9da0f 100644 --- a/netpbm-pamtojpeg2k.patch +++ b/netpbm-pamtojpeg2k.patch @@ -1,11 +1,11 @@ diff -up netpbm-10.47.12/converter/other/jpeg2000/pamtojpeg2k.c.pamtojpeg2kfix netpbm-10.47.12/converter/other/jpeg2000/pamtojpeg2k.c --- netpbm-10.47.12/converter/other/jpeg2000/pamtojpeg2k.c.pamtojpeg2kfix 2010-04-27 15:47:10.000000000 +0200 +++ netpbm-10.47.12/converter/other/jpeg2000/pamtojpeg2k.c 2010-05-03 15:37:49.934269588 +0200 -@@ -518,7 +518,5 @@ main(int argc, char **argv) +@@ -532,7 +532,5 @@ main(int argc, char **argv) pm_close(ifP); - pm_close(stdout); -- +- return 0; } diff --git a/netpbm-python3.patch b/netpbm-python3.patch index f611b81af701246d04788f51762de7c3e7153c17..2557933b0f77d39f3027e16cb4245717d3318e85 100644 --- a/netpbm-python3.patch +++ b/netpbm-python3.patch @@ -1,9 +1,28 @@ -diff -urNp old/buildtools/makeman new/buildtools/makeman ---- old/buildtools/makeman 2018-01-03 12:15:55.000000000 +0100 -+++ new/buildtools/makeman 2018-02-26 14:18:39.993760106 +0100 +diff --git a/buildtools/makeman b/buildtools/makeman +index 196dbd0..d73ab76 100755 +--- a/buildtools/makeman ++++ b/buildtools/makeman @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/python3 # # makeman -- compile netpbm's stereotyped HTML to troff markup # +diff --git a/buildtools/manpage.mk b/buildtools/manpage.mk +index ef1a103..c1badb8 100644 +--- a/buildtools/manpage.mk ++++ b/buildtools/manpage.mk +@@ -126,11 +126,11 @@ reportman: + # to standard error. + %.1 %.3 %.5: $(USERGUIDE)/%.html + @echo Converting $< to $@ +- @python $(MAKEMAN) -d $(USERGUIDE) $(= nl); + overflow_add(nh - nl, 1); -+ MALLOCARRAY(v, (unsigned) (nh - nl + 1)); if (v == NULL) -@@ -129,6 +131,7 @@ matrix (unsigned int const nrl, +@@ -85,6 +86,7 @@ matrix (unsigned int const nrl, assert(nrh >= nrl); /* allocate pointers to rows */ @@ -18,7 +17,7 @@ diff -urNp a/analyzer/pgmtexture.c b/analyzer/pgmtexture.c MALLOCARRAY(m, (unsigned) (nrh - nrl + 1)); if (m == NULL) pm_error("Unable to allocate memory for a matrix."); -@@ -137,6 +140,7 @@ matrix (unsigned int const nrl, +@@ -93,6 +95,7 @@ matrix (unsigned int const nrl, assert (nch >= ncl); @@ -26,20 +25,20 @@ diff -urNp a/analyzer/pgmtexture.c b/analyzer/pgmtexture.c /* allocate rows and set pointers to them */ for (i = nrl; i <= nrh; ++i) { MALLOCARRAY(m[i], (unsigned) (nch - ncl + 1)); -diff -urNp a/converter/other/gemtopnm.c b/converter/other/gemtopnm.c ---- a/converter/other/gemtopnm.c 2018-07-23 15:03:21.379486786 +0200 -+++ b/converter/other/gemtopnm.c 2018-07-23 15:05:03.053265786 +0200 +diff -ruNp a/converter/other/gemtopnm.c b/converter/other/gemtopnm.c +--- a/converter/other/gemtopnm.c 2021-06-02 15:53:59.835205659 +0200 ++++ b/converter/other/gemtopnm.c 2021-06-02 16:15:29.598641385 +0200 @@ -106,6 +106,7 @@ main(argc, argv) - pnm_writepnminit( stdout, cols, rows, MAXVAL, type, 0 ); + pnm_writepnminit( stdout, cols, rows, MAXVAL, type, 0 ); + overflow_add(cols, padright); - { + { /* allocate input row data structure */ int plane; -diff -urNp a/converter/other/jpegtopnm.c b/converter/other/jpegtopnm.c ---- a/converter/other/jpegtopnm.c 2018-07-23 15:03:21.398486744 +0200 -+++ b/converter/other/jpegtopnm.c 2018-07-23 15:05:03.068265754 +0200 +diff -ruNp a/converter/other/jpegtopnm.c b/converter/other/jpegtopnm.c +--- a/converter/other/jpegtopnm.c 2021-06-02 15:53:59.833205640 +0200 ++++ b/converter/other/jpegtopnm.c 2021-06-02 16:16:28.520206914 +0200 @@ -862,6 +862,8 @@ convertImage(FILE * /* Calculate output image dimensions so we can allocate space */ jpeg_calc_output_dimensions(cinfoP); @@ -49,20 +48,20 @@ diff -urNp a/converter/other/jpegtopnm.c b/converter/other/jpegtopnm.c /* Start decompressor */ jpeg_start_decompress(cinfoP); -diff -urNp a/converter/other/pbmtopgm.c b/converter/other/pbmtopgm.c ---- a/converter/other/pbmtopgm.c 2018-07-23 15:03:21.380486783 +0200 -+++ b/converter/other/pbmtopgm.c 2018-07-23 15:05:03.068265754 +0200 -@@ -47,6 +47,7 @@ main(int argc, char *argv[]) { - "than the image height (%u rows)", height, rows); +diff -ruNp a/converter/other/pbmtopgm.c b/converter/other/pbmtopgm.c +--- a/converter/other/pbmtopgm.c 2021-06-02 15:53:59.831205621 +0200 ++++ b/converter/other/pbmtopgm.c 2021-06-02 16:17:14.248645808 +0200 +@@ -60,6 +60,7 @@ main(int argc, char *argv[]) { + outrow = pgm_allocrow(cols) ; + overflow2(width, height); maxval = MIN(PGM_OVERALLMAXVAL, width*height); pgm_writepgminit(stdout, cols, rows, maxval, 0) ; -diff -urNp a/converter/other/pnmtoddif.c b/converter/other/pnmtoddif.c ---- a/converter/other/pnmtoddif.c 2018-07-23 15:03:21.380486783 +0200 -+++ b/converter/other/pnmtoddif.c 2018-07-23 15:05:03.068265754 +0200 +diff -ruNp a/converter/other/pnmtoddif.c b/converter/other/pnmtoddif.c +--- a/converter/other/pnmtoddif.c 2021-06-02 15:53:59.832205630 +0200 ++++ b/converter/other/pnmtoddif.c 2021-06-02 16:18:17.064248709 +0200 @@ -629,6 +629,7 @@ main(int argc, char *argv[]) { switch (PNM_FORMAT_TYPE(format)) { case PBM_TYPE: @@ -79,46 +78,47 @@ diff -urNp a/converter/other/pnmtoddif.c b/converter/other/pnmtoddif.c ip.bytes_per_line = 3 * cols; ip.bits_per_pixel = 24; ip.spectral = 5; -diff -urNp a/converter/other/pnmtojpeg.c b/converter/other/pnmtojpeg.c ---- a/converter/other/pnmtojpeg.c 2018-07-23 15:03:21.387486768 +0200 -+++ b/converter/other/pnmtojpeg.c 2018-07-23 15:05:03.068265754 +0200 +diff -ruNp a/converter/other/pnmtojpeg.c b/converter/other/pnmtojpeg.c +--- a/converter/other/pnmtojpeg.c 2021-06-02 15:53:59.835205659 +0200 ++++ b/converter/other/pnmtojpeg.c 2021-06-02 19:57:44.413225834 +0200 @@ -606,7 +606,11 @@ read_scan_script(j_compress_ptr const ci - want JPOOL_PERMANENT. + want JPOOL_PERMANENT. */ const unsigned int scan_info_size = nscans * sizeof(jpeg_scan_info); -- jpeg_scan_info * const scan_info = +- jpeg_scan_info * const scan_info = + const jpeg_scan_info * scan_info; -+ ++ + overflow2(nscans, sizeof(jpeg_scan_info)); -+ ++ + scan_info = (jpeg_scan_info *) (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, scan_info_size); -@@ -938,6 +942,8 @@ compute_rescaling_array(JSAMPLE ** const +@@ -938,6 +942,9 @@ compute_rescaling_array(JSAMPLE ** const const long half_maxval = maxval / 2; long val; + overflow_add(maxval, 1); + overflow2(maxval+1, sizeof(JSAMPLE)); ++ *rescale_p = (JSAMPLE *) (cinfo.mem->alloc_small) ((j_common_ptr) &cinfo, JPOOL_IMAGE, - (size_t) (((long) maxval + 1L) * -@@ -1016,6 +1022,7 @@ convert_scanlines(struct jpeg_compress_s + (size_t) (((long) maxval + 1L) * +@@ -1016,6 +1023,7 @@ convert_scanlines(struct jpeg_compress_s */ /* Allocate the libpnm output and compressor input buffers */ + overflow2(cinfo_p->image_width, cinfo_p->input_components); buffer = (*cinfo_p->mem->alloc_sarray) ((j_common_ptr) cinfo_p, JPOOL_IMAGE, - (unsigned int) cinfo_p->image_width * cinfo_p->input_components, -diff -urNp a/converter/other/pnmtops.c b/converter/other/pnmtops.c ---- a/converter/other/pnmtops.c 2018-07-23 15:03:21.399486742 +0200 -+++ b/converter/other/pnmtops.c 2018-07-23 15:05:03.068265754 +0200 + (unsigned int) cinfo_p->image_width * cinfo_p->input_components, +diff -ruNp a/converter/other/pnmtops.c b/converter/other/pnmtops.c +--- a/converter/other/pnmtops.c 2021-06-02 15:53:59.835205659 +0200 ++++ b/converter/other/pnmtops.c 2021-06-02 20:02:06.055502227 +0200 @@ -294,17 +294,21 @@ parseCommandLine(int argc, const char ** validateCompDimension(width, 72, "-width value"); validateCompDimension(height, 72, "-height value"); - + + overflow2(width, 72); cmdlineP->width = width * 72; + overflow2(height, 72); @@ -138,32 +138,32 @@ diff -urNp a/converter/other/pnmtops.c b/converter/other/pnmtops.c cmdlineP->imageheight = imageheight * 72; } else -diff -urNp a/converter/other/rletopnm.c b/converter/other/rletopnm.c ---- a/converter/other/rletopnm.c 2018-07-23 15:03:21.385486773 +0200 -+++ b/converter/other/rletopnm.c 2018-07-23 15:05:03.068265754 +0200 +diff -ruNp a/converter/other/rletopnm.c b/converter/other/rletopnm.c +--- a/converter/other/rletopnm.c 2021-06-02 15:53:59.834205650 +0200 ++++ b/converter/other/rletopnm.c 2021-06-02 20:03:24.864187893 +0200 @@ -19,6 +19,8 @@ * If you modify this software, you should include a notice giving the * name of the person performing the modification, the date of modification, * and the reason for such modification. + * -+ * 2002-12-19: Fix maths wrapping bugs. Alan Cox ++ * 2002-12-19: Fix maths wrapping bugs. Alan Cox */ /* * rletopnm - A conversion program to convert from Utah's "rle" image format -diff -urNp a/converter/other/sirtopnm.c b/converter/other/sirtopnm.c ---- a/converter/other/sirtopnm.c 2018-07-23 15:03:21.398486744 +0200 -+++ b/converter/other/sirtopnm.c 2018-07-23 15:05:03.068265754 +0200 +diff -ruNp a/converter/other/sirtopnm.c b/converter/other/sirtopnm.c +--- a/converter/other/sirtopnm.c 2021-06-02 15:53:59.833205640 +0200 ++++ b/converter/other/sirtopnm.c 2021-06-02 20:03:50.280409024 +0200 @@ -69,6 +69,7 @@ char* argv[]; } break; case PPM_TYPE: -+ overflow3(cols, rows, 3); ++ overflow3(cols, rows, 3); picsize = cols * rows * 3; planesize = cols * rows; if ( !( sirarray = (unsigned char*) malloc( picsize ) ) ) -diff -urNp a/converter/other/tifftopnm.c b/converter/other/tifftopnm.c ---- a/converter/other/tifftopnm.c 2018-07-23 15:03:21.379486786 +0200 -+++ b/converter/other/tifftopnm.c 2018-07-23 15:05:03.068265754 +0200 +diff -ruNp a/converter/other/tifftopnm.c b/converter/other/tifftopnm.c +--- a/converter/other/tifftopnm.c 2021-06-02 15:53:59.834205650 +0200 ++++ b/converter/other/tifftopnm.c 2021-06-02 20:04:47.721908789 +0200 @@ -1372,7 +1372,9 @@ convertRasterByRows(pnmOut * const if (scanbuf == NULL) pm_error("can't allocate memory for scanline buffer"); @@ -175,9 +175,9 @@ diff -urNp a/converter/other/tifftopnm.c b/converter/other/tifftopnm.c if (samplebuf == NULL) pm_error("can't allocate memory for row buffer"); -diff -urNp a/converter/other/xwdtopnm.c b/converter/other/xwdtopnm.c ---- a/converter/other/xwdtopnm.c 2018-07-23 15:03:21.387486768 +0200 -+++ b/converter/other/xwdtopnm.c 2018-07-23 15:05:03.068265754 +0200 +diff -ruNp a/converter/other/xwdtopnm.c b/converter/other/xwdtopnm.c +--- a/converter/other/xwdtopnm.c 2021-06-02 15:53:59.833205640 +0200 ++++ b/converter/other/xwdtopnm.c 2021-06-02 20:23:21.807634239 +0200 @@ -210,6 +210,10 @@ processX10Header(X10WDFileHeader * cons *colorsP = pnm_allocrow(2); PNM_ASSIGN1((*colorsP)[0], 0); @@ -197,9 +197,9 @@ diff -urNp a/converter/other/xwdtopnm.c b/converter/other/xwdtopnm.c *padrightP = h11FixedP->bytes_per_line * 8 - h11FixedP->pixmap_width * h11FixedP->bits_per_pixel; -diff -urNp a/converter/pbm/mdatopbm.c b/converter/pbm/mdatopbm.c ---- a/converter/pbm/mdatopbm.c 2018-07-23 15:03:21.377486790 +0200 -+++ b/converter/pbm/mdatopbm.c 2018-07-23 15:05:03.052265788 +0200 +diff -ruNp a/converter/pbm/mdatopbm.c b/converter/pbm/mdatopbm.c +--- a/converter/pbm/mdatopbm.c 2021-06-02 15:53:59.826205573 +0200 ++++ b/converter/pbm/mdatopbm.c 2021-06-02 20:23:21.807634239 +0200 @@ -245,10 +245,13 @@ main(int argc, char **argv) { pm_readlittleshort(infile, &yy); nInCols = yy; } @@ -215,21 +215,43 @@ diff -urNp a/converter/pbm/mdatopbm.c b/converter/pbm/mdatopbm.c data = pbm_allocarray(nOutCols, nOutRows); -diff -urNp a/converter/pbm/mgrtopbm.c b/converter/pbm/mgrtopbm.c ---- a/converter/pbm/mgrtopbm.c 2018-07-23 15:03:21.377486790 +0200 -+++ b/converter/pbm/mgrtopbm.c 2018-07-23 15:05:03.052265788 +0200 -@@ -65,6 +65,8 @@ readMgrHeader(FILE * const ifP, - if (head.h_high < ' ' || head.l_high < ' ') - pm_error("Invalid width field in MGR header"); - +diff -ruNp a/converter/pbm/mgrtopbm.c b/converter/pbm/mgrtopbm.c +--- a/converter/pbm/mgrtopbm.c 2022-01-03 16:41:24.856969944 +0100 ++++ b/converter/pbm/mgrtopbm.c 2022-01-03 16:43:27.023842152 +0100 +@@ -105,6 +105,8 @@ readMgrHeader(FILE * const ifP, + interpHdrWidth (head, colsP); + interpHdrHeight(head, rowsP); + + overflow_add(*colsP, pad); + - *colsP = (((int)head.h_wide - ' ') << 6) + ((int)head.l_wide - ' '); - *rowsP = (((int)head.h_high - ' ') << 6) + ((int) head.l_high - ' '); - *padrightP = ( ( *colsP + pad - 1 ) / pad ) * pad - *colsP; -diff -urNp a/converter/pbm/pbmtogem.c b/converter/pbm/pbmtogem.c ---- a/converter/pbm/pbmtogem.c 2018-07-23 15:03:21.377486790 +0200 -+++ b/converter/pbm/pbmtogem.c 2018-07-23 15:05:03.052265788 +0200 + *padrightP = ((*colsP + pad - 1) / pad) * pad - *colsP; + } + +diff --git a/converter/pbm/pbmto4425.c b/converter/pbm/pbmto4425.c +index 1d97ac6..c4c8cbb 100644 +--- a/converter/pbm/pbmto4425.c ++++ b/converter/pbm/pbmto4425.c +@@ -2,6 +2,7 @@ + + #include "nstring.h" + #include "pbm.h" ++#include + + static char bit_table[2][3] = { + {1, 4, 0x10}, +@@ -160,7 +161,7 @@ main(int argc, char * argv[]) { + xres = vmap_width * 2; + yres = vmap_height * 3; + +- vmap = malloc(vmap_width * vmap_height * sizeof(char)); ++ vmap = malloc3(vmap_width, vmap_height, sizeof(char)); + if(vmap == NULL) + { + pm_error( "Cannot allocate memory" ); +diff --git a/converter/pbm/pbmtogem.c b/converter/pbm/pbmtogem.c +index 4fd30e9..c82757d 100644 +--- a/converter/pbm/pbmtogem.c ++++ b/converter/pbm/pbmtogem.c @@ -79,6 +79,7 @@ putinit (int const rows, int const cols) bitsperitem = 0; bitshift = 7; @@ -238,9 +260,9 @@ diff -urNp a/converter/pbm/pbmtogem.c b/converter/pbm/pbmtogem.c outmax = (cols + 7) / 8; outrow = (unsigned char *) pm_allocrow (outmax, sizeof (unsigned char)); lastrow = (unsigned char *) pm_allocrow (outmax, sizeof (unsigned char)); -diff -urNp a/converter/pbm/pbmtogo.c b/converter/pbm/pbmtogo.c ---- a/converter/pbm/pbmtogo.c 2018-07-23 15:03:21.377486790 +0200 -+++ b/converter/pbm/pbmtogo.c 2018-07-23 15:05:03.052265788 +0200 +diff -ruNp a/converter/pbm/pbmtogo.c b/converter/pbm/pbmtogo.c +--- a/converter/pbm/pbmtogo.c 2021-06-02 15:53:59.826205573 +0200 ++++ b/converter/pbm/pbmtogo.c 2021-06-02 20:23:21.809634256 +0200 @@ -158,6 +158,7 @@ main(int argc, bitrow = pbm_allocrow(cols); @@ -249,9 +271,9 @@ diff -urNp a/converter/pbm/pbmtogo.c b/converter/pbm/pbmtogo.c rucols = ( cols + 7 ) / 8; bytesperrow = rucols; /* GraphOn uses bytes */ rucols = rucols * 8; -diff -urNp a/converter/pbm/pbmtolj.c b/converter/pbm/pbmtolj.c ---- a/converter/pbm/pbmtolj.c 2018-07-23 15:03:21.377486790 +0200 -+++ b/converter/pbm/pbmtolj.c 2018-07-23 15:05:03.052265788 +0200 +diff -ruNp a/converter/pbm/pbmtolj.c b/converter/pbm/pbmtolj.c +--- a/converter/pbm/pbmtolj.c 2021-06-02 15:53:59.828205592 +0200 ++++ b/converter/pbm/pbmtolj.c 2021-06-02 20:23:21.810634265 +0200 @@ -120,7 +120,11 @@ parseCommandLine(int argc, char ** argv, static void allocateBuffers(unsigned int const cols) { @@ -264,9 +286,9 @@ diff -urNp a/converter/pbm/pbmtolj.c b/converter/pbm/pbmtolj.c packBufferSize = rowBufferSize + (rowBufferSize + 127) / 128 + 1; deltaBufferSize = rowBufferSize + rowBufferSize / 8 + 10; -diff -urNp a/converter/pbm/pbmtomda.c b/converter/pbm/pbmtomda.c ---- a/converter/pbm/pbmtomda.c 2018-07-23 15:03:21.377486790 +0200 -+++ b/converter/pbm/pbmtomda.c 2018-07-23 15:05:03.052265788 +0200 +diff -ruNp a/converter/pbm/pbmtomda.c b/converter/pbm/pbmtomda.c +--- a/converter/pbm/pbmtomda.c 2021-06-02 15:53:59.827205582 +0200 ++++ b/converter/pbm/pbmtomda.c 2021-06-02 20:23:21.810634265 +0200 @@ -179,6 +179,7 @@ int main(int argc, char **argv) nOutRowsUnrounded = bScale ? nInRows/2 : nInRows; @@ -275,28 +297,307 @@ diff -urNp a/converter/pbm/pbmtomda.c b/converter/pbm/pbmtomda.c nOutRows = ((nOutRowsUnrounded + 3) / 4) * 4; /* MDA wants rows a multiple of 4 */ nOutCols = nInCols / 8; -diff -urNp a/converter/pbm/pbmtoppa/pbm.c b/converter/pbm/pbmtoppa/pbm.c ---- a/converter/pbm/pbmtoppa/pbm.c 2018-07-23 15:03:21.377486790 +0200 -+++ b/converter/pbm/pbmtoppa/pbm.c 2018-07-23 15:05:03.051265791 +0200 -@@ -106,6 +106,7 @@ int pbm_readline(pbm_stat* pbm,unsigned - return 0; +diff -ruNp a/converter/pbm/pbmtoppa/pbm.c b/converter/pbm/pbmtoppa/pbm.c +--- a/converter/pbm/pbmtoppa/pbm.c 2021-06-02 15:53:59.830205611 +0200 ++++ b/converter/pbm/pbmtoppa/pbm.c 2021-06-02 20:23:21.811634274 +0200 +@@ -11,185 +11,128 @@ + #include + #include + #include +-#include + +-#include "pm.h" +-#include "nstring.h" + #include "ppapbm.h" + +-int +-make_pbm_stat(pbm_stat * const pbmStatP, +- FILE * const ifP) { +- +- char line[1024]; +- char * rc; +- int retval; +- +- pbmStatP->fptr = ifP; +- pbmStatP->version = none; +- pbmStatP->current_line = 0; +- pbmStatP->unread = 0; +- +- rc = fgets(line, 1024, ifP); +- if (rc == NULL) +- retval = 0; +- else { +- line[strlen(line)-1] = 0; +- +- if (streq(line,"P1")) +- pbmStatP->version=P1; +- if (streq(line,"P4")) +- pbmStatP->version=P4; +- +- if (pbmStatP->version == none) { +- pm_message("unknown PBM magic '%s'", line); +- retval = 0; +- } else { +- do { +- char * rc; +- rc = fgets(line, 1024, ifP); +- if (rc == NULL) +- return 0; +- } while (line[0] == '#'); +- { +- int rc; +- rc = sscanf(line, "%d %d", +- &pbmStatP->width, &pbmStatP->height); +- if (rc != 2) +- retval = 0; +- else { +- if (pbmStatP->width < 0) { +- pm_message("Image has negative width"); +- retval = 0; +- } else if (pbmStatP->width > INT_MAX/2) { +- pm_message("Uncomputeably large width: %d", +- pbmStatP->width); +- retval = 0; +- } else if (pbmStatP->height < 0) { +- pm_message("Image has negative height"); +- retval = 0; +- } else if (pbmStatP->height > INT_MAX/2) { +- pm_message("Uncomputeably large height: %d", +- pbmStatP->height); +- retval = 0; +- } else +- retval = 1; +- } +- } +- } +- } +- return retval; +-} ++int make_pbm_stat(pbm_stat* pbm,FILE* fptr) ++{ ++ char line[1024]; - case P4: ++ pbm->fptr=fptr; ++ pbm->version=none; ++ pbm->current_line=0; ++ pbm->unread = 0; + ++ if (fgets (line, 1024, fptr) == NULL) ++ return 0; ++ line[strlen(line)-1] = 0; + +-static int +-getbytes(FILE * const ifP, +- unsigned int const width, +- unsigned char * const data) { +- +- unsigned char mask; +- unsigned char acc; +- unsigned char * place; +- unsigned int num; +- int retval; +- +- if (width == 0) +- retval = 0; +- else { +- for (mask = 0x80, acc = 0, num = 0, place = data; num < width; ) { +- switch (getc(ifP)) { +- case EOF: +- return 0; +- case '1': +- acc |= mask; +- /* fall through */ +- case '0': +- mask >>= 1; +- ++num; +- if (mask == 0x00) { /* if (num % 8 == 0) */ +- *place++ = acc; +- acc = 0; +- mask = 0x80; +- } +- } +- } +- if (width % 8 != 0) +- *place = acc; +- +- retval = 1; +- } +- return retval; +-} ++ if(!strcmp(line,"P1")) pbm->version=P1; ++ if(!strcmp(line,"P4")) pbm->version=P4; ++ if(pbm->version == none) ++ { ++ fprintf(stderr,"pbm_readheader(): unknown PBM magic '%s'\n",line); ++ return 0; ++ } + ++ do ++ if (fgets (line, 1024, fptr) == NULL) ++ return 0; ++ while (line[0] == '#'); + ++ if (2 != sscanf (line, "%d %d", &pbm->width, &pbm->height)) ++ return 0; + +-int +-pbm_readline(pbm_stat * const pbmStatP, +- unsigned char * const data) { +-/*---------------------------------------------------------------------------- +- Read a single line into data which must be at least (pbmStatP->width+7)/8 +- bytes of storage. +------------------------------------------------------------------------------*/ +- int retval; +- +- if (pbmStatP->current_line >= pbmStatP->height) +- retval = 0; +- else { +- if (pbmStatP->unread) { +- memcpy(data, pbmStatP->revdata, (pbmStatP->width+7)/8); +- ++pbmStatP->current_line; +- pbmStatP->unread = 0; +- free(pbmStatP->revdata); +- pbmStatP->revdata = NULL; +- retval = 1; +- } else { +- switch (pbmStatP->version) { +- case P1: +- if (getbytes(pbmStatP->fptr, pbmStatP->width, data)) { +- pbmStatP->current_line++; +- retval = 1; +- } else +- retval = 0; +- break; +- case P4: { +- int tmp, tmp2; +- tmp = (pbmStatP->width+7)/8; +- tmp2 = fread(data,1,tmp,pbmStatP->fptr); +- if (tmp2 == tmp) { +- ++pbmStatP->current_line; +- retval = 1; +- } else { +- pm_message("error reading line data (%d)", tmp2); +- retval = 0; +- } +- } break; +- +- default: +- pm_message("unknown PBM version"); +- retval = 0; +- } +- } +- } +- return retval; ++ return 1; + } + ++static int getbytes(FILE *fptr,int width,unsigned char* data) ++{ ++ unsigned char mask,acc,*place; ++ int num; ++ ++ if(!width) return 0; ++ for(mask=0x80, acc=0, num=0, place=data; num>=1; ++ num++; ++ if(!mask) /* if(num%8 == 0) */ ++ { ++ *place++ = acc; ++ acc=0; ++ mask=0x80; ++ } ++ } ++ } ++ if(width%8) ++ *place=acc; ++ return 1; ++} + ++/* Reads a single line into data which must be at least (pbm->width+7)/8 ++ bytes of storage */ ++int pbm_readline(pbm_stat* pbm,unsigned char* data) ++{ ++ int tmp,tmp2; ++ ++ if(pbm->current_line >= pbm->height) return 0; ++ ++ if (pbm->unread) ++ { ++ memcpy (data, pbm->revdata, (pbm->width+7)/8); ++ pbm->current_line++; ++ pbm->unread = 0; ++ free (pbm->revdata); ++ pbm->revdata = NULL; ++ return 1; ++ } + +-void +-pbm_unreadline(pbm_stat * const pbmStatP, +- void * const data) { +-/*---------------------------------------------------------------------------- +- Push a line back into the buffer; we read too much! +------------------------------------------------------------------------------*/ +- /* can store only one line in the unread buffer */ +- +- if (!pbmStatP->unread) { +- pbmStatP->unread = 1; +- pbmStatP->revdata = malloc ((pbmStatP->width+7)/8); +- memcpy(pbmStatP->revdata, data, (pbmStatP->width+7)/8); +- --pbmStatP->current_line; ++ switch(pbm->version) ++ { ++ case P1: ++ if(getbytes(pbm->fptr,pbm->width,data)) ++ { ++ pbm->current_line++; ++ return 1; + } +-} ++ return 0; ++ ++ case P4: + overflow_add(pbm->width, 7); - tmp=(pbm->width+7)/8; - tmp2=fread(data,1,tmp,pbm->fptr); - if(tmp2 == tmp) -@@ -130,6 +131,7 @@ void pbm_unreadline (pbm_stat *pbm, void - return; ++ tmp=(pbm->width+7)/8; ++ tmp2=fread(data,1,tmp,pbm->fptr); ++ if(tmp2 == tmp) ++ { ++ pbm->current_line++; ++ return 1; ++ } ++ fprintf(stderr,"pbm_readline(): error reading line data (%d)\n",tmp2); ++ return 0; + ++ default: ++ fprintf(stderr,"pbm_readline(): unknown PBM version\n"); ++ return 0; ++ } ++} - pbm->unread = 1; ++/* push a line back into the buffer; we read too much! */ ++void pbm_unreadline (pbm_stat *pbm, void *data) ++{ ++ /* can only store one line in the unread buffer */ ++ if (pbm->unread) ++ return; ++ ++ pbm->unread = 1; + overflow_add(pbm->width, 7); - pbm->revdata = malloc ((pbm->width+7)/8); - memcpy (pbm->revdata, data, (pbm->width+7)/8); - pbm->current_line--; -diff -urNp a/converter/pbm/pbmtoppa/pbmtoppa.c b/converter/pbm/pbmtoppa/pbmtoppa.c ---- a/converter/pbm/pbmtoppa/pbmtoppa.c 2018-07-23 15:03:21.377486790 +0200 -+++ b/converter/pbm/pbmtoppa/pbmtoppa.c 2018-07-23 15:05:03.051265791 +0200 ++ pbm->revdata = malloc ((pbm->width+7)/8); ++ memcpy (pbm->revdata, data, (pbm->width+7)/8); ++ pbm->current_line--; ++} +diff -ruNp a/converter/pbm/pbmtoppa/pbmtoppa.c b/converter/pbm/pbmtoppa/pbmtoppa.c +--- a/converter/pbm/pbmtoppa/pbmtoppa.c 2021-06-02 15:53:59.829205601 +0200 ++++ b/converter/pbm/pbmtoppa/pbmtoppa.c 2021-06-02 20:23:21.811634274 +0200 @@ -453,6 +453,7 @@ main(int argc, char *argv[]) { pm_error("main(): unrecognized parameter '%s'", argv[argn]); } @@ -305,9 +606,9 @@ diff -urNp a/converter/pbm/pbmtoppa/pbmtoppa.c b/converter/pbm/pbmtoppa/pbmtoppa Pwidth=(Width+7)/8; printer.fptr=out; -diff -urNp a/converter/pbm/pbmtoxbm.c b/converter/pbm/pbmtoxbm.c ---- a/converter/pbm/pbmtoxbm.c 2018-07-23 15:03:21.376486792 +0200 -+++ b/converter/pbm/pbmtoxbm.c 2018-07-23 15:05:03.053265786 +0200 +diff -ruNp a/converter/pbm/pbmtoxbm.c b/converter/pbm/pbmtoxbm.c +--- a/converter/pbm/pbmtoxbm.c 2021-06-02 15:53:59.829205601 +0200 ++++ b/converter/pbm/pbmtoxbm.c 2021-06-02 20:23:21.812634282 +0200 @@ -352,6 +352,8 @@ convertRaster(FILE * const ifP, unsigned char * bitrow; @@ -317,29 +618,10 @@ diff -urNp a/converter/pbm/pbmtoxbm.c b/converter/pbm/pbmtoxbm.c putinit(xbmVersion); -diff -urNp a/converter/pbm/pbmto4425.c b/converter/pbm/pbmto4425.c ---- a/converter/pbm/pbmto4425.c 2018-07-23 15:03:21.377486790 +0200 -+++ b/converter/pbm/pbmto4425.c 2018-07-23 15:05:03.052265788 +0200 -@@ -2,6 +2,7 @@ - - #include "nstring.h" - #include "pbm.h" -+#include - - static char bit_table[2][3] = { - {1, 4, 0x10}, -@@ -160,7 +161,7 @@ main(int argc, char * argv[]) { - xres = vmap_width * 2; - yres = vmap_height * 3; - -- vmap = malloc(vmap_width * vmap_height * sizeof(char)); -+ vmap = malloc3(vmap_width, vmap_height, sizeof(char)); - if(vmap == NULL) - { - pm_error( "Cannot allocate memory" ); -diff -urNp a/converter/pbm/pktopbm.c b/converter/pbm/pktopbm.c ---- a/converter/pbm/pktopbm.c 2018-07-23 15:03:21.377486790 +0200 -+++ b/converter/pbm/pktopbm.c 2018-07-23 15:05:03.053265786 +0200 +diff --git a/converter/pbm/pktopbm.c b/converter/pbm/pktopbm.c +index 712f339..b6fcb02 100644 +--- a/converter/pbm/pktopbm.c ++++ b/converter/pbm/pktopbm.c @@ -280,6 +280,7 @@ main(int argc, char *argv[]) { if (flagbyte == 7) { /* long form preamble */ integer packetlength = get32() ; /* character packet length */ @@ -348,9 +630,9 @@ diff -urNp a/converter/pbm/pktopbm.c b/converter/pbm/pktopbm.c endofpacket = packetlength + pktopbm_pkloc; /* calculate end of packet */ if ((car >= MAXPKCHAR) || !filename[car]) { -diff -urNp a/converter/pbm/thinkjettopbm.l b/converter/pbm/thinkjettopbm.l ---- a/converter/pbm/thinkjettopbm.l 2018-07-23 15:03:21.377486790 +0200 -+++ b/converter/pbm/thinkjettopbm.l 2018-07-23 15:05:03.053265786 +0200 +diff -ruNp a/converter/pbm/thinkjettopbm.l b/converter/pbm/thinkjettopbm.l +--- a/converter/pbm/thinkjettopbm.l 2021-06-02 15:53:59.828205592 +0200 ++++ b/converter/pbm/thinkjettopbm.l 2021-06-02 20:23:21.813634291 +0200 @@ -114,7 +114,9 @@ DIG [0-9] \033\*b{DIG}+W { int l; @@ -371,20 +653,21 @@ diff -urNp a/converter/pbm/thinkjettopbm.l b/converter/pbm/thinkjettopbm.l pbm_writepbminit(stdout, maxRowLength*8, rowCount, 0); packed_bitrow = malloc(maxRowLength); -diff -urNp a/converter/pbm/ybmtopbm.c b/converter/pbm/ybmtopbm.c ---- a/converter/pbm/ybmtopbm.c 2018-07-23 15:03:21.378486788 +0200 -+++ b/converter/pbm/ybmtopbm.c 2018-07-23 15:05:03.053265786 +0200 -@@ -43,6 +43,7 @@ getinit(FILE * const ifP, - pm_error("EOF / read error"); - +diff -ruNp a/converter/pbm/ybmtopbm.c b/converter/pbm/ybmtopbm.c +--- a/converter/pbm/ybmtopbm.c 2022-01-03 16:41:24.857969951 +0100 ++++ b/converter/pbm/ybmtopbm.c 2022-01-03 16:42:59.671646876 +0100 +@@ -49,6 +49,8 @@ getinit(FILE * const ifP, + *colsP = (unsigned int) cols; + *rowsP = (unsigned int) rows; *depthP = 1; ++ + overflow_add(*colsP, 15); } -diff -urNp a/converter/pgm/lispmtopgm.c b/converter/pgm/lispmtopgm.c ---- a/converter/pgm/lispmtopgm.c 2018-07-23 15:03:21.400486740 +0200 -+++ b/converter/pgm/lispmtopgm.c 2018-07-23 15:05:03.069265751 +0200 +diff -ruNp a/converter/pgm/lispmtopgm.c b/converter/pgm/lispmtopgm.c +--- a/converter/pgm/lispmtopgm.c 2021-06-02 15:53:59.831205621 +0200 ++++ b/converter/pgm/lispmtopgm.c 2021-06-02 20:23:21.814634300 +0200 @@ -58,6 +58,7 @@ main( argc, argv ) pm_error( "depth (%d bits) is too large", depth); @@ -402,9 +685,9 @@ diff -urNp a/converter/pgm/lispmtopgm.c b/converter/pgm/lispmtopgm.c *padrightP = ( ( *colsP + 31 ) / 32 ) * 32 - *colsP; -diff -urNp a/converter/pgm/psidtopgm.c b/converter/pgm/psidtopgm.c ---- a/converter/pgm/psidtopgm.c 2018-07-23 15:03:21.400486740 +0200 -+++ b/converter/pgm/psidtopgm.c 2018-07-23 15:05:03.069265751 +0200 +diff -ruNp a/converter/pgm/psidtopgm.c b/converter/pgm/psidtopgm.c +--- a/converter/pgm/psidtopgm.c 2021-06-02 15:53:59.830205611 +0200 ++++ b/converter/pgm/psidtopgm.c 2021-06-02 20:23:21.815634309 +0200 @@ -78,6 +78,7 @@ main(int argc, pm_error("bits/sample (%d) is too large.", bitspersample); @@ -413,9 +696,23 @@ diff -urNp a/converter/pgm/psidtopgm.c b/converter/pgm/psidtopgm.c grayrow = pgm_allocrow((cols + 7) / 8 * 8); for (row = 0; row < rows; ++row) { unsigned int col; -diff -urNp a/converter/ppm/ilbmtoppm.c b/converter/ppm/ilbmtoppm.c ---- a/converter/ppm/ilbmtoppm.c 2018-07-23 15:03:21.403486734 +0200 -+++ b/converter/ppm/ilbmtoppm.c 2018-07-23 15:08:45.446313490 +0200 +diff --git a/converter/ppm/Makefile b/converter/ppm/Makefile +index 003ef8d..b97349d 100644 +--- a/converter/ppm/Makefile ++++ b/converter/ppm/Makefile +@@ -11,7 +11,7 @@ SUBDIRS = hpcdtoppm ppmtompeg + + PORTBINARIES = 411toppm eyuvtoppm gouldtoppm ilbmtoppm imgtoppm \ + leaftoppm mtvtoppm neotoppm \ +- pcxtoppm pc1toppm pi1toppm picttoppm pjtoppm \ ++ pcxtoppm pc1toppm pi1toppm pjtoppm \ + ppmtoacad ppmtoapplevol ppmtoarbtxt ppmtoascii \ + ppmtobmp ppmtoeyuv ppmtogif ppmtoicr ppmtoilbm \ + ppmtoleaf ppmtolj ppmtomitsu ppmtoneo \ +diff --git a/converter/ppm/ilbmtoppm.c b/converter/ppm/ilbmtoppm.c +index b9b8986..f4fe331 100644 +--- a/converter/ppm/ilbmtoppm.c ++++ b/converter/ppm/ilbmtoppm.c @@ -608,6 +608,7 @@ decode_row(FILE * const ifP, rawtype *chp; @@ -486,59 +783,9 @@ diff -urNp a/converter/ppm/ilbmtoppm.c b/converter/ppm/ilbmtoppm.c MALLOCARRAY_NOFAIL(ilbmrow, RowBytes(bmhdP->w)); *viewportmodesP |= fakeviewport; /* -isham/-isehb */ -diff -urNp a/converter/ppm/ilbmtoppm.c.rej b/converter/ppm/ilbmtoppm.c.rej ---- a/converter/ppm/ilbmtoppm.c.rej 1970-01-01 01:00:00.000000000 +0100 -+++ b/converter/ppm/ilbmtoppm.c.rej 2018-07-23 15:05:03.071265747 +0200 -@@ -0,0 +1,46 @@ -+--- converter/ppm/ilbmtoppm.c -++++ converter/ppm/ilbmtoppm.c -+@@ -694,6 +695,23 @@ decode_mask(FILE * const ifP, -+ Multipalette handling -+ ****************************************************************************/ -+ -++static void * -++xmalloc2(x, y) -++ int x; -++ int y; -++{ -++ void *mem; -++ -++ overflow2(x,y); -++ if( x * y == 0 ) -++ return NULL; -++ -++ mem = malloc2(x,y); -++ if( mem == NULL ) -++ pm_error("out of memory allocating %d bytes", x * y); -++ return mem; -++} -++ -+ -+ static void -+ multi_adjust(cmap, row, palchange) -+@@ -1356,6 +1374,9 @@ dcol_to_ppm(FILE * const ifP, -+ if( redmaxval != maxval || greenmaxval != maxval || bluemaxval != maxval ) -+ pm_message("scaling colors to %d bits", pm_maxvaltobits(maxval)); -+ -++ overflow_add(redmaxval, 1); -++ overflow_add(greenmaxval, 1); -++ overflow_add(bluemaxval, 1); -+ MALLOCARRAY_NOFAIL(redtable, redmaxval +1); -+ MALLOCARRAY_NOFAIL(greentable, greenmaxval +1); -+ MALLOCARRAY_NOFAIL(bluetable, bluemaxval +1); -+@@ -1785,7 +1806,9 @@ PCHG_ConvertSmall(PCHG, cmap, mask, datasize) -+ ChangeCount32 = *data++; -+ datasize -= 2; -+ -++ overflow_add(ChangeCount16, ChangeCount32); -+ changes = ChangeCount16 + ChangeCount32; -++ overflow_add(changes, 1); -+ for( i = 0; i < changes; i++ ) { -+ if( totalchanges >= PCHG->TotalChanges ) goto fail; -+ if( datasize < 2 ) goto fail; -diff -urNp a/converter/ppm/imgtoppm.c b/converter/ppm/imgtoppm.c ---- a/converter/ppm/imgtoppm.c 2018-07-23 15:03:21.404486731 +0200 -+++ b/converter/ppm/imgtoppm.c 2018-07-23 15:05:03.071265747 +0200 +diff -ruNp a/converter/ppm/imgtoppm.c b/converter/ppm/imgtoppm.c +--- a/converter/ppm/imgtoppm.c 2021-06-02 15:53:59.845205755 +0200 ++++ b/converter/ppm/imgtoppm.c 2021-06-02 20:23:21.818634335 +0200 @@ -84,6 +84,7 @@ main(int argc, char ** argv) { len = atoi((char*) buf ); if ( fread( buf, len, 1, ifp ) != 1 ) @@ -555,22 +802,11 @@ diff -urNp a/converter/ppm/imgtoppm.c b/converter/ppm/imgtoppm.c if ( len != cols * rows ) pm_message( "pixel data length (%d) does not match image size (%d)", -diff -urNp a/converter/ppm/Makefile b/converter/ppm/Makefile ---- a/converter/ppm/Makefile 2018-07-23 15:03:21.406486727 +0200 -+++ b/converter/ppm/Makefile 2018-07-23 15:05:03.071265747 +0200 -@@ -11,7 +11,7 @@ SUBDIRS = hpcdtoppm - - PORTBINARIES = 411toppm eyuvtoppm gouldtoppm ilbmtoppm imgtoppm \ - leaftoppm mtvtoppm neotoppm \ -- pcxtoppm pc1toppm pi1toppm picttoppm pjtoppm \ -+ pcxtoppm pc1toppm pi1toppm pjtoppm \ - ppmtoacad ppmtoapplevol ppmtoarbtxt ppmtoascii \ - ppmtobmp ppmtoeyuv ppmtogif ppmtoicr ppmtoilbm \ - ppmtoleaf ppmtolj ppmtomitsu ppmtoneo \ -diff -urNp a/converter/ppm/pcxtoppm.c b/converter/ppm/pcxtoppm.c ---- a/converter/ppm/pcxtoppm.c 2018-07-23 15:03:21.406486727 +0200 -+++ b/converter/ppm/pcxtoppm.c 2018-07-23 15:05:03.071265747 +0200 -@@ -409,6 +409,7 @@ pcx_planes_to_pixels(pixels, bitplanes, +diff --git a/converter/ppm/pcxtoppm.c b/converter/ppm/pcxtoppm.c +index e252ba2..270ae3b 100644 +--- a/converter/ppm/pcxtoppm.c ++++ b/converter/ppm/pcxtoppm.c +@@ -409,6 +409,7 @@ pcx_planes_to_pixels(pixels, bitplanes, bytesperline, planes, bitsperpixel) /* * clear the pixel buffer */ @@ -586,42 +822,192 @@ diff -urNp a/converter/ppm/pcxtoppm.c b/converter/ppm/pcxtoppm.c rawcols = BytesPerLine * 8 / BitsPerPixel; if (headerCols > rawcols) { pm_message("warning - BytesPerLine = %d, " -diff -urNp a/converter/ppm/picttoppm.c b/converter/ppm/picttoppm.c ---- a/converter/ppm/picttoppm.c 2018-07-23 15:03:21.404486731 +0200 -+++ b/converter/ppm/picttoppm.c 2018-07-23 15:05:03.071265747 +0200 +diff -ruNp a/converter/ppm/picttoppm.c b/converter/ppm/picttoppm.c +--- a/converter/ppm/picttoppm.c 2021-06-02 15:53:59.845205755 +0200 ++++ b/converter/ppm/picttoppm.c 2021-06-02 20:23:21.820634352 +0200 @@ -1,3 +1,4 @@ +#error "Unfixable. Don't ship me" /* * picttoppm.c -- convert a MacIntosh PICT file to PPM format. * -diff -urNp a/converter/ppm/pjtoppm.c b/converter/ppm/pjtoppm.c ---- a/converter/ppm/pjtoppm.c 2018-07-23 15:03:21.402486736 +0200 -+++ b/converter/ppm/pjtoppm.c 2018-07-23 15:05:03.071265747 +0200 -@@ -127,20 +127,22 @@ main(argc, argv) +diff -ruNp a/converter/ppm/pjtoppm.c b/converter/ppm/pjtoppm.c +--- a/converter/ppm/pjtoppm.c 2021-06-02 15:53:59.845205755 +0200 ++++ b/converter/ppm/pjtoppm.c 2021-06-02 20:23:21.821634361 +0200 +@@ -10,98 +10,66 @@ + ** implied warranty. + */ + +-#include +- + #include "ppm.h" +-#include "pm_c_util.h" + #include "mallocvar.h" + + static char usage[] = "[paintjetfile]"; + +- +- +-static unsigned int +-uintProduct(unsigned int const multiplicand, +- unsigned int const multiplier) { +- +- if (UINT_MAX / multiplier < multiplicand) +- pm_error("Airthmetic overflow"); +- +- return multiplicand * multiplier; +-} +- +- +- ++static int egetc ARGS((FILE *fp)); + static int +-egetc(FILE * const ifP) { ++egetc(fp) ++ FILE *fp; ++{ + int c; +- +- c = fgetc(ifP); +- +- if (c == -1) ++ if ((c = fgetc(fp)) == -1) + pm_error("unexpected end of file"); +- +- return c; ++ return(c); + } + +- +- + int +-main(int argc, const char ** argv) { +- ++main(argc, argv) ++ int argc; ++ char *argv[]; ++{ + int cmd, val; + char buffer[BUFSIZ]; +- int planes = 3; +- unsigned int rows; +- unsigned int rowsX; +- unsigned int cols; +- bool colsIsSet; ++ int planes = 3, rows = -1, cols = -1; ++ int r = 0, c = 0, p = 0, i; + unsigned char **image = NULL; + int *imlen; +- FILE * ifP; ++ FILE *fp = stdin; + int mode; +- bool modeIsSet; + int argn; + unsigned char bf[3]; +- pixel * pixrow; +- int c; +- int row; +- int plane; ++ pixel *pixrow; + +- pm_proginit(&argc, argv); + ++ ppm_init(&argc, argv); + argn = 1; + if (argn != argc) +- ifP = pm_openr(argv[argn++]); ++ fp = pm_openr(argv[argn++]); + else +- ifP = stdin; ++ fp = stdin; + + if (argn != argc) + pm_usage(usage); + +- row = 0; /* initial value */ +- plane = 0; /* initial value */ +- modeIsSet = false; /* initial value */ +- colsIsSet = false; /* initial value */ +- rowsX = 0; /* initial value */ +- +- while ((c = fgetc(ifP)) != -1) { ++ while ((c = fgetc(fp)) != -1) { + if (c != '\033') + continue; +- switch (c = egetc(ifP)) { ++ switch (c = egetc(fp)) { + case 'E': /* reset */ + break; +- case '*': { +- unsigned int i; +- cmd = egetc(ifP); ++ case '*': ++ cmd = egetc(fp); + for (i = 0; i < BUFSIZ; i++) { +- if (!isdigit(c = egetc(ifP)) && c != '+' && c != '-') ++ if (!isdigit(c = egetc(fp)) && c != '+' && c != '-') + break; + buffer[i] = c; + } + if (i != 0) { + buffer[i] = '\0'; +- if (sscanf(buffer, "%d", &val) != 1) ++ if (sscanf(buffer, "%d", &val) != 1) + pm_error("bad value `%s' at *%c%c", buffer, cmd, c); + } + else +@@ -125,18 +93,18 @@ main(int argc, const char ** argv) { + case 'r': + switch (c) { + case 'S': /* width */ +- if (val < 0) ++ if (val < 0) { + pm_error("invalid width value"); +- else { ++ } else { + cols = val; +- colsIsSet = true; + } + break; + case 'T': /* height */ +- if (val < 0) ++ if (val < 0) { + pm_error ("invalid height value"); +- else +- rowsX = val; ++ } else { ++ rows = val; ++ } + break; + case 'U': /* planes */ + planes = val; +@@ -163,40 +131,43 @@ main(int argc, const char ** argv) { + if (val != 0 && val != 1) + pm_error("unimplemented transmission mode %d", val); + mode = val; +- modeIsSet = true; + break; case 'V': /* send plane */ case 'W': /* send last plane */ - if (rows == -1 || r >= rows || image == NULL) { -- if (rows == -1 || r >= rows) +- if (row >= rowsX || image == NULL) { +- if (row >= rowsX) +- rowsX += 100; ++ if (rows == -1 || r >= rows || image == NULL) { + if (rows == -1 || r >= rows) { + overflow_add(rows, 100); - rows += 100; ++ rows += 100; + } + if (image == NULL) { -- MALLOCARRAY(image, rows * planes); -- MALLOCARRAY(imlen, rows * planes); +- MALLOCARRAY(image, uintProduct(rowsX, planes)); +- MALLOCARRAY(imlen, uintProduct(rowsX, planes)); +- } else { +- REALLOCARRAY(image, uintProduct(rowsX, planes)); +- REALLOCARRAY(imlen, uintProduct(rowsX, planes)); + image = (unsigned char **) + malloc3(rows , planes , sizeof(unsigned char *)); + imlen = (int *) malloc3(rows , planes, sizeof(int)); } - else { -- image = (unsigned char **) -- realloc(image, -- rows * planes * -- sizeof(unsigned char *)); -- imlen = (int *) -- realloc(imlen, rows * planes * sizeof(int)); -- } ++ else { + overflow2(rows,planes); + image = (unsigned char **) + realloc2(image, rows * planes, @@ -630,29 +1016,198 @@ diff -urNp a/converter/ppm/pjtoppm.c b/converter/ppm/pjtoppm.c } if (image == NULL || imlen == NULL) pm_error("out of memory"); -@@ -212,8 +214,10 @@ main(argc, argv) - for (i = 0, c = 0; c < imlen[p + r * planes]; c += 2) - for (cmd = image[p + r * planes][c], - val = image[p + r * planes][c+1]; -- cmd >= 0 && i < newcols; cmd--, i++) +- if (plane >= planes) ++ if (p == planes) + pm_error("too many planes"); +- if (!colsIsSet) +- pm_error("missing width value"); +- +- cols = MAX(cols, val); +- imlen[row * planes + plane] = val; +- MALLOCARRAY(image[row * planes + plane], val); +- if (image[row * planes + plane] == NULL) ++ cols = cols > val ? cols : val; ++ imlen[r * planes + p] = val; ++ MALLOCARRAY(image[r * planes + p], val); ++ if (image[r * planes + p] == NULL) + pm_error("out of memory"); +- if (fread(image[row * planes + plane], 1, val, ifP) != val) ++ if (fread(image[r * planes + p], 1, val, fp) != val) + pm_error("short data"); + if (c == 'V') +- ++plane; ++ p++; + else { +- plane = 0; +- ++row; ++ p = 0; ++ r++; + } + break; + default: +@@ -205,7 +176,7 @@ main(int argc, const char ** argv) { + } + break; + case 'p': /* Position */ +- if (plane != 0) ++ if (p != 0) + pm_error("changed position in the middle of " + "transferring planes"); + switch (c) { +@@ -214,15 +185,15 @@ main(int argc, const char ** argv) { + break; + case 'Y': + if (buffer[0] == '+') +- val = row + val; ++ val = r + val; + if (buffer[0] == '-') +- val = row - val; +- for (; val > row; ++row) +- for (plane = 0; plane < 3; ++plane) { +- imlen[row * planes + plane] = 0; +- image[row * planes + plane] = NULL; ++ val = r - val; ++ for (; val > r; r++) ++ for (p = 0; p < 3; p++) { ++ imlen[r * planes + p] = 0; ++ image[r * planes + p] = NULL; + } +- row = val; ++ r = val; + break; + default: + pm_message("uninmplemented *%c%d%c", cmd, val, c); +@@ -231,86 +202,65 @@ main(int argc, const char ** argv) { + default: + pm_message("uninmplemented *%c%d%c", cmd, val, c); + break; +- } +- } /* case */ +- } /* switch */ ++ } ++ } + } +- pm_close(ifP); +- +- if (!modeIsSet) +- pm_error("Input does not contain a 'bM' transmission mode order"); +- +- rows = row; ++ pm_close(fp); ++ rows = r; + if (mode == 1) { +- unsigned int const newcols = 10240; +- /* It could not be larger than that! */ +- +- unsigned char * buf; +- unsigned int row; +- +- for (row = 0, cols = 0; row < rows; ++row) { +- unsigned int plane; +- if (image[row * planes] == NULL) ++ unsigned char *buf; ++ int newcols = 0; ++ newcols = 10240; /* It could not be larger that that! */ ++ cols = 0; ++ for (r = 0; r < rows; r++) { ++ if (image[r * planes] == NULL) + continue; +- for (plane = 0; plane < planes; ++plane) { +- unsigned int i; +- unsigned int col; ++ for (p = 0; p < planes; p++) { + MALLOCARRAY(buf, newcols); +- if (buf == NULL) ++ if (buf == NULL) + pm_error("out of memory"); +- for (i = 0, col = 0; +- col < imlen[plane + row * planes]; +- col += 2) +- for (cmd = image[plane + row * planes][col], +- val = image[plane + row * planes][col+1]; +- cmd >= 0 && i < newcols; cmd--, i++) ++ for (i = 0, c = 0; c < imlen[p + r * planes]; c += 2) ++ for (cmd = image[p + r * planes][c], ++ val = image[p + r * planes][c+1]; + cmd >= 0 && i < newcols; cmd--, i++) { buf[i] = val; +- cols = MAX(cols, i); +- free(image[plane + row * planes]); +- /* +- * This is less than what we have so it realloc should + overflow_add(i, 1); + } - cols = cols > i ? cols : i; - free(image[p + r * planes]); - /* -@@ -224,6 +228,7 @@ main(argc, argv) - image[p + r * planes] = (unsigned char *) realloc(buf, i); ++ cols = cols > i ? cols : i; ++ free(image[p + r * planes]); ++ /* ++ * This is less than what we have so it realloc should + * not return null. Even if it does, tough! We will + * lose a line, and probably die on the next line anyway + */ +- image[plane + row * planes] = realloc(buf, i); ++ image[p + r * planes] = (unsigned char *) realloc(buf, i); } } + overflow2(cols, 8); cols *= 8; } - -diff -urNp a/converter/ppm/ppmtoeyuv.c b/converter/ppm/ppmtoeyuv.c ---- a/converter/ppm/ppmtoeyuv.c 2018-07-23 15:03:21.404486731 +0200 -+++ b/converter/ppm/ppmtoeyuv.c 2018-07-23 15:05:03.071265747 +0200 +- ++ ++ + ppm_writeppminit(stdout, cols, rows, (pixval) 255, 0); + pixrow = ppm_allocrow(cols); +- +- for (row = 0; row < rows; ++row) { +- if (image[row * planes] == NULL) { +- unsigned int col; +- for (col = 0; col < cols; ++col) +- PPM_ASSIGN(pixrow[col], 0, 0, 0); ++ for (r = 0; r < rows; r++) { ++ if (image[r * planes] == NULL) { ++ for (c = 0; c < cols; c++) ++ PPM_ASSIGN(pixrow[c], 0, 0, 0); + continue; + } +- { +- unsigned int col; +- unsigned int cmd; +- for (cmd = 0, col = 0; col < cols; col += 8, ++cmd) { +- unsigned int i; +- for (i = 0; i < 8 && col + i < cols; ++i) { +- unsigned int plane; +- for (plane = 0; plane < planes; ++plane) +- if (mode == 0 && cmd >= imlen[row * planes + plane]) +- bf[plane] = 0; +- else +- bf[plane] = (image[row * planes + plane][cmd] & +- (1 << (7 - i))) ? 255 : 0; +- PPM_ASSIGN(pixrow[col + i], bf[0], bf[1], bf[2]); +- } ++ for (cmd = 0, c = 0; c < cols; c += 8, cmd++) ++ for (i = 0; i < 8 && c + i < cols; i++) { ++ for (p = 0; p < planes; p++) ++ if (mode == 0 && cmd >= imlen[r * planes + p]) ++ bf[p] = 0; ++ else ++ bf[p] = (image[r * planes + p][cmd] & ++ (1 << (7 - i))) ? 255 : 0; ++ PPM_ASSIGN(pixrow[c + i], bf[0], bf[1], bf[2]); + } +- } +- ppm_writeppmrow(stdout, pixrow, cols, 255, 0); ++ ppm_writeppmrow(stdout, pixrow, cols, (pixval) 255, 0); + } + pm_close(stdout); +- +- return 0; ++ exit(0); + } +- +- +- +diff -ruNp a/converter/ppm/ppmtoeyuv.c b/converter/ppm/ppmtoeyuv.c +--- a/converter/ppm/ppmtoeyuv.c 2021-06-02 15:53:59.845205755 +0200 ++++ b/converter/ppm/ppmtoeyuv.c 2021-06-02 20:23:21.821634361 +0200 @@ -114,6 +114,7 @@ create_multiplication_tables(const pixva int index; @@ -661,9 +1216,9 @@ diff -urNp a/converter/ppm/ppmtoeyuv.c b/converter/ppm/ppmtoeyuv.c MALLOCARRAY_NOFAIL(mult299 , maxval+1); MALLOCARRAY_NOFAIL(mult587 , maxval+1); MALLOCARRAY_NOFAIL(mult114 , maxval+1); -diff -urNp a/converter/ppm/ppmtolj.c b/converter/ppm/ppmtolj.c ---- a/converter/ppm/ppmtolj.c 2018-07-23 15:03:21.401486738 +0200 -+++ b/converter/ppm/ppmtolj.c 2018-07-23 15:05:03.071265747 +0200 +diff -ruNp a/converter/ppm/ppmtolj.c b/converter/ppm/ppmtolj.c +--- a/converter/ppm/ppmtolj.c 2021-06-02 15:53:59.846205765 +0200 ++++ b/converter/ppm/ppmtolj.c 2021-06-02 20:23:21.821634361 +0200 @@ -182,6 +182,7 @@ int main(int argc, char *argv[]) { ppm_readppminit( ifp, &cols, &rows, &maxval, &format ); pixelrow = ppm_allocrow( cols ); @@ -672,9 +1227,9 @@ diff -urNp a/converter/ppm/ppmtolj.c b/converter/ppm/ppmtolj.c obuf = (unsigned char *) pm_allocrow(cols * 3, sizeof(unsigned char)); cbuf = (unsigned char *) pm_allocrow(cols * 6, sizeof(unsigned char)); if (mode == C_TRANS_MODE_DELTA) -diff -urNp a/converter/ppm/ppmtomitsu.c b/converter/ppm/ppmtomitsu.c ---- a/converter/ppm/ppmtomitsu.c 2018-07-23 15:03:21.403486734 +0200 -+++ b/converter/ppm/ppmtomitsu.c 2018-07-23 15:05:03.071265747 +0200 +diff -ruNp a/converter/ppm/ppmtomitsu.c b/converter/ppm/ppmtomitsu.c +--- a/converter/ppm/ppmtomitsu.c 2021-06-02 15:53:59.846205765 +0200 ++++ b/converter/ppm/ppmtomitsu.c 2021-06-02 20:23:21.822634370 +0200 @@ -685,6 +685,8 @@ main(int argc, char * argv[]) { medias = MSize_User; @@ -684,21 +1239,858 @@ diff -urNp a/converter/ppm/ppmtomitsu.c b/converter/ppm/ppmtomitsu.c medias.maxcols *= 2; medias.maxrows *= 2; } -diff -urNp a/converter/ppm/ppmtopcx.c b/converter/ppm/ppmtopcx.c ---- a/converter/ppm/ppmtopcx.c 2018-07-23 15:03:21.403486734 +0200 -+++ b/converter/ppm/ppmtopcx.c 2018-07-23 15:05:03.071265747 +0200 -@@ -425,6 +425,8 @@ ppmTo16ColorPcx(pixel ** cons - else Planes = 1; +diff -ruNp a/converter/ppm/ppmtopcx.c b/converter/ppm/ppmtopcx.c +--- a/converter/ppm/ppmtopcx.c 2021-06-02 15:53:59.846205765 +0200 ++++ b/converter/ppm/ppmtopcx.c 2021-06-02 20:23:21.823634378 +0200 +@@ -31,13 +31,13 @@ + #define PCX_MAXVAL (pixval)255 + + +-struct CmdlineInfo { ++struct cmdlineInfo { + /* All the information the user supplied in the command line, + in a form easy for the program to use. + */ +- const char * inputFilespec; /* '-' if stdin */ ++ const char *inputFilespec; /* '-' if stdin */ + unsigned int truecolor; /* -24bit option */ +- unsigned int use8Bit; /* -8bit option */ ++ unsigned int use_8_bit; /* -8bit option */ + unsigned int planes; /* zero means minimum */ + unsigned int packed; + unsigned int verbose; +@@ -49,16 +49,16 @@ struct CmdlineInfo { + + + +-struct PcxCmapEntry { ++struct pcxCmapEntry { + unsigned char r; + unsigned char g; + unsigned char b; + }; + +-static struct PcxCmapEntry ++static struct pcxCmapEntry + pcxCmapEntryFromPixel(pixel const colorPixel) { + +- struct PcxCmapEntry retval; ++ struct pcxCmapEntry retval; + + retval.r = PPM_GETR(colorPixel); + retval.g = PPM_GETG(colorPixel); +@@ -70,8 +70,8 @@ pcxCmapEntryFromPixel(pixel const colorP + + + static void +-parseCommandLine(int argc, const char ** argv, +- struct CmdlineInfo * const cmdlineP) { ++parseCommandLine(int argc, char ** argv, ++ struct cmdlineInfo * const cmdlineP) { + /*---------------------------------------------------------------------------- + parse program command line described in Unix standard form by argc + and argv. Return the information in the options as *cmdlineP. +@@ -82,7 +82,7 @@ parseCommandLine(int argc, const char ** + Note that the strings we return are stored in the storage that + was passed to us as the argv array. We also trash *argv. + -----------------------------------------------------------------------------*/ +- optEntry * option_def; ++ optEntry *option_def; + /* Instructions to pm_optParseOptions3 on how to parse our options. + */ + optStruct3 opt; +@@ -97,7 +97,7 @@ parseCommandLine(int argc, const char ** + OPTENT3(0, "24bit", OPT_FLAG, NULL, + &cmdlineP->truecolor, 0); + OPTENT3(0, "8bit", OPT_FLAG, NULL, +- &cmdlineP->use8Bit, 0); ++ &cmdlineP->use_8_bit, 0); + OPTENT3(0, "planes", OPT_UINT, &cmdlineP->planes, + &planesSpec, 0); + OPTENT3(0, "packed", OPT_FLAG, NULL, +@@ -115,7 +115,7 @@ parseCommandLine(int argc, const char ** + opt.short_allowed = FALSE; /* We have no short (old-fashioned) options */ + opt.allowNegNum = FALSE; /* We have no parms that are negative numbers */ + +- pm_optParseOptions3( &argc, (char **)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) +@@ -141,7 +141,7 @@ parseCommandLine(int argc, const char ** + pm_error("-planes is meaningless with -packed."); + if (cmdlineP->truecolor) + pm_error("-planes is meaningless with -24bit"); +- if (cmdlineP->use8Bit) ++ if (cmdlineP->use_8_bit) + pm_error("-planes is meaningless with -8bit"); + } + +@@ -151,7 +151,7 @@ parseCommandLine(int argc, const char ** + if (!paletteSpec) + cmdlineP->palette = NULL; + +- if (cmdlineP->use8Bit && cmdlineP->truecolor) ++ if (cmdlineP->use_8_bit && cmdlineP->truecolor) + pm_error("You cannot specify both -8bit and -truecolor"); + + if (argc-1 < 1) +@@ -172,8 +172,8 @@ parseCommandLine(int argc, const char ** + * Write out a two-byte little-endian word to the PCX file + */ + static void +-putword(unsigned int const w, +- FILE * const fp) { ++Putword(int const w, ++ FILE * const fp) { + + int rc; + +@@ -189,13 +189,12 @@ putword(unsigned int const w, + * Write out a byte to the PCX file + */ + static void +-putbyte(unsigned int const b, +- FILE * const ofP) { ++Putbyte(int const b, ++ FILE * const fp) { + + int rc; + +- rc = fputc(b & 0xff, ofP); +- ++ rc = fputc(b & 0xff, fp); + if (rc == EOF) + pm_error("Error writing byte to output file."); + } +@@ -204,9 +203,9 @@ putbyte(unsigned int const b, + + static void + extractPlane(unsigned char * const rawrow, +- unsigned int const cols, ++ int const cols, + unsigned char * const buf, +- unsigned int const plane) { ++ int const plane) { + /*---------------------------------------------------------------------------- + From the image row 'rawrow', which is an array of 'cols' palette indices + (as unsigned 8 bit integers), extract plane number 'plane' and return +@@ -224,7 +223,9 @@ extractPlane(unsigned char * const rawro + + cp = buf; /* initial value */ + +- for (col = 0, cbit = 7, byteUnderConstruction = 0x00; col < cols; ++col) { ++ cbit = 7; ++ byteUnderConstruction = 0x00; ++ for (col = 0; col < cols; ++col) { + if (rawrow[col] & planeMask) + byteUnderConstruction |= (1 << cbit); + +@@ -246,17 +247,14 @@ extractPlane(unsigned char * const rawro + + + static void +-packBits(unsigned char * const rawrow, +- unsigned int const width, ++PackBits(unsigned char * const rawrow, ++ int const width, + unsigned char * const buf, +- unsigned int const bits) { ++ int const bits) { + +- unsigned int x; +- int i; +- int shift; ++ int x, i, shift; + +- shift = -1; +- i = -1; ++ shift = i = -1; + + for (x = 0; x < width; ++x) { + if (shift < 0) { +@@ -272,73 +270,71 @@ packBits(unsigned char * const rawrow, + + + static void +-writeHeader(FILE * const ofP, +- unsigned int const cols, +- unsigned int const rows, +- unsigned int const bitsPerPixel, +- unsigned int const planes, +- struct PcxCmapEntry const cmap16[], +- unsigned int const xPos, +- unsigned int const yPos) { +- +- unsigned int bytesPerLine; +- +- putbyte(PCX_MAGIC, ofP); /* .PCX magic number */ +- putbyte(0x05, ofP); /* PC Paintbrush version */ +- putbyte(0x01, ofP); /* .PCX run length encoding */ +- putbyte(bitsPerPixel, ofP); /* bits per pixel */ +- +- putword(xPos, ofP); /* x1 - image left */ +- putword(yPos, ofP); /* y1 - image top */ +- putword(xPos+cols-1, ofP); /* x2 - image right */ +- putword(yPos+rows-1, ofP); /* y2 - image bottom */ +- +- putword(cols, ofP); /* horizontal resolution */ +- putword(rows, ofP); /* vertical resolution */ ++write_header(FILE * const fp, ++ int const cols, ++ int const rows, ++ int const BitsPerPixel, ++ int const Planes, ++ struct pcxCmapEntry const cmap16[], ++ unsigned int const xPos, ++ unsigned int const yPos) { ++ ++ int i, BytesPerLine; ++ ++ Putbyte(PCX_MAGIC, fp); /* .PCX magic number */ ++ Putbyte(0x05, fp); /* PC Paintbrush version */ ++ Putbyte(0x01, fp); /* .PCX run length encoding */ ++ Putbyte(BitsPerPixel, fp); /* bits per pixel */ ++ ++ Putword(xPos, fp); /* x1 - image left */ ++ Putword(yPos, fp); /* y1 - image top */ ++ Putword(xPos+cols-1, fp); /* x2 - image right */ ++ Putword(yPos+rows-1, fp); /* y2 - image bottom */ ++ ++ Putword(cols, fp); /* horizontal resolution */ ++ Putword(rows, fp); /* vertical resolution */ + + /* Write out the Color Map for images with 16 colors or less */ +- if (cmap16) { +- unsigned int i; ++ if (cmap16) + for (i = 0; i < 16; ++i) { +- putbyte(cmap16[i].r, ofP); +- putbyte(cmap16[i].g, ofP); +- putbyte(cmap16[i].b, ofP); ++ Putbyte(cmap16[i].r, fp); ++ Putbyte(cmap16[i].g, fp); ++ Putbyte(cmap16[i].b, fp); + } +- } else { ++ else { + unsigned int i; + for (i = 0; i < 16; ++i) { +- putbyte(0, ofP); +- putbyte(0, ofP); +- putbyte(0, ofP); ++ Putbyte(0, fp); ++ Putbyte(0, fp); ++ Putbyte(0, fp); + } + } +- putbyte(0, ofP); /* reserved byte */ +- putbyte(planes, ofP); /* number of color planes */ ++ Putbyte(0, fp); /* reserved byte */ ++ Putbyte(Planes, fp); /* number of color planes */ + +- bytesPerLine = ((cols * bitsPerPixel) + 7) / 8; +- putword(bytesPerLine, ofP); /* number of bytes per scanline */ ++ BytesPerLine = ((cols * BitsPerPixel) + 7) / 8; ++ Putword(BytesPerLine, fp); /* number of bytes per scanline */ + +- putword(1, ofP); /* palette info */ ++ Putword(1, fp); /* palette info */ + + { + unsigned int i; + for (i = 0; i < 58; ++i) /* fill to end of header */ +- putbyte(0, ofP); ++ Putbyte(0, fp); + } + } + + + + static void +-pcxEncode(FILE * const ofP, ++PCXEncode(FILE * const fp, + const unsigned char * const buf, +- unsigned int const size) { ++ int const Size) { + +- const unsigned char * const end = buf + size; ++ const unsigned char * const end = buf + Size; + + const unsigned char * currentP; +- unsigned int previous; +- unsigned int count; ++ int previous, count; + + currentP = buf; + previous = *currentP++; +@@ -351,19 +347,19 @@ pcxEncode(FILE * const of + else { + if (count > 1 || (previous & 0xc0) == 0xc0) { + count |= 0xc0; +- putbyte ( count , ofP ); ++ Putbyte ( count , fp ); + } +- putbyte(previous, ofP); ++ Putbyte(previous, fp); + previous = c; +- count = 1; ++ count = 1; } } + + if (count > 1 || (previous & 0xc0) == 0xc0) { + count |= 0xc0; +- putbyte(count, ofP); ++ Putbyte ( count , fp ); + } +- putbyte(previous, ofP); ++ Putbyte(previous, fp); + } + + +@@ -390,46 +386,63 @@ indexOfColor(colorhash_table const cht, + + + static void +-writeRaster16Color(FILE * const ofP, +- pixel ** const pixels, +- unsigned int const cols, +- unsigned int const rows, +- unsigned int const planes, +- colorhash_table const cht, +- bool const packbits, +- unsigned int const bitsPerPixel) { +- +- unsigned int const bytesPerLine = ((cols * bitsPerPixel) + 7) / 8; +- +- unsigned char * indexRow; /* malloc'ed */ +- /* indexRow[x] is the palette index of the pixel at column x of +- the row currently being processed +- */ +- unsigned char * planesrow; /* malloc'ed */ +- /* This is the input for a single row to the compressor */ ++ppmTo16ColorPcx(pixel ** const pixels, ++ int const cols, ++ int const rows, ++ struct pcxCmapEntry const pcxcmap[], ++ int const colors, ++ colorhash_table const cht, ++ bool const packbits, ++ unsigned int const planesRequested, ++ unsigned int const xPos, ++ unsigned int const yPos) { + +- unsigned int row; ++ int Planes, BytesPerLine, BitsPerPixel; ++ unsigned char *indexRow; /* malloc'ed */ ++ /* indexRow[x] is the palette index of the pixel at column x of ++ the row currently being processed ++ */ ++ unsigned char *planesrow; /* malloc'ed */ ++ /* This is the input for a single row to the compressor */ ++ int row; + ++ if (packbits) { ++ Planes = 1; ++ if (colors > 4) BitsPerPixel = 4; ++ else if (colors > 2) BitsPerPixel = 2; ++ else BitsPerPixel = 1; ++ } else { ++ BitsPerPixel = 1; ++ if (planesRequested) ++ Planes = planesRequested; ++ else { ++ if (colors > 8) Planes = 4; ++ else if (colors > 4) Planes = 3; ++ else if (colors > 2) Planes = 2; ++ else Planes = 1; ++ } ++ } + overflow2(BitsPerPixel, cols); + overflow_add(BitsPerPixel * cols, 7); - BytesPerLine = ((cols * BitsPerPixel) + 7) / 8; ++ BytesPerLine = ((cols * BitsPerPixel) + 7) / 8; MALLOCARRAY_NOFAIL(indexRow, cols); - MALLOCARRAY_NOFAIL(planesrow, BytesPerLine); -diff -urNp a/converter/ppm/ppmtopict.c b/converter/ppm/ppmtopict.c ---- a/converter/ppm/ppmtopict.c 2018-07-23 15:03:21.402486736 +0200 -+++ b/converter/ppm/ppmtopict.c 2018-07-23 15:05:03.071265747 +0200 +- MALLOCARRAY(planesrow, bytesPerLine); +- +- if (!planesrow) +- pm_error("Failed to allocate buffer for a line of %u bytes", +- bytesPerLine); ++ MALLOCARRAY_NOFAIL(planesrow, BytesPerLine); + ++ write_header(stdout, cols, rows, BitsPerPixel, Planes, pcxcmap, ++ xPos, yPos); + for (row = 0; row < rows; ++row) { +- unsigned int col; ++ int col; + for (col = 0; col < cols; ++col) + indexRow[col] = indexOfColor(cht, pixels[row][col]); + + if (packbits) { +- packBits(indexRow, cols, planesrow, bitsPerPixel); +- pcxEncode(ofP, planesrow, bytesPerLine); ++ PackBits(indexRow, cols, planesrow, BitsPerPixel); ++ PCXEncode(stdout, planesrow, BytesPerLine); + } else { + unsigned int plane; +- for (plane = 0; plane < planes; ++plane) { ++ for (plane = 0; plane < Planes; ++plane) { + extractPlane(indexRow, cols, planesrow, plane); +- pcxEncode(stdout, planesrow, bytesPerLine); ++ PCXEncode(stdout, planesrow, BytesPerLine); + } + } + } +@@ -439,143 +452,84 @@ writeRaster16Color(FILE * const ofP, + + + +-static void +-ppmTo16ColorPcx(pixel ** const pixels, +- unsigned int const cols, +- unsigned int const rows, +- struct PcxCmapEntry const pcxcmap[], +- unsigned int const colorCt, +- colorhash_table const cht, +- bool const packbits, +- unsigned int const planesRequested, +- unsigned int const xPos, +- unsigned int const yPos) { +- +- unsigned int planes; +- unsigned int bitsPerPixel; +- +- if (packbits) { +- planes = 1; +- if (colorCt > 4) bitsPerPixel = 4; +- else if (colorCt > 2) bitsPerPixel = 2; +- else bitsPerPixel = 1; +- } else { +- bitsPerPixel = 1; +- if (planesRequested) +- planes = planesRequested; +- else { +- if (colorCt > 8) planes = 4; +- else if (colorCt > 4) planes = 3; +- else if (colorCt > 2) planes = 2; +- else planes = 1; +- } +- } +- +- writeHeader(stdout, cols, rows, bitsPerPixel, planes, pcxcmap, +- xPos, yPos); +- +- writeRaster16Color(stdout, pixels, cols, rows, planes, cht, packbits, +- bitsPerPixel); +-} +- +- +- + static void + ppmTo256ColorPcx(pixel ** const pixels, +- unsigned int const cols, +- unsigned int const rows, +- struct PcxCmapEntry const pcxcmap[], +- unsigned int const colorCt, ++ int const cols, ++ int const rows, ++ struct pcxCmapEntry const pcxcmap[], ++ int const colors, + colorhash_table const cht, + unsigned int const xPos, + unsigned int const yPos) { + +- unsigned char * rawrow; +- unsigned int row; +- +- MALLOCARRAY(rawrow, cols); ++ int row; ++ unsigned int i; ++ unsigned char *rawrow; + +- if (!rawrow) +- pm_error("Failed to allocate a buffer for %u columns", cols); ++ rawrow = (unsigned char *)pm_allocrow(cols, sizeof(unsigned char)); + + /* 8 bits per pixel, 1 plane */ +- writeHeader(stdout, cols, rows, 8, 1, NULL, xPos, yPos); ++ write_header(stdout, cols, rows, 8, 1, NULL, xPos, yPos); + for (row = 0; row < rows; ++row) { +- unsigned int col; ++ int col; + for (col = 0; col < cols; ++col) + rawrow[col] = indexOfColor(cht, pixels[row][col]); +- pcxEncode(stdout, rawrow, cols); +- ++ PCXEncode(stdout, rawrow, cols); + } +- putbyte(PCX_256_COLORS, stdout); +- +- { +- unsigned int i; +- +- for (i = 0; i < MAXCOLORS; ++i) { +- putbyte(pcxcmap[i].r, stdout); +- putbyte(pcxcmap[i].g, stdout); +- putbyte(pcxcmap[i].b, stdout); +- } ++ Putbyte(PCX_256_COLORS, stdout); ++ for (i = 0; i < MAXCOLORS; ++i) { ++ Putbyte(pcxcmap[i].r, stdout); ++ Putbyte(pcxcmap[i].g, stdout); ++ Putbyte(pcxcmap[i].b, stdout); + } +- free(rawrow); ++ pm_freerow((void*)rawrow); + } + + + + static void + ppmToTruecolorPcx(pixel ** const pixels, +- unsigned int const cols, +- unsigned int const rows, ++ int const cols, ++ int const rows, + pixval const maxval, + unsigned int const xPos, + unsigned int const yPos) { + +- unsigned char * redrow; +- unsigned char * grnrow; +- unsigned char * blurow; +- unsigned int row; ++ unsigned char *redrow, *greenrow, *bluerow; ++ int col, row; + +- MALLOCARRAY(redrow, cols); +- MALLOCARRAY(grnrow, cols); +- MALLOCARRAY(blurow, cols); +- +- if (!redrow || !grnrow || !blurow) +- pm_error("Unable to allocate buffer for a row of %u pixels", cols); ++ redrow = (unsigned char *)pm_allocrow(cols, sizeof(unsigned char)); ++ greenrow = (unsigned char *)pm_allocrow(cols, sizeof(unsigned char)); ++ bluerow = (unsigned char *)pm_allocrow(cols, sizeof(unsigned char)); + + /* 8 bits per pixel, 3 planes */ +- writeHeader(stdout, cols, rows, 8, 3, NULL, xPos, yPos); +- +- for (row = 0; row < rows; ++row) { +- pixel * const pixrow = pixels[row]; +- +- unsigned int col; +- +- for (col = 0; col < cols; ++col) { +- pixel const pix = pixrow[col]; +- +- if (maxval != PCX_MAXVAL) { +- redrow[col] = (long)PPM_GETR(pix) * PCX_MAXVAL / maxval; +- grnrow[col] = (long)PPM_GETG(pix) * PCX_MAXVAL / maxval; +- blurow[col] = (long)PPM_GETB(pix) * PCX_MAXVAL / maxval; +- } else { +- redrow[col] = PPM_GETR(pix); +- grnrow[col] = PPM_GETG(pix); +- blurow[col] = PPM_GETB(pix); ++ write_header(stdout, cols, rows, 8, 3, NULL, xPos, yPos); ++ for( row = 0; row < rows; row++ ) { ++ register pixel *pP = pixels[row]; ++ for( col = 0; col < cols; col++, pP++ ) { ++ if( maxval != PCX_MAXVAL ) { ++ redrow[col] = (long)PPM_GETR(*pP) * PCX_MAXVAL / maxval; ++ greenrow[col] = (long)PPM_GETG(*pP) * PCX_MAXVAL / maxval; ++ bluerow[col] = (long)PPM_GETB(*pP) * PCX_MAXVAL / maxval; ++ } ++ else { ++ redrow[col] = PPM_GETR(*pP); ++ greenrow[col] = PPM_GETG(*pP); ++ bluerow[col] = PPM_GETB(*pP); + } + } +- pcxEncode(stdout, redrow, cols); +- pcxEncode(stdout, grnrow, cols); +- pcxEncode(stdout, blurow, cols); ++ PCXEncode(stdout, redrow, cols); ++ PCXEncode(stdout, greenrow, cols); ++ PCXEncode(stdout, bluerow, cols); + } +- free(blurow); +- free(grnrow); +- free(redrow); ++ pm_freerow((void*)bluerow); ++ pm_freerow((void*)greenrow); ++ pm_freerow((void*)redrow); + } + + + +-static const struct PcxCmapEntry ++static const struct pcxCmapEntry + stdPalette[] = { + { 0, 0, 0 }, + { 0, 0, 170 }, +@@ -653,19 +607,20 @@ putPcxColorInHash(colorhash_table const + + + static void +-generateStandardPalette(struct PcxCmapEntry ** const pcxcmapP, ++generateStandardPalette(struct pcxCmapEntry ** const pcxcmapP, + pixval const maxval, + colorhash_table * const chtP, +- unsigned int * const colorsP) { ++ int * const colorsP) { + + unsigned int const stdPaletteSize = 16; +- +- unsigned int colorIndex; +- struct PcxCmapEntry * pcxcmap; +- colorhash_table cht; ++ unsigned int colorIndex; ++ struct pcxCmapEntry * pcxcmap; ++ colorhash_table cht; + + MALLOCARRAY_NOFAIL(pcxcmap, MAXCOLORS); + ++ *pcxcmapP = pcxcmap; ++ + cht = ppm_alloccolorhash(); + + for (colorIndex = 0; colorIndex < stdPaletteSize; ++colorIndex) { +@@ -692,7 +647,6 @@ generateStandardPalette(struct PcxCmapEn + pcxcmap[colorIndex].b = 0; + } + +- *pcxcmapP = pcxcmap; + *chtP = cht; + *colorsP = stdPaletteSize; + } +@@ -721,10 +675,11 @@ readPpmPalette(const char * const pale + *paletteSizeP, MAXCOLORS); + + { +- unsigned int j; +- unsigned int row; +- for (row = 0, j = 0; row < rows; ++row) { +- unsigned int col; ++ int j; ++ int row; ++ j = 0; /* initial value */ ++ for (row = 0; row < rows; ++row) { ++ int col; + for (col = 0; col < cols; ++col) + (*ppmPaletteP)[j++] = pixels[row][col]; + } +@@ -735,16 +690,16 @@ readPpmPalette(const char * const pale + + + static void +-readPaletteFromFile(struct PcxCmapEntry ** const pcxcmapP, ++readPaletteFromFile(struct pcxCmapEntry ** const pcxcmapP, + const char * const paletteFileName, + pixval const maxval, + colorhash_table * const chtP, +- unsigned int * const colorsP) { ++ int * const colorsP) { + + unsigned int colorIndex; + pixel ppmPalette[MAXCOLORS]; + unsigned int paletteSize; +- struct PcxCmapEntry * pcxcmap; ++ struct pcxCmapEntry * pcxcmap; + colorhash_table cht; + + readPpmPalette(paletteFileName, &ppmPalette, &paletteSize); +@@ -777,7 +732,7 @@ readPaletteFromFile(struct PcxCmapEntry + + static void + moveBlackToIndex0(colorhist_vector const chv, +- unsigned int const colorCt) { ++ int const colors) { + /*---------------------------------------------------------------------------- + If black is in the palette, make it at Index 0. + -----------------------------------------------------------------------------*/ +@@ -789,7 +744,7 @@ moveBlackToIndex0(colorhist_vector const + + blackPresent = FALSE; /* initial assumption */ + +- for (i = 0; i < colorCt; ++i) ++ for (i = 0; i < colors; ++i) + if (PPM_EQUAL(chv[i].color, blackPixel)) + blackPresent = TRUE; + +@@ -798,11 +753,10 @@ moveBlackToIndex0(colorhist_vector const + beginning of the table and if the color is already elsewhere in + the table, removes it. + */ +- int colorCt2; +- +- colorCt2 = colorCt; +- ppm_addtocolorhist(chv, &colorCt2, MAXCOLORS, &blackPixel, 0, 0); +- assert(colorCt2 == colorCt); ++ int colors2; ++ colors2 = colors; ++ ppm_addtocolorhist(chv, &colors2, MAXCOLORS, &blackPixel, 0, 0); ++ assert(colors2 == colors); + } + } + +@@ -810,12 +764,12 @@ moveBlackToIndex0(colorhist_vector const + + static void + makePcxColormapFromImage(pixel ** const pixels, +- unsigned int const cols, +- unsigned int const rows, ++ int const cols, ++ int const rows, + pixval const maxval, +- struct PcxCmapEntry ** const pcxcmapP, ++ struct pcxCmapEntry ** const pcxcmapP, + colorhash_table * const chtP, +- unsigned int * const colorCtP, ++ int * const colorsP, + bool * const tooManyColorsP) { + /*---------------------------------------------------------------------------- + Make a colormap (palette) for the PCX header that can be used +@@ -831,29 +785,29 @@ makePcxColormapFromImage(pixel ** + Iff there are too many colors to do that (i.e. more than 256), + return *tooManyColorsP == TRUE. + -----------------------------------------------------------------------------*/ +- int colorCt; ++ int colors; + colorhist_vector chv; + + pm_message("computing colormap..."); + +- chv = ppm_computecolorhist(pixels, cols, rows, MAXCOLORS, &colorCt); ++ chv = ppm_computecolorhist(pixels, cols, rows, MAXCOLORS, &colors); + if (chv == NULL) + *tooManyColorsP = TRUE; + else { +- unsigned int i; +- struct PcxCmapEntry * pcxcmap; ++ int i; ++ struct pcxCmapEntry * pcxcmap; + + *tooManyColorsP = FALSE; + +- pm_message("%d colors found", colorCt); ++ pm_message("%d colors found", colors); + +- moveBlackToIndex0(chv, colorCt); ++ moveBlackToIndex0(chv, colors); + + MALLOCARRAY_NOFAIL(pcxcmap, MAXCOLORS); + + *pcxcmapP = pcxcmap; + +- for (i = 0; i < colorCt; ++i) { ++ for (i = 0; i < colors; ++i) { + pixel p; + + PPM_DEPTH(p, chv[i].color, maxval, PCX_MAXVAL); +@@ -870,9 +824,9 @@ makePcxColormapFromImage(pixel ** + pcxcmap[i].b = 0; + } + +- *chtP = ppm_colorhisttocolorhash(chv, colorCt); ++ *chtP = ppm_colorhisttocolorhash(chv, colors); + +- *colorCtP = colorCt; ++ *colorsP = colors; + + ppm_freecolorhist(chv); + } +@@ -882,43 +836,43 @@ makePcxColormapFromImage(pixel ** + + static void + ppmToPalettePcx(pixel ** const pixels, +- unsigned int const cols, +- unsigned int const rows, ++ int const cols, ++ int const rows, + pixval const maxval, + unsigned int const xPos, + unsigned int const yPos, +- struct PcxCmapEntry const pcxcmap[], ++ struct pcxCmapEntry const pcxcmap[], + colorhash_table const cht, +- unsigned int const colorCt, ++ int const colors, + bool const packbits, + unsigned int const planes, +- bool const use8Bit) { ++ bool const use_8_bit) { + + /* convert image */ +- if (colorCt <= 16 && !use8Bit ) +- ppmTo16ColorPcx(pixels, cols, rows, pcxcmap, colorCt, cht, ++ if( colors <= 16 && !use_8_bit ) ++ ppmTo16ColorPcx(pixels, cols, rows, pcxcmap, colors, cht, + packbits, planes, xPos, yPos); + else +- ppmTo256ColorPcx(pixels, cols, rows, pcxcmap, colorCt, cht, ++ ppmTo256ColorPcx(pixels, cols, rows, pcxcmap, colors, cht, + xPos, yPos); + } + + + + int +-main(int argc, const char *argv[]) { ++main(int argc, char *argv[]) { + +- struct CmdlineInfo cmdline; +- FILE * ifP; ++ struct cmdlineInfo cmdline; ++ FILE* ifP; + int rows, cols; + pixval maxval; + pixel **pixels; +- struct PcxCmapEntry * pcxcmap; ++ struct pcxCmapEntry * pcxcmap; + colorhash_table cht; + bool truecolor; +- unsigned int colorCt; ++ int colors; + +- pm_proginit(&argc, argv); ++ ppm_init(&argc, argv); + + parseCommandLine(argc, argv, &cmdline); + +@@ -931,15 +885,15 @@ main(int argc, const char *argv[]) { + else { + if (cmdline.stdpalette) { + truecolor = FALSE; +- generateStandardPalette(&pcxcmap, maxval, &cht, &colorCt); ++ generateStandardPalette(&pcxcmap, maxval, &cht, &colors); + } else if (cmdline.palette) { + truecolor = FALSE; + readPaletteFromFile(&pcxcmap, cmdline.palette, maxval, +- &cht, &colorCt); ++ &cht, &colors); + } else { + bool tooManyColors; + makePcxColormapFromImage(pixels, cols, rows, maxval, +- &pcxcmap, &cht, &colorCt, ++ &pcxcmap, &cht, &colors, + &tooManyColors); + + if (tooManyColors) { +@@ -958,8 +912,8 @@ main(int argc, const char *argv[]) { + else { + ppmToPalettePcx(pixels, cols, rows, maxval, + cmdline.xpos, cmdline.ypos, +- pcxcmap, cht, colorCt, cmdline.packed, +- cmdline.planes, cmdline.use8Bit); ++ pcxcmap, cht, colors, cmdline.packed, ++ cmdline.planes, cmdline.use_8_bit); + + ppm_freecolorhash(cht); + free(pcxcmap); +diff -ruNp a/converter/ppm/ppmtopict.c b/converter/ppm/ppmtopict.c +--- a/converter/ppm/ppmtopict.c 2021-06-02 15:53:59.846205765 +0200 ++++ b/converter/ppm/ppmtopict.c 2021-06-02 20:23:21.824634387 +0200 @@ -450,6 +450,8 @@ main(int argc, const char ** argv) { putShort(stdout, 0); /* mode */ @@ -708,9 +2100,9 @@ diff -urNp a/converter/ppm/ppmtopict.c b/converter/ppm/ppmtopict.c outBuf = malloc((unsigned)(cols+cols/MAX_COUNT+1)); for (row = 0, oc = 0; row < rows; ++row) { unsigned int rowSize; -diff -urNp a/converter/ppm/ppmtopj.c b/converter/ppm/ppmtopj.c ---- a/converter/ppm/ppmtopj.c 2018-07-23 15:03:21.405486729 +0200 -+++ b/converter/ppm/ppmtopj.c 2018-07-23 15:05:03.071265747 +0200 +diff -ruNp a/converter/ppm/ppmtopj.c b/converter/ppm/ppmtopj.c +--- a/converter/ppm/ppmtopj.c 2021-06-02 15:53:59.845205755 +0200 ++++ b/converter/ppm/ppmtopj.c 2021-06-02 20:23:21.824634387 +0200 @@ -179,6 +179,7 @@ char *argv[]; pixels = ppm_readppm( ifp, &cols, &rows, &maxval ); @@ -719,9 +2111,9 @@ diff -urNp a/converter/ppm/ppmtopj.c b/converter/ppm/ppmtopj.c obuf = (unsigned char *) pm_allocrow(cols, sizeof(unsigned char)); cbuf = (unsigned char *) pm_allocrow(cols * 2, sizeof(unsigned char)); -diff -urNp a/converter/ppm/ppmtopjxl.c b/converter/ppm/ppmtopjxl.c ---- a/converter/ppm/ppmtopjxl.c 2018-07-23 15:03:21.405486729 +0200 -+++ b/converter/ppm/ppmtopjxl.c 2018-07-23 15:05:03.071265747 +0200 +diff -ruNp a/converter/ppm/ppmtopjxl.c b/converter/ppm/ppmtopjxl.c +--- a/converter/ppm/ppmtopjxl.c 2021-06-02 15:53:59.845205755 +0200 ++++ b/converter/ppm/ppmtopjxl.c 2021-06-02 20:23:21.825634396 +0200 @@ -267,6 +267,9 @@ main(int argc, const char * argv[]) { if (maxval > PCL_MAXVAL) pm_error("color range too large; reduce with ppmcscale"); @@ -755,9 +2147,9 @@ diff -urNp a/converter/ppm/ppmtopjxl.c b/converter/ppm/ppmtopjxl.c inrow = (char *)malloc((unsigned)bpp); outrow = (char *)malloc((unsigned)bpp*2); runcnt = (signed char *)malloc((unsigned)bpp); -diff -urNp a/converter/ppm/ppmtowinicon.c b/converter/ppm/ppmtowinicon.c ---- a/converter/ppm/ppmtowinicon.c 2018-07-23 15:03:21.405486729 +0200 -+++ b/converter/ppm/ppmtowinicon.c 2018-07-23 15:05:03.071265747 +0200 +diff -ruNp a/converter/ppm/ppmtowinicon.c b/converter/ppm/ppmtowinicon.c +--- a/converter/ppm/ppmtowinicon.c 2021-06-02 15:53:59.845205755 +0200 ++++ b/converter/ppm/ppmtowinicon.c 2021-06-02 20:23:21.825634396 +0200 @@ -12,6 +12,7 @@ #include @@ -803,9 +2195,9 @@ diff -urNp a/converter/ppm/ppmtowinicon.c b/converter/ppm/ppmtowinicon.c xorBitmap->size + andBitmap->size + 40 + (4 * entry->color_count); if (verbose) pm_message("entry->size_in_bytes = %d + %d + %d = %d", -diff -urNp a/converter/ppm/ppmtoxpm.c b/converter/ppm/ppmtoxpm.c ---- a/converter/ppm/ppmtoxpm.c 2018-07-23 15:03:21.405486729 +0200 -+++ b/converter/ppm/ppmtoxpm.c 2018-07-23 15:05:03.071265747 +0200 +diff -ruNp a/converter/ppm/ppmtoxpm.c b/converter/ppm/ppmtoxpm.c +--- a/converter/ppm/ppmtoxpm.c 2021-06-02 15:53:59.846205765 +0200 ++++ b/converter/ppm/ppmtoxpm.c 2021-06-02 20:23:21.826634405 +0200 @@ -198,6 +198,7 @@ genNumstr(unsigned int const input, int unsigned int i; @@ -822,9 +2214,9 @@ diff -urNp a/converter/ppm/ppmtoxpm.c b/converter/ppm/ppmtoxpm.c MALLOCARRAY(cmap, cmapSize); if (cmapP == NULL) pm_error("Out of memory allocating %u bytes for a color map.", -diff -urNp a/converter/ppm/qrttoppm.c b/converter/ppm/qrttoppm.c ---- a/converter/ppm/qrttoppm.c 2018-07-23 15:03:21.406486727 +0200 -+++ b/converter/ppm/qrttoppm.c 2018-07-23 15:05:03.071265747 +0200 +diff -ruNp a/converter/ppm/qrttoppm.c b/converter/ppm/qrttoppm.c +--- a/converter/ppm/qrttoppm.c 2021-06-02 15:53:59.846205765 +0200 ++++ b/converter/ppm/qrttoppm.c 2021-06-02 20:23:21.826634405 +0200 @@ -46,7 +46,7 @@ main( argc, argv ) ppm_writeppminit( stdout, cols, rows, maxval, 0 ); @@ -834,9 +2226,9 @@ diff -urNp a/converter/ppm/qrttoppm.c b/converter/ppm/qrttoppm.c if ( buf == (unsigned char *) 0 ) pm_error( "out of memory" ); -diff -urNp a/converter/ppm/sldtoppm.c b/converter/ppm/sldtoppm.c ---- a/converter/ppm/sldtoppm.c 2018-07-23 15:03:21.401486738 +0200 -+++ b/converter/ppm/sldtoppm.c 2018-07-23 15:05:03.071265747 +0200 +diff -ruNp a/converter/ppm/sldtoppm.c b/converter/ppm/sldtoppm.c +--- a/converter/ppm/sldtoppm.c 2021-06-02 15:53:59.845205755 +0200 ++++ b/converter/ppm/sldtoppm.c 2021-06-02 20:23:21.827634413 +0200 @@ -154,127 +154,85 @@ vscale(int * const px, @@ -1044,34 +2436,100 @@ diff -urNp a/converter/ppm/sldtoppm.c b/converter/ppm/sldtoppm.c pixels = ppm_allocarray(pixcols = ixdots + 1, pixrows = iydots + 1); PPM_ASSIGN(rgbcolor, 0, 0, 0); ppmd_filledrectangle(pixels, pixcols, pixrows, pixmaxval, 0, 0, -diff -urNp a/converter/ppm/ximtoppm.c b/converter/ppm/ximtoppm.c ---- a/converter/ppm/ximtoppm.c 2018-07-23 15:03:21.402486736 +0200 -+++ b/converter/ppm/ximtoppm.c 2018-07-23 15:05:03.071265747 +0200 -@@ -118,6 +118,7 @@ ReadXimHeader(FILE * const in_fp, +diff -ruNp a/converter/ppm/ximtoppm.c b/converter/ppm/ximtoppm.c +--- a/converter/ppm/ximtoppm.c 2021-06-02 15:53:59.846205765 +0200 ++++ b/converter/ppm/ximtoppm.c 2021-06-02 20:23:21.828634422 +0200 +@@ -22,9 +22,7 @@ + #include "shhopt.h" + #include "nstring.h" + +- +- +-struct CmdlineInfo { ++struct cmdlineInfo { + /* All the information the user supplied in the command line, + in a form easy for the program to use. + */ +@@ -36,8 +34,8 @@ struct CmdlineInfo { + + + static void +-parseCommandLine(int argc, const char ** argv, +- struct CmdlineInfo *cmdlineP) { ++parseCommandLine(int argc, char ** argv, ++ struct cmdlineInfo *cmdlineP) { + /*---------------------------------------------------------------------------- + Note that many of the strings that this function returns in the + *cmdlineP structure are actually in the supplied argv array. And +@@ -59,7 +57,7 @@ parseCommandLine(int argc, const char ** + opt.short_allowed = FALSE; /* We have no short (old-fashioned) options */ + opt.allowNegNum = FALSE; /* We have no parms that are negative numbers */ + +- pm_optParseOptions3(&argc, (char**)argv, opt, sizeof(opt), 0); ++ pm_optParseOptions3(&argc, argv, opt, sizeof(opt), 0); + /* Uses and sets argc, argv, and all of *cmdlineP. */ + + if (!alphaoutSpec) +@@ -102,11 +100,6 @@ ReadXimHeader(FILE * const in_fp, + pm_message("ReadXimHeader: unable to read file header" ); + return(0); + } +- /* Force broken ASCIIZ strings to at least be valid ASCIIZ */ +- a_head.author [sizeof(a_head.author) - 1] = '\0'; +- a_head.date [sizeof(a_head.date) - 1] = '\0'; +- a_head.program[sizeof(a_head.program) - 1] = '\0'; +- + if (atoi(a_head.header_size) != sizeof(ImageHeader)) { + pm_message("ReadXimHeader: header size mismatch" ); + return(0); +@@ -120,15 +113,39 @@ ReadXimHeader(FILE * const in_fp, + header->ncolors = atoi(a_head.num_colors); + header->nchannels = atoi(a_head.num_channels); + header->bytes_per_line = atoi(a_head.bytes_per_line); +-#if 0 +- header->npics = atoi(a_head.num_pictures); +-#endif ++/* header->npics = atoi(a_head.num_pictures); ++*/ header->bits_channel = atoi(a_head.bits_per_channel); header->alpha_flag = atoi(a_head.alpha_channel); - if (strlen(a_head.author)) { +- header->author = pm_strdup(a_head.author); +- header->date = pm_strdup(a_head.date); +- header->program = pm_strdup(a_head.program); +- ++ if (strlen(a_head.author)) { + overflow_add(strlen(a_head.author),1); - if (!(header->author = calloc((unsigned int)strlen(a_head.author)+1, - 1))) { - pm_message("ReadXimHeader: can't calloc author string" ); -@@ -127,6 +128,7 @@ ReadXimHeader(FILE * const in_fp, - strncpy(header->author, a_head.author, strlen(a_head.author)); - } - if (strlen(a_head.date)) { ++ if (!(header->author = calloc((unsigned int)strlen(a_head.author)+1, ++ 1))) { ++ pm_message("ReadXimHeader: can't calloc author string" ); ++ return(0); ++ } ++ header->width = atoi(a_head.image_width); ++ strncpy(header->author, a_head.author, strlen(a_head.author)); ++ } ++ if (strlen(a_head.date)) { + overflow_add(strlen(a_head.date),1); - if (!(header->date =calloc((unsigned int)strlen(a_head.date)+1,1))){ - pm_message("ReadXimHeader: can't calloc date string" ); - return(0); -@@ -135,6 +137,7 @@ ReadXimHeader(FILE * const in_fp, - strncpy(header->date, a_head.date, strlen(a_head.date)); - } - if (strlen(a_head.program)) { ++ if (!(header->date =calloc((unsigned int)strlen(a_head.date)+1,1))){ ++ pm_message("ReadXimHeader: can't calloc date string" ); ++ return(0); ++ } ++ header->width = atoi(a_head.image_width); ++ strncpy(header->date, a_head.date, strlen(a_head.date)); ++ } ++ if (strlen(a_head.program)) { + overflow_add(strlen(a_head.program),1); - if (!(header->program = calloc( - (unsigned int)strlen(a_head.program) + 1, 1))) { - pm_message("ReadXimHeader: can't calloc program string" ); -@@ -161,6 +164,7 @@ ReadXimHeader(FILE * const in_fp, ++ if (!(header->program = calloc( ++ (unsigned int)strlen(a_head.program) + 1, 1))) { ++ pm_message("ReadXimHeader: can't calloc program string" ); ++ return(0); ++ } ++ header->width = atoi(a_head.image_width); ++ strncpy(header->program, a_head.program,strlen(a_head.program)); ++ } + /* Do double checking for backwards compatibility */ + if (header->npics == 0) + header->npics = 1; +@@ -147,6 +164,7 @@ ReadXimHeader(FILE * const in_fp, if (header->nchannels == 3 && header->bits_channel == 8) header->ncolors = 0; else if (header->nchannels == 1 && header->bits_channel == 8) { @@ -1079,10 +2537,69 @@ diff -urNp a/converter/ppm/ximtoppm.c b/converter/ppm/ximtoppm.c header->colors = (Color *)calloc((unsigned int)header->ncolors, sizeof(Color)); if (header->colors == NULL) { -diff -urNp a/editor/pamcut.c b/editor/pamcut.c ---- a/editor/pamcut.c 2018-07-23 15:03:21.362486822 +0200 -+++ b/editor/pamcut.c 2018-07-23 15:05:03.046265802 +0200 -@@ -655,6 +655,8 @@ cutOneImage(FILE * const ifP +@@ -197,8 +215,7 @@ ReadImageChannel(FILE * const in + } + /* return to the beginning of the next image's buffer */ + if (fseek(infp, marker, 0) == -1) { +- pm_message("ReadImageChannel: can't fseek to location " +- "in image buffer"); ++ pm_message("ReadImageChannel: can't fseek to location in image buffer" ); + return(0); + } + free((char *)line); +@@ -307,26 +324,28 @@ ReadXimImage(FILE * const in_fp, + ***********************************************************************/ + + static int +-ReadXim(FILE * const in_fp, +- XimImage * const xim) { +- ++ReadXim(in_fp, xim) ++ FILE *in_fp; ++ XimImage *xim; ++{ + if (!ReadXimHeader(in_fp, xim)) { + pm_message("can't read xim header" ); +- return 0; +- } else if (!ReadXimImage(in_fp, xim)) { ++ return(0); ++ } ++ if (!ReadXimImage(in_fp, xim)) { + pm_message("can't read xim data" ); +- return 0; +- } else +- return 1; ++ return(0); ++ } ++ return(1); + } + + + + int +-main(int argc, +- const char **argv) { ++main(int argc, ++ char *argv[]) { + +- struct CmdlineInfo cmdline; ++ struct cmdlineInfo cmdline; + FILE *ifP, *imageout_file, *alpha_file; + XimImage xim; + pixel *pixelrow, colormap[256]; +@@ -338,7 +357,7 @@ main(int argc, + pixval maxval; + bool success; + +- pm_proginit(&argc, argv); ++ ppm_init(&argc, argv); + + parseCommandLine(argc, argv, &cmdline); + +diff -ruNp a/editor/pamcut.c b/editor/pamcut.c +--- a/editor/pamcut.c 2021-06-02 15:53:59.809205409 +0200 ++++ b/editor/pamcut.c 2021-06-02 20:23:21.828634422 +0200 +@@ -799,6 +799,8 @@ cutOneImage(FILE * const ifP outpam = inpam; /* Initial value -- most fields should be same */ outpam.file = ofP; @@ -1091,9 +2608,9 @@ diff -urNp a/editor/pamcut.c b/editor/pamcut.c outpam.width = rightcol - leftcol + 1; outpam.height = bottomrow - toprow + 1; -diff -urNp a/editor/pnmgamma.c b/editor/pnmgamma.c ---- a/editor/pnmgamma.c 2018-07-23 15:03:21.364486818 +0200 -+++ b/editor/pnmgamma.c 2018-07-23 15:05:03.046265802 +0200 +diff -ruNp a/editor/pnmgamma.c b/editor/pnmgamma.c +--- a/editor/pnmgamma.c 2021-06-02 15:53:59.805205371 +0200 ++++ b/editor/pnmgamma.c 2021-06-02 20:23:21.829634431 +0200 @@ -596,6 +596,7 @@ createGammaTables(enum transferFunction xelval ** const btableP) { @@ -1102,9 +2619,9 @@ diff -urNp a/editor/pnmgamma.c b/editor/pnmgamma.c MALLOCARRAY(*rtableP, maxval+1); MALLOCARRAY(*gtableP, maxval+1); MALLOCARRAY(*btableP, maxval+1); -diff -urNp a/editor/pnmhisteq.c b/editor/pnmhisteq.c ---- a/editor/pnmhisteq.c 2018-07-23 15:03:21.362486822 +0200 -+++ b/editor/pnmhisteq.c 2018-07-23 15:05:03.046265802 +0200 +diff -ruNp a/editor/pnmhisteq.c b/editor/pnmhisteq.c +--- a/editor/pnmhisteq.c 2021-06-02 15:53:59.800205323 +0200 ++++ b/editor/pnmhisteq.c 2021-06-02 20:23:21.829634431 +0200 @@ -107,6 +107,7 @@ computeLuminosityHistogram(xel * const * unsigned int pixelCount; unsigned int * lumahist; @@ -1113,21 +2630,11 @@ diff -urNp a/editor/pnmhisteq.c b/editor/pnmhisteq.c MALLOCARRAY(lumahist, maxval + 1); if (lumahist == NULL) pm_error("Out of storage allocating array for %u histogram elements", -diff -urNp a/editor/pnmindex.csh b/editor/pnmindex.csh ---- a/editor/pnmindex.csh 2018-07-23 15:03:21.369486807 +0200 -+++ b/editor/pnmindex.csh 2018-07-23 15:05:03.046265802 +0200 -@@ -1,5 +1,7 @@ - #!/bin/csh -f - # -+echo "Unsafe code, needs debugging, do not ship" -+exit 1 - # pnmindex - build a visual index of a bunch of anymaps - # - # Copyright (C) 1991 by Jef Poskanzer. -diff -urNp a/editor/pnmpad.c b/editor/pnmpad.c ---- a/editor/pnmpad.c 2018-07-23 15:03:21.362486822 +0200 -+++ b/editor/pnmpad.c 2018-07-23 15:05:03.046265802 +0200 -@@ -634,6 +634,8 @@ main(int argc, const char ** argv) { +diff --git a/editor/pnmpad.c b/editor/pnmpad.c +index 9fa9f9e..6b98204 100644 +--- a/editor/pnmpad.c ++++ b/editor/pnmpad.c +@@ -654,6 +654,8 @@ main(int argc, const char ** argv) { computePadSizes(cmdline, cols, rows, &lpad, &rpad, &tpad, &bpad); @@ -1135,11 +2642,11 @@ diff -urNp a/editor/pnmpad.c b/editor/pnmpad.c + overflow_add(cols + lpad, rpad); newcols = cols + lpad + rpad; - if (PNM_FORMAT_TYPE(format) == PBM_TYPE) -diff -urNp a/editor/pnmremap.c b/editor/pnmremap.c ---- a/editor/pnmremap.c 2018-07-23 15:03:21.363486820 +0200 -+++ b/editor/pnmremap.c 2018-07-23 15:09:26.462101272 +0200 -@@ -468,6 +468,7 @@ fserr_init(struct pam * const pamP, + if (cmdline.reportonly) +diff -ruNp a/editor/pnmremap.c b/editor/pnmremap.c +--- a/editor/pnmremap.c 2021-06-02 15:53:59.809205409 +0200 ++++ b/editor/pnmremap.c 2021-06-02 20:23:21.830634440 +0200 +@@ -470,6 +470,7 @@ fserr_init(struct pam * const pamP, unsigned int const fserrSize = pamP->width + 2; @@ -1147,7 +2654,7 @@ diff -urNp a/editor/pnmremap.c b/editor/pnmremap.c fserrP->width = pamP->width; MALLOCARRAY(fserrP->thiserr, pamP->depth); -@@ -506,6 +507,7 @@ floydInitRow(struct pam * const pamP, +@@ -508,6 +509,7 @@ floydInitRow(struct pam * const pamP, unsigned int col; @@ -1155,23 +2662,9 @@ diff -urNp a/editor/pnmremap.c b/editor/pnmremap.c for (col = 0; col < pamP->width + 2; ++col) { unsigned int plane; for (plane = 0; plane < pamP->depth; ++plane) -diff -urNp a/editor/pnmremap.c.rej b/editor/pnmremap.c.rej ---- a/editor/pnmremap.c.rej 1970-01-01 01:00:00.000000000 +0100 -+++ b/editor/pnmremap.c.rej 2018-07-23 15:05:03.046265802 +0200 -@@ -0,0 +1,10 @@ -+--- editor/pnmremap.c -++++ editor/pnmremap.c -+@@ -506,6 +507,7 @@ floydInitRow(struct pam * const pamP, struct Fserr * const fserrP) { -+ -+ int col; -+ -++ overflow_add(pamP->width, 2); -+ for (col = 0; col < pamP->width + 2; ++col) { -+ unsigned int plane; -+ for (plane = 0; plane < pamP->depth; ++plane) -diff -urNp a/editor/pnmscalefixed.c b/editor/pnmscalefixed.c ---- a/editor/pnmscalefixed.c 2018-07-23 15:03:21.365486816 +0200 -+++ b/editor/pnmscalefixed.c 2018-07-23 15:05:03.046265802 +0200 +diff -ruNp a/editor/pnmscalefixed.c b/editor/pnmscalefixed.c +--- a/editor/pnmscalefixed.c 2021-06-02 15:53:59.800205323 +0200 ++++ b/editor/pnmscalefixed.c 2021-06-02 20:23:21.830634440 +0200 @@ -214,6 +214,7 @@ compute_output_dimensions(const struct c const int rows, const int cols, int * newrowsP, int * newcolsP) { @@ -1199,9 +2692,9 @@ diff -urNp a/editor/pnmscalefixed.c b/editor/pnmscalefixed.c sxscale = SCALE * newcols / cols; syscale = SCALE * newrows / rows; -diff -urNp a/editor/ppmdither.c b/editor/ppmdither.c ---- a/editor/ppmdither.c 2018-07-23 15:03:21.363486820 +0200 -+++ b/editor/ppmdither.c 2018-07-23 15:05:03.046265802 +0200 +diff -ruNp a/editor/ppmdither.c b/editor/ppmdither.c +--- a/editor/ppmdither.c 2021-06-02 15:53:59.803205352 +0200 ++++ b/editor/ppmdither.c 2021-06-02 20:23:21.831634448 +0200 @@ -356,6 +356,11 @@ dithMatrix(unsigned int const dithPower) (dithDim * sizeof(*dithMat)) + /* pointers */ (dithDim * dithDim * sizeof(**dithMat)); /* data */ @@ -1214,9 +2707,9 @@ diff -urNp a/editor/ppmdither.c b/editor/ppmdither.c dithMat = malloc(dithMatSize); if (dithMat == NULL) -diff -urNp a/editor/specialty/pamoil.c b/editor/specialty/pamoil.c ---- a/editor/specialty/pamoil.c 2018-07-23 15:03:21.366486814 +0200 -+++ b/editor/specialty/pamoil.c 2018-07-23 15:05:03.045265804 +0200 +diff -ruNp a/editor/specialty/pamoil.c b/editor/specialty/pamoil.c +--- a/editor/specialty/pamoil.c 2021-06-02 15:53:59.817205486 +0200 ++++ b/editor/specialty/pamoil.c 2021-06-02 20:23:21.831634448 +0200 @@ -112,6 +112,7 @@ main(int argc, char *argv[] ) { tuples = pnm_readpam(ifp, &inpam, PAM_STRUCT_SIZE(tuple_type)); pm_close(ifp); @@ -1225,9 +2718,9 @@ diff -urNp a/editor/specialty/pamoil.c b/editor/specialty/pamoil.c MALLOCARRAY(hist, inpam.maxval + 1); if (hist == NULL) pm_error("Unable to allocate memory for histogram."); -diff -urNp a/lib/libpam.c b/lib/libpam.c ---- a/lib/libpam.c 2018-07-23 15:03:21.373486799 +0200 -+++ b/lib/libpam.c 2018-07-23 15:05:03.050265793 +0200 +diff -ruNp a/lib/libpam.c b/lib/libpam.c +--- a/lib/libpam.c 2021-06-02 15:53:59.867205967 +0200 ++++ b/lib/libpam.c 2021-06-02 20:23:21.832634457 +0200 @@ -225,7 +225,8 @@ allocPamRow(const struct pam * const pam unsigned int const bytesPerTuple = allocationDepth(pamP) * sizeof(sample); tuple * tuplerow; @@ -1238,23 +2731,21 @@ diff -urNp a/lib/libpam.c b/lib/libpam.c if (tuplerow != NULL) { /* Now we initialize the pointers to the individual tuples -diff -urNp a/lib/libpammap.c b/lib/libpammap.c ---- a/lib/libpammap.c 2018-07-23 15:03:21.373486799 +0200 -+++ b/lib/libpammap.c 2018-07-23 15:05:03.050265793 +0200 -@@ -108,7 +108,9 @@ allocTupleIntListItem(struct pam * const +diff -ruNp a/lib/libpammap.c b/lib/libpammap.c +--- a/lib/libpammap.c 2021-06-02 15:53:59.867205967 +0200 ++++ b/lib/libpammap.c 2021-06-02 20:23:00.658449503 +0200 +@@ -108,6 +108,8 @@ allocTupleIntListItem(struct pam * const */ struct tupleint_list_item * retval; -- unsigned int const size = + overflow2(pamP->depth, sizeof(sample)); + overflow_add(sizeof(*retval)-sizeof(retval->tupleint.tuple), pamP->depth*sizeof(sample)); -+ unsigned int const size = - sizeof(*retval) - sizeof(retval->tupleint.tuple) + unsigned int const size = + sizeof(*retval) - sizeof(retval->tupleint.tuple) + pamP->depth * sizeof(sample); - -diff -urNp a/lib/libpm.c b/lib/libpm.c ---- a/lib/libpm.c 2018-07-23 15:03:21.372486801 +0200 -+++ b/lib/libpm.c 2018-07-23 15:05:03.050265793 +0200 +diff -ruNp a/lib/libpm.c b/lib/libpm.c +--- a/lib/libpm.c 2021-06-02 15:53:59.867205967 +0200 ++++ b/lib/libpm.c 2021-06-02 20:23:21.832634457 +0200 @@ -888,5 +888,53 @@ pm_parse_height(const char * const arg) return height; } @@ -1309,10 +2800,10 @@ diff -urNp a/lib/libpm.c b/lib/libpm.c + return realloc(a, b*c); +} -diff -urNp a/lib/pm.h b/lib/pm.h ---- a/lib/pm.h 2018-07-23 15:03:21.376486792 +0200 -+++ b/lib/pm.h 2018-07-23 15:05:03.050265793 +0200 -@@ -435,5 +435,12 @@ pm_parse_height(const char * const arg); +diff -ruNp a/lib/pm.h b/lib/pm.h +--- a/lib/pm.h 2021-06-02 15:53:59.866205957 +0200 ++++ b/lib/pm.h 2021-06-02 20:23:21.833634466 +0200 +@@ -442,5 +442,12 @@ pm_parse_height(const char * const arg); } #endif @@ -1325,23 +2816,67 @@ diff -urNp a/lib/pm.h b/lib/pm.h + #endif -diff -urNp a/other/pnmcolormap.c b/other/pnmcolormap.c ---- a/other/pnmcolormap.c 2018-07-23 15:03:21.362486822 +0200 -+++ b/other/pnmcolormap.c 2018-07-23 15:05:03.041265812 +0200 -@@ -840,6 +840,7 @@ colormapToSquare(struct pam * const pamP +diff -ruNp a/other/pnmcolormap.c b/other/pnmcolormap.c +--- a/other/pnmcolormap.c 2021-06-02 15:53:59.882206111 +0200 ++++ b/other/pnmcolormap.c 2021-06-02 20:23:21.833634466 +0200 +@@ -1002,6 +1002,7 @@ colormapToSquare(struct pam * const pamP pamP->width = intsqrt; - else + else pamP->width = intsqrt + 1; + overflow_add(intsqrt, 1); } { unsigned int const intQuotient = colormap.size / pamP->width; -diff -urNp a/urt/rle_addhist.c b/urt/rle_addhist.c ---- a/urt/rle_addhist.c 2018-07-23 15:03:21.419486699 +0200 -+++ b/urt/rle_addhist.c 2018-07-23 15:05:03.072265745 +0200 -@@ -70,13 +70,18 @@ rle_addhist(char * argv[], +diff --git a/urt/Runput.c b/urt/Runput.c +index 1a7f2f7..de2737b 100644 +--- a/urt/Runput.c ++++ b/urt/Runput.c +@@ -202,6 +202,7 @@ RunSetup(rle_hdr * the_hdr) + if ( the_hdr->background != 0 ) + { + int i; ++ overflow_add(the_hdr->ncolors, 1); + rle_pixel *background = + (rle_pixel *)malloc( (unsigned)(the_hdr->ncolors + 1) ); + int *bg_color; +@@ -224,7 +225,7 @@ RunSetup(rle_hdr * the_hdr) + /* Big-endian machines are harder */ + int i, nmap = (1 << the_hdr->cmaplen) * + the_hdr->ncmap; +- char *h_cmap = (char *)malloc( nmap * 2 ); ++ char *h_cmap = (char *)malloc2( nmap, 2 ); + if ( h_cmap == NULL ) + { + fprintf( stderr, +diff --git a/urt/rle.h b/urt/rle.h +index 1e7ddd0..df45dd9 100644 +--- a/urt/rle.h ++++ b/urt/rle.h +@@ -152,6 +152,17 @@ rle_hdr /* End of typedef. */ + */ + extern rle_hdr rle_dflt_hdr; + ++/* ++ * Provided by pm library ++ */ ++ ++extern void overflow_add(int, int); ++#define overflow2(a,b) __overflow2(a,b) ++extern void __overflow2(int, int); ++extern void overflow3(int, int, int); ++extern void *malloc2(int, int); ++extern void *malloc3(int, int, int); ++extern void *realloc2(void *, int, int); + + /* Declare RLE library routines. */ + +diff --git a/urt/rle_addhist.c b/urt/rle_addhist.c +index 45c3dbf..ef13973 100644 +--- a/urt/rle_addhist.c ++++ b/urt/rle_addhist.c +@@ -70,13 +70,19 @@ rle_addhist(char * argv[], return; - + length = 0; - for (i = 0; argv[i]; ++i) + for (i = 0; argv[i]; ++i) { @@ -1353,17 +2888,17 @@ diff -urNp a/urt/rle_addhist.c b/urt/rle_addhist.c time(&temp); timedate = ctime(&temp); length += strlen(timedate); /* length of date and time in ASCII. */ -- + + overflow_add(strlen(padding), 4); + overflow_add(strlen(histoire), strlen(padding) + 4); + overflow_add(length, strlen(histoire) + strlen(padding) + 4); length += strlen(padding) + 3 + strlen(histoire) + 1; /* length of padding, "on " and length of history name plus "="*/ if (in_hdr) /* if we are interested in the old comments... */ -@@ -84,8 +89,10 @@ rle_addhist(char * argv[], +@@ -84,8 +90,10 @@ rle_addhist(char * argv[], else old = NULL; - + - if (old && *old) + if (old && *old) { + overflow_add(length, strlen(old)); @@ -1372,10 +2907,11 @@ diff -urNp a/urt/rle_addhist.c b/urt/rle_addhist.c ++length; /*Cater for the null. */ -diff -urNp a/urt/rle_getrow.c b/urt/rle_getrow.c ---- a/urt/rle_getrow.c 2018-07-23 15:03:21.418486701 +0200 -+++ b/urt/rle_getrow.c 2018-07-23 15:05:03.072265745 +0200 -@@ -160,6 +160,7 @@ rle_get_setup(rle_hdr * const the_hdr) { +diff --git a/urt/rle_getrow.c b/urt/rle_getrow.c +index a24870a..0ba62c3 100644 +--- a/urt/rle_getrow.c ++++ b/urt/rle_getrow.c +@@ -164,6 +164,7 @@ rle_get_setup(rle_hdr * const the_hdr) { char * cp; VAXSHORT(comlen, infile); /* get comment length */ @@ -1383,163 +2919,39 @@ diff -urNp a/urt/rle_getrow.c b/urt/rle_getrow.c evenlen = (comlen + 1) & ~1; /* make it even */ if (evenlen) { MALLOCARRAY(comment_buf, evenlen); -diff -urNp a/urt/rle.h b/urt/rle.h ---- a/urt/rle.h 2018-07-23 15:03:21.418486701 +0200 -+++ b/urt/rle.h 2018-07-23 15:05:03.072265745 +0200 -@@ -161,6 +161,17 @@ rle_hdr /* End of typedef. * - */ - extern rle_hdr rle_dflt_hdr; - -+/* -+ * Provided by pm library -+ */ -+ -+extern void overflow_add(int, int); -+#define overflow2(a,b) __overflow2(a,b) -+extern void __overflow2(int, int); -+extern void overflow3(int, int, int); -+extern void *malloc2(int, int); -+extern void *malloc3(int, int, int); -+extern void *realloc2(void *, int, int); - - /* Declare RLE library routines. */ - -diff -urNp a/urt/rle_hdr.c b/urt/rle_hdr.c ---- a/urt/rle_hdr.c 2018-07-23 15:03:21.418486701 +0200 -+++ b/urt/rle_hdr.c 2018-07-23 15:05:03.072265745 +0200 -@@ -80,7 +80,10 @@ int img_num; - /* Fill in with copies of the strings. */ - if ( the_hdr->cmd != pgmname ) - { -- char *tmp = (char *)malloc( strlen( pgmname ) + 1 ); -+ char *tmp; -+ -+ overflow_add(strlen(pgmname), 1); -+ tmp = malloc( strlen(pgmname) + 1 ); - RLE_CHECK_ALLOC( pgmname, tmp, 0 ); - strcpy( tmp, pgmname ); - the_hdr->cmd = tmp; -@@ -88,8 +91,10 @@ int img_num; - - if ( the_hdr->file_name != fname ) - { -- char *tmp = (char *)malloc( strlen( fname ) + 1 ); -- RLE_CHECK_ALLOC( pgmname, tmp, 0 ); -+ char *tmp; -+ overflow_add(strlen(fname), 1); -+ tmp = malloc( strlen( fname ) + 1 ); -+ RLE_CHECK_ALLOC( pgmname, tmp, 0 ); - strcpy( tmp, fname ); - the_hdr->file_name = tmp; - } -@@ -153,6 +158,7 @@ rle_hdr *from_hdr, *to_hdr; - if ( to_hdr->bg_color ) - { - int size = to_hdr->ncolors * sizeof(int); -+ overflow2(to_hdr->ncolors, sizeof(int)); - to_hdr->bg_color = (int *)malloc( size ); - RLE_CHECK_ALLOC( to_hdr->cmd, to_hdr->bg_color, "background color" ); - memcpy( to_hdr->bg_color, from_hdr->bg_color, size ); -@@ -161,7 +167,7 @@ rle_hdr *from_hdr, *to_hdr; - if ( to_hdr->cmap ) - { - int size = to_hdr->ncmap * (1 << to_hdr->cmaplen) * sizeof(rle_map); -- to_hdr->cmap = (rle_map *)malloc( size ); -+ to_hdr->cmap = (rle_map *)malloc3( to_hdr->ncmap, 1<cmaplen, sizeof(rle_map)); - RLE_CHECK_ALLOC( to_hdr->cmd, to_hdr->cmap, "color map" ); - memcpy( to_hdr->cmap, from_hdr->cmap, size ); - } -@@ -173,12 +179,17 @@ rle_hdr *from_hdr, *to_hdr; - { - int size = 0; - CONST_DECL char **cp; -- for ( cp=to_hdr->comments; *cp; cp++ ) -+ for ( cp=to_hdr->comments; *cp; cp++ ) -+ { -+ overflow_add(size, 1); - size++; /* Count the comments. */ +diff --git a/urt/rle_hdr.c b/urt/rle_hdr.c +index 8ceaa9e..4c13037 100644 +--- a/urt/rle_hdr.c ++++ b/urt/rle_hdr.c +@@ -148,7 +148,7 @@ rle_hdr_cp(rle_hdr * const fromHdrP, + if (toHdrP->cmap) { + size_t const size = + toHdrP->ncmap * (1 << toHdrP->cmaplen) * sizeof(rle_map); +- toHdrP->cmap = malloc(size); ++ toHdrP->cmap = malloc3(toHdrP->ncmap, 1<cmaplen, sizeof(rle_map)); + if (!toHdrP->cmap) + pm_error("Failed to allocate memory for %u color maps " + "of length %u", toHdrP->ncmap, 1 << toHdrP->cmaplen); +@@ -164,11 +164,16 @@ rle_hdr_cp(rle_hdr * const fromHdrP, + + /* Count the comments. */ + for (cp = toHdrP->comments, size = 0; *cp; ++cp) ++ { ++ overflow_add(size,1); + ++size; + } - /* Check if there are really any comments. */ - if ( size ) - { -+ overflow_add(size, 1); - size++; /* Copy the NULL pointer, too. */ -+ overflow2(size, sizeof(char *)); - size *= sizeof(char *); - to_hdr->comments = (CONST_DECL char **)malloc( size ); - RLE_CHECK_ALLOC( to_hdr->cmd, to_hdr->comments, "comments" ); -diff -urNp a/urt/rle_open_f.c b/urt/rle_open_f.c ---- a/urt/rle_open_f.c 2018-07-23 15:03:21.418486701 +0200 -+++ b/urt/rle_open_f.c 2018-07-23 15:05:03.072265745 +0200 -@@ -163,65 +163,7 @@ dealWithSubprocess(const char * const f - FILE ** const fpP, - bool * const noSubprocessP, - const char ** const errorP) { -- --#ifdef NO_OPEN_PIPES - *noSubprocessP = TRUE; --#else -- const char *cp; -- -- reapChildren(catchingChildrenP, pids); -- -- /* Real file, not stdin or stdout. If name ends in ".Z", -- * pipe from/to un/compress (depending on r/w mode). -- * -- * If it starts with "|", popen that command. -- */ -- -- cp = file_name + strlen(file_name) - 2; -- /* Pipe case. */ -- if (file_name[0] == '|') { -- pid_t thepid; /* PID from my_popen */ -- -- *noSubprocessP = FALSE; -- -- *fpP = my_popen(file_name + 1, mode, &thepid); -- if (*fpP == NULL) -- *errorP = "%s: can't invoke <<%s>> for %s: "; -- else { -- /* One more child to catch, eventually. */ -- if (*catchingChildrenP < MAX_CHILDREN) -- pids[(*catchingChildrenP)++] = thepid; -- } -- } else if (cp > file_name && *cp == '.' && *(cp + 1) == 'Z' ) { -- /* Compress case. */ -- pid_t thepid; /* PID from my_popen. */ -- const char * command; -- -- *noSubprocessP = FALSE; -- -- if (*mode == 'w') -- pm_asprintf(&command, "compress > %s", file_name); -- else if (*mode == 'a') -- pm_asprintf(&command, "compress >> %s", file_name); -- else -- pm_asprintf(&command, "compress -d < %s", file_name); -- -- *fpP = my_popen(command, mode, &thepid); -- -- if (*fpP == NULL) -- *errorP = "%s: can't invoke 'compress' program, " -- "trying to open %s for %s"; -- else { -- /* One more child to catch, eventually. */ -- if (*catchingChildrenP < MAX_CHILDREN) -- pids[(*catchingChildrenP)++] = thepid; -- } -- pm_strfree(command); -- } else { -- *noSubprocessP = TRUE; -- *errorP = NULL; -- } --#endif - } - -diff -urNp a/urt/rle_putcom.c b/urt/rle_putcom.c ---- a/urt/rle_putcom.c 2018-07-23 15:03:21.418486701 +0200 -+++ b/urt/rle_putcom.c 2018-07-23 15:05:03.072265745 +0200 + /* Check if there are really any comments. */ + if (size > 0) { ++ overflow_add(size,1); + ++size; /* Copy the NULL pointer, too. */ ++ overflow2(size, sizeof(char *)); + size *= sizeof(char *); + toHdrP->comments = malloc(size); + if (!toHdrP->comments) +diff -ruNp a/urt/rle_putcom.c b/urt/rle_putcom.c +--- a/urt/rle_putcom.c 2021-06-02 15:53:59.824205554 +0200 ++++ b/urt/rle_putcom.c 2021-06-02 20:25:22.620707940 +0200 @@ -98,12 +98,14 @@ rle_putcom(const char * const value, const char * v; const char ** old_comments; @@ -1556,46 +2968,3 @@ diff -urNp a/urt/rle_putcom.c b/urt/rle_putcom.c /* Not found */ /* Can't realloc because somebody else might be pointing to this * comments block. Of course, if this were true, then the -diff -urNp a/urt/Runput.c b/urt/Runput.c ---- a/urt/Runput.c 2018-07-23 15:03:21.418486701 +0200 -+++ b/urt/Runput.c 2018-07-23 15:05:03.072265745 +0200 -@@ -202,10 +202,11 @@ RunSetup(rle_hdr * the_hdr) - if ( the_hdr->background != 0 ) - { - register int i; -- register rle_pixel *background = -- (rle_pixel *)malloc( (unsigned)(the_hdr->ncolors + 1) ); -- register int *bg_color; -- /* -+ register rle_pixel *background; -+ register int *bg_color; -+ -+ overflow_add(the_hdr->ncolors,1); -+ background = (rle_pixel *)malloc( (unsigned)(the_hdr->ncolors + 1) ); /* - * If even number of bg color bytes, put out one more to get to - * 16 bit boundary. - */ -@@ -224,7 +225,7 @@ RunSetup(rle_hdr * the_hdr) - /* Big-endian machines are harder */ - register int i, nmap = (1 << the_hdr->cmaplen) * - the_hdr->ncmap; -- register char *h_cmap = (char *)malloc( nmap * 2 ); -+ register char *h_cmap = (char *)malloc2( nmap, 2 ); - if ( h_cmap == NULL ) - { - fprintf( stderr, -diff -urNp a/urt/scanargs.c b/urt/scanargs.c ---- a/urt/scanargs.c 2018-07-23 15:03:21.418486701 +0200 -+++ b/urt/scanargs.c 2018-07-23 15:05:03.072265745 +0200 -@@ -62,9 +62,8 @@ typedef int *ptr; - /* - * Storage allocation macros - */ --#define NEW( type, cnt ) (type *) malloc( (cnt) * sizeof( type ) ) --#define RENEW( type, ptr, cnt ) (type *) realloc( ptr, (cnt) * sizeof( type ) ) -- -+#define NEW( type, cnt ) (type *) malloc2( (cnt) , sizeof( type ) ) -+#define RENEW( type, ptr, cnt ) (type *) realloc2( ptr, (cnt), sizeof( type ) ) - static CONST_DECL char * prformat( CONST_DECL char *, int ); - static int isnum( CONST_DECL char *, int, int ); - static int _do_scanargs( int argc, char **argv, CONST_DECL char *format, diff --git a/netpbm-security-scripts.patch b/netpbm-security-scripts.patch index 0ba822ad1ff6b5355ec0b792b10d7b55715d0b1e..2730e5bed22980185675e765956c0ed9fc54a74e 100644 --- a/netpbm-security-scripts.patch +++ b/netpbm-security-scripts.patch @@ -1,267 +1,119 @@ -diff --git a/editor/ppmfade b/editor/ppmfade -index dcd7bf2..5091651 100755 ---- a/editor/ppmfade -+++ b/editor/ppmfade -@@ -40,6 +40,7 @@ exec perl -w -x -S -- "$0" "$@" - # - ############################################################################## - use strict; -+use File::Temp "tempdir"; - - sub doVersionHack($) { - my ($argvR) = @_; -@@ -149,20 +150,26 @@ if ($first_file ne "undefined") { - - print("Frames are " . $width . "W x " . $height . "H\n"); - -+# -+# We create a tmp-directory right here -+# -+my $tmpdir = tempdir("ppmfade.XXXXXX", CLEANUP => 1); -+ -+ - if ($first_file eq "undefined") { - print "Fading from black to "; -- system("ppmmake \\#000 $width $height >junk1$$.ppm"); -+ system("ppmmake \\#000 $width $height >$tmpdir/junk1$$.ppm"); - } else { - print "Fading from $first_file to "; -- system("cp", $first_file, "junk1$$.ppm"); -+ system("cp", $first_file, "$tmpdir/junk1$$.ppm"); - } - - if ($last_file eq "undefined") { - print "black.\n"; -- system("ppmmake \\#000 $width $height >junk2$$.ppm"); -+ system("ppmmake \\#000 $width $height >$tmpdir/junk2$$.ppm"); - } else { - print "$last_file\n"; -- system("cp", $last_file, "junk2$$.ppm"); -+ system("cp", $last_file, "$tmpdir/junk2$$.ppm"); - } - - # -@@ -170,14 +177,14 @@ if ($last_file eq "undefined") { - # - - # Here's what our temporary files are: --# junk1$$.ppm: The original (fade-from) image --# junk2$$.ppm: The target (fade-from) image --# junk3$$.ppm: The frame of the fade for the current iteration of the --# the for loop. --# junk1a$$.ppm: If the fade involves a ppmmix sequence from one intermediate --# image to another, this is the first frame of that --# sequence. --# junk2a$$.ppm: This is the last frame of the above-mentioned ppmmix sequence -+# $tmpdir/junk1$$.ppm: The original (fade-from) image -+# $tmpdir/junk2$$.ppm: The target (fade-from) image -+# $tmpdir/junk3$$.ppm: The frame of the fade for the current iteration of the -+# the for loop. -+# $tmpdir/junk1a$$.ppm: If the fade involves a ppmmix sequence from one intermediate -+# image to another, this is the first frame of that -+# sequence. -+# $tmpdir/junk2a$$.ppm: This is the last frame of the above-mentioned ppmmix sequence - - my $i; # Frame number - for ($i = 1; $i <= $nframes; $i++) { -@@ -185,147 +192,147 @@ for ($i = 1; $i <= $nframes; $i++) { - if ($mode eq $SPREAD) { - if ($i <= 10) { - my $n = $spline20[$i] * 100; -- system("ppmspread $n junk1$$.ppm >junk3$$.ppm"); -+ system("ppmspread $n $tmpdir/junk1$$.ppm >$tmpdir/junk3$$.ppm"); - } elsif ($i <= 20) { - my $n; +diff -urNp a/editor/ppmfade b/editor/ppmfade +--- a/editor/ppmfade 2022-06-28 07:58:59.195317750 +0200 ++++ b/editor/ppmfade 2022-06-28 08:04:56.070643056 +0200 +@@ -215,84 +215,84 @@ for ($i = 1; $i <= $nframes; $i++) { $n = $spline20[$i] * 100; -- system("ppmspread $n junk1$$.ppm >junk1a$$.ppm"); -+ system("ppmspread $n $tmpdir/junk1$$.ppm >$tmpdir/junk1a$$.ppm"); - $n = (1-$spline20[$i-10]) * 100; -- system("ppmspread $n junk2$$.ppm >junk2a$$.ppm"); -+ system("ppmspread $n $tmpdir/junk2$$.ppm >$tmpdir/junk2a$$.ppm"); - $n = $spline10[$i-10]; -- system("ppmmix $n junk1a$$.ppm junk2a$$.ppm >junk3$$.ppm"); -+ system("ppmmix $n $tmpdir/junk1a$$.ppm $tmpdir/junk2a$$.ppm >$tmpdir/junk3$$.ppm"); - } else { - my $n = (1-$spline20[$i-10])*100; -- system("ppmspread $n junk2$$.ppm >junk3$$.ppm"); -+ system("ppmspread $n $tmpdir/junk2$$.ppm >$tmpdir/junk3$$.ppm"); - } - } elsif ($mode eq $SHIFT) { - if ($i <= 10) { - my $n = $spline20[$i] * 100; -- system("ppmshift $n junk1$$.ppm >junk3$$.ppm"); -+ system("ppmshift $n $tmpdir/junk1$$.ppm >$tmpdir/junk3$$.ppm"); - } elsif ($i <= 20) { - my $n; - $n = $spline20[$i] * 100; -- system("ppmshift $n junk1$$.ppm >junk1a$$.ppm"); -+ system("ppmshift $n $tmpdir/junk1$$.ppm >$tmpdir/junk1a$$.ppm"); + system("ppmshift $n $tmpdir/junk1.ppm >$tmpdir/junk1a.ppm"); $n = (1-$spline20[$i-10])*100; -- system("ppmshift $n junk2$$.ppm >junk2a$$.ppm"); -+ system("ppmshift $n $tmpdir/junk2$$.ppm >$tmpdir/junk2a$$.ppm"); +- system("ppmshift $n junk2.ppm >junk2a.ppm"); ++ system("ppmshift $n $tmpdir/junk2.ppm >$tmpdir/junk2a.ppm"); $n = $spline10[$i-10]; -- system("ppmmix $n junk1a$$.ppm junk2a$$.ppm >junk3$$.ppm"); -+ system("ppmmix $n $tmpdir/junk1a$$.ppm $tmpdir/junk2a$$.ppm >$tmpdir/junk3$$.ppm"); +- system("ppmmix $n junk1a.ppm junk2a.ppm >junk3.ppm"); ++ system("ppmmix $n $tmpdir/junk1a.ppm $tmpdir/junk2a.ppm >$tmpdir/junk3.ppm"); } else { my $n = (1-$spline20[$i-10]) * 100; -- system("ppmshift $n junk2$$.ppm >junk3$$.ppm"); -+ system("ppmshift $n $tmpdir/junk2$$.ppm >$tmpdir/junk3$$.ppm"); +- system("ppmshift $n junk2.ppm >junk3.ppm"); ++ system("ppmshift $n $tmpdir/junk2.ppm >$tmpdir/junk3.ppm"); } } elsif ($mode eq $RELIEF) { if ($i == 1) { -- system("ppmrelief junk1$$.ppm >junk1r$$.ppm"); -+ system("ppmrelief $tmpdir/junk1$$.ppm >$tmpdir/junk1r$$.ppm"); +- system("ppmrelief junk1.ppm >junk1r.ppm"); ++ system("ppmrelief $tmpdir/junk1.ppm >$tmpdir/junk1r.ppm"); } if ($i <= 10) { my $n = $spline10[$i]; -- system("ppmmix $n junk1$$.ppm junk1r$$.ppm >junk3$$.ppm"); -+ system("ppmmix $n $tmpdir/junk1$$.ppm $tmpdir/junk1r$$.ppm >$tmpdir/junk3$$.ppm"); +- system("ppmmix $n junk1.ppm junk1r.ppm >junk3.ppm"); ++ system("ppmmix $n $tmpdir/junk1.ppm $tmpdir/junk1r.ppm >$tmpdir/junk3.ppm"); } elsif ($i <= 20) { my $n = $spline10[$i-10]; -- system("ppmmix $n junk1r$$.ppm junk2r$$.ppm >junk3$$.ppm"); -+ system("ppmmix $n $tmpdir/junk1r$$.ppm $tmpdir/junk2r$$.ppm >$tmpdir/junk3$$.ppm"); +- system("ppmmix $n junk1r.ppm junk2r.ppm >junk3.ppm"); ++ system("ppmmix $n $tmpdir/junk1r.ppm $tmpdir/junk2r.ppm >$tmpdir/junk3.ppm"); } else { my $n = $spline10[$i-20]; -- system("ppmmix $n junk2r$$.ppm junk2$$.ppm >junk3$$.ppm"); -+ system("ppmmix $n $tmpdir/junk2r$$.ppm $tmpdir/junk2$$.ppm >$tmpdir/junk3$$.ppm"); +- system("ppmmix $n junk2r.ppm junk2.ppm >junk3.ppm"); ++ system("ppmmix $n $tmpdir/junk2r.ppm $tmpdir/junk2.ppm >$tmpdir/junk3.ppm"); } if ($i == 10) { -- system("ppmrelief junk2$$.ppm >junk2r$$.ppm"); -+ system("ppmrelief $tmpdir/junk2$$.ppm >$tmpdir/junk2r$$.ppm"); +- system("ppmrelief junk2.ppm >junk2r.ppm"); ++ system("ppmrelief $tmpdir/junk2.ppm >$tmpdir/junk2r.ppm"); } } elsif ($mode eq $OIL) { if ($i == 1) { -- system("ppmtopgm junk1$$.ppm | pgmoil >junko$$.ppm"); -- system("rgb3toppm junko$$.ppm junko$$.ppm junko$$.ppm " . -- ">junk1o$$.ppm"); -+ system("ppmtopgm $tmpdir/junk1$$.ppm | pgmoil >$tmpdir/junko$$.ppm"); -+ system("rgb3toppm $tmpdir/junko$$.ppm $tmpdir/junko$$.ppm $tmpdir/junko$$.ppm " . -+ ">$tmpdir/junk1o$$.ppm"); +- system("ppmtopgm junk1.ppm | pgmoil >junko.ppm"); +- system("rgb3toppm junko.ppm junko.ppm junko.ppm " . +- ">junk1o.ppm"); ++ system("ppmtopgm $tmpdir/junk1.ppm | pgmoil >$tmpdir/junko.ppm"); ++ system("rgb3toppm $tmpdir/junko.ppm $tmpdir/junko.ppm $tmpdir/junko.ppm " . ++ ">$tmpdir/junk1o.ppm"); } if ($i <= 10) { my $n = $spline10[$i]; -- system("ppmmix $n junk1$$.ppm junk1o$$.ppm >junk3$$.ppm"); -+ system("ppmmix $n $tmpdir/junk1$$.ppm $tmpdir/junk1o$$.ppm >$tmpdir/junk3$$.ppm"); +- system("ppmmix $n junk1.ppm junk1o.ppm >junk3.ppm"); ++ system("ppmmix $n $tmpdir/junk1.ppm $tmpdir/junk1o.ppm >$tmpdir/junk3.ppm"); } elsif ($i <= 20) { my $n = $spline10[$i-10]; -- system("ppmmix $n junk1o$$.ppm junk2o$$.ppm >junk3$$.ppm"); -+ system("ppmmix $n $tmpdir/junk1o$$.ppm $tmpdir/junk2o$$.ppm >$tmpdir/junk3$$.ppm"); +- system("ppmmix $n junk1o.ppm junk2o.ppm >junk3.ppm"); ++ system("ppmmix $n $tmpdir/junk1o.ppm $tmpdir/junk2o.ppm >$tmpdir/junk3.ppm"); } else { my $n = $spline10[$i-20]; -- system("ppmmix $n junk2o$$.ppm junk2$$.ppm >junk3$$.ppm"); -+ system("ppmmix $n $tmpdir/junk2o$$.ppm $tmpdir/junk2$$.ppm >$tmpdir/junk3$$.ppm"); +- system("ppmmix $n junk2o.ppm junk2.ppm >junk3.ppm"); ++ system("ppmmix $n $tmpdir/junk2o.ppm $tmpdir/junk2.ppm >$tmpdir/junk3.ppm"); } if ($i == 10) { -- system("ppmtopgm junk2$$.ppm | pgmoil >junko$$.ppm"); -- system("rgb3toppm junko$$.ppm junko$$.ppm junko$$.ppm " . -- ">junk2o$$.ppm"); -+ system("ppmtopgm $tmpdir/junk2$$.ppm | pgmoil >$tmpdir/junko$$.ppm"); -+ system("rgb3toppm $tmpdir/junko$$.ppm $tmpdir/junko$$.ppm $tmpdir/junko$$.ppm " . -+ ">$tmpdir/junk2o$$.ppm"); +- system("ppmtopgm junk2.ppm | pgmoil >junko.ppm"); +- system("rgb3toppm junko.ppm junko.ppm junko.ppm " . +- ">junk2o.ppm"); ++ system("ppmtopgm $tmpdir/junk2.ppm | pgmoil >$tmpdir/junko.ppm"); ++ system("rgb3toppm $tmpdir/junko.ppm $tmpdir/junko.ppm $tmpdir/junko.ppm " . ++ ">$tmpdir/junk2o.ppm"); } } elsif ($mode eq $EDGE) { if ($i == 1) { -- system("ppmtopgm junk1$$.ppm | pgmedge >junko$$.ppm"); -- system("rgb3toppm junko$$.ppm junko$$.ppm junko$$.ppm " . -- ">junk1o$$.ppm"); -+ system("ppmtopgm $tmpdir/junk1$$.ppm | pgmedge >$tmpdir/junko$$.ppm"); -+ system("rgb3toppm $tmpdir/junko$$.ppm $tmpdir/junko$$.ppm $tmpdir/junko$$.ppm " . -+ ">$tmpdir/junk1o$$.ppm"); +- system("ppmtopgm junk1.ppm | pgmedge >junko.ppm"); +- system("rgb3toppm junko.ppm junko.ppm junko.ppm " . +- ">junk1o.ppm"); ++ system("ppmtopgm $tmpdir/junk1.ppm | pgmedge >$tmpdir/junko.ppm"); ++ system("rgb3toppm $tmpdir/junko.ppm $tmpdir/junko.ppm $tmpdir/junko.ppm " . ++ ">$tmpdir/junk1o.ppm"); } if ($i <= 10) { my $n = $spline10[$i]; -- system("ppmmix $n junk1$$.ppm junk1o$$.ppm >junk3$$.ppm"); -+ system("ppmmix $n $tmpdir/junk1$$.ppm $tmpdir/junk1o$$.ppm >$tmpdir/junk3$$.ppm"); +- system("ppmmix $n junk1.ppm junk1o.ppm >junk3.ppm"); ++ system("ppmmix $n $tmpdir/junk1.ppm $tmpdir/junk1o.ppm >$tmpdir/junk3.ppm"); } elsif ($i <= 20) { my $n = $spline10[$i-10]; -- system("ppmmix $n junk1o$$.ppm junk2o$$.ppm >junk3$$.ppm"); -+ system("ppmmix $n $tmpdir/junk1o$$.ppm $tmpdir/junk2o$$.ppm >$tmpdir/junk3$$.ppm"); +- system("ppmmix $n junk1o.ppm junk2o.ppm >junk3.ppm"); ++ system("ppmmix $n $tmpdir/junk1o.ppm $tmpdir/junk2o.ppm >$tmpdir/junk3.ppm"); } else { my $n = $spline10[$i-20]; -- system("ppmmix $n junk2o$$.ppm junk2$$.ppm >junk3$$.ppm"); -+ system("ppmmix $n $tmpdir/junk2o$$.ppm $tmpdir/junk2$$.ppm >$tmpdir/junk3$$.ppm"); +- system("ppmmix $n junk2o.ppm junk2.ppm >junk3.ppm"); ++ system("ppmmix $n $tmpdir/junk2o.ppm $tmpdir/junk2.ppm >$tmpdir/junk3.ppm"); } if ($i == 10) { -- system("ppmtopgm junk2$$.ppm | pgmedge >junko$$.ppm"); -- system("rgb3toppm junko$$.ppm junko$$.ppm junko$$.ppm " . -- ">junk2o$$.ppm"); -+ system("ppmtopgm $tmpdir/junk2$$.ppm | pgmedge >$tmpdir/junko$$.ppm"); -+ system("rgb3toppm $tmpdir/junko$$.ppm $tmpdir/junko$$.ppm $tmpdir/junko$$.ppm " . -+ ">$tmpdir/junk2o$$.ppm"); +- system("ppmtopgm junk2.ppm | pgmedge >junko.ppm"); +- system("rgb3toppm junko.ppm junko.ppm junko.ppm " . +- ">junk2o.ppm"); ++ system("ppmtopgm $tmpdir/junk2.ppm | pgmedge >$tmpdir/junko.ppm"); ++ system("rgb3toppm $tmpdir/junko.ppm $tmpdir/junko.ppm $tmpdir/junko.ppm " . ++ ">$tmpdir/junk2o.ppm"); } } elsif ($mode eq $BENTLEY) { if ($i == 1) { -- system("ppmtopgm junk1$$.ppm | pgmbentley >junko$$.ppm"); -- system("rgb3toppm junko$$.ppm junko$$.ppm junko$$.ppm " . -- ">junk1o$$.ppm"); -+ system("ppmtopgm $tmpdir/junk1$$.ppm | pgmbentley >$tmpdir/junko$$.ppm"); -+ system("rgb3toppm $tmpdir/junko$$.ppm $tmpdir/junko$$.ppm $tmpdir/junko$$.ppm " . -+ ">$tmpdir/junk1o$$.ppm"); +- system("ppmtopgm junk1.ppm | pgmbentley >junko.ppm"); +- system("rgb3toppm junko.ppm junko.ppm junko.ppm " . +- ">junk1o.ppm"); ++ system("ppmtopgm $tmpdir/junk1.ppm | pgmbentley >$tmpdir/junko.ppm"); ++ system("rgb3toppm $tmpdir/junko.ppm $tmpdir/junko.ppm $tmpdir/junko.ppm " . ++ ">$tmpdir/junk1o.ppm"); } if ($i <= 10) { my $n = $spline10[$i]; -- system("ppmmix $n junk1$$.ppm junk1o$$.ppm >junk3$$.ppm"); -+ system("ppmmix $n $tmpdir/junk1$$.ppm $tmpdir/junk1o$$.ppm >$tmpdir/junk3$$.ppm"); +- system("ppmmix $n junk1.ppm junk1o.ppm >junk3.ppm"); ++ system("ppmmix $n $tmpdir/junk1.ppm $tmpdir/junk1o.ppm >$tmpdir/junk3.ppm"); } elsif ($i <= 20) { my $n = $spline10[$i-10]; -- system("ppmmix $n junk1o$$.ppm junk2o$$.ppm >junk3$$.ppm"); -+ system("ppmmix $n $tmpdir/junk1o$$.ppm $tmpdir/junk2o$$.ppm >$tmpdir/junk3$$.ppm"); +- system("ppmmix $n junk1o.ppm junk2o.ppm >junk3.ppm"); ++ system("ppmmix $n $tmpdir/junk1o.ppm $tmpdir/junk2o.ppm >$tmpdir/junk3.ppm"); } else { my $n = $spline10[$i-20]; -- system("ppmmix $n junk2o$$.ppm junk2$$.ppm >junk3$$.ppm"); -+ system("ppmmix $n $tmpdir/junk2o$$.ppm $tmpdir/junk2$$.ppm >$tmpdir/junk3$$.ppm"); - } - if ($i == 10) { -- system("ppmtopgm junk2$$.ppm | pgmbentley >junko$$.ppm"); -- system("rgb3toppm junko$$.ppm junko$$.ppm junko$$.ppm " . -- ">junk2o$$.ppm"); -+ system("ppmtopgm $tmpdir/junk2$$.ppm | pgmbentley >$tmpdir/junko$$.ppm"); -+ system("rgb3toppm $tmpdir/junko$$.ppm $tmpdir/junko$$.ppm $tmpdir/junko$$.ppm " . -+ ">$tmpdir/junk2o$$.ppm"); - } - } elsif ($mode eq $BLOCK) { - if ($i <= 10) { - my $n = 1 - 1.9*$spline20[$i]; -- system("pamscale $n junk1$$.ppm | " . -- "pamscale -width $width -height $height >junk3$$.ppm"); -+ system("pamscale $n $tmpdir/junk1$$.ppm | " . -+ "pamscale -width $width -height $height >$tmpdir/junk3$$.ppm"); - } elsif ($i <= 20) { - my $n = $spline10[$i-10]; -- system("ppmmix $n junk1a$$.ppm junk2a$$.ppm >junk3$$.ppm"); -+ system("ppmmix $n $tmpdir/junk1a$$.ppm $tmpdir/junk2a$$.ppm >$tmpdir/junk3$$.ppm"); - } else { - my $n = 1 - 1.9*$spline20[31-$i]; -- system("pamscale $n junk2$$.ppm | " . -- "pamscale -width $width -height $height >junk3$$.ppm"); -+ system("pamscale $n $tmpdir/junk2$$.ppm | " . -+ "pamscale -width $width -height $height >$tmpdir/junk3$$.ppm"); - } - if ($i == 10) { -- system("cp", "junk3$$.ppm", "junk1a$$.ppm"); -- system("pamscale $n junk2$$.ppm | " . -- "pamscale -width $width -height $height >junk2a$$.ppm"); -+ system("cp", "$tmpdir/junk3$$.ppm", "$tmpdir/junk1a$$.ppm"); -+ system("pamscale $n $tmpdir/junk2$$.ppm | " . -+ "pamscale -width $width -height $height >$tmpdir/junk2a$$.ppm"); - } - } elsif ($mode eq $MIX) { - my $fade_factor = sqrt(1/($nframes-$i+1)); -- system("ppmmix $fade_factor junk1$$.ppm junk2$$.ppm >junk3$$.ppm"); -+ system("ppmmix $fade_factor $tmpdir/junk1$$.ppm $tmpdir/junk2$$.ppm >$tmpdir/junk3$$.ppm"); - } else { - print("Internal error: impossible mode value '$mode'\n"); - } - - my $outfile = sprintf("%s.%04d.ppm", $base_name, $i); -- system("cp", "junk3$$.ppm", $outfile); -+ system("cp", "$tmpdir/junk3$$.ppm", $outfile); - } - - # - # Clean up shop. - # --system("rm junk*$$.ppm"); -+system("rm $tmpdir/junk*$$.ppm"); - - exit(0); + system("ppmmix $n $tmpdir/junk2o.ppm $tmpdir/junk2.ppm " . diff --git a/netpbm.spec b/netpbm.spec index f6e91bb361ca1a16e01eb1deb7079b1c2a7de658..decb2e50763b2ee566d9ba7ac62feb6a9316f346 100644 --- a/netpbm.spec +++ b/netpbm.spec @@ -1,33 +1,37 @@ Name: netpbm -Version: 10.83.01 -Release: 5 +Version: 11.02.00 +Release: 1 Summary: A library for handling different graphics file formats License: BSD and GPLv2 and IJG and MIT and Public Domain URL: http://netpbm.sourceforge.net/ +# Source0 is prepared by +# svn checkout https://svn.code.sf.net/p/netpbm/code/advanced netpbm-%%{version} +# svn checkout https://svn.code.sf.net/p/netpbm/code/userguide netpbm-%%{version}/userguide +# svn checkout https://svn.code.sf.net/p/netpbm/code/trunk/test netpbm-%%{version}/test +# and removing the .svn directories ( find -name "\.svn" -type d -print0 | xargs -0 rm -rf ) Source0: netpbm-%{version}.tar.xz Patch0000: netpbm-security-scripts.patch Patch0001: netpbm-security-code.patch Patch0002: netpbm-ppmfadeusage.patch -Patch0003: netpbm-noppmtompeg.patch -Patch0004: netpbm-CVE-2017-2587.patch -Patch0005: netpbm-python3.patch -Patch0006: netpbm-time.patch -Patch0007: netpbm-gcc4.patch -Patch0008: netpbm-bmptopnm.patch -Patch0009: netpbm-CAN-2005-2471.patch -Patch0010: netpbm-xwdfix.patch -Patch0011: netpbm-multilib.patch -Patch0012: netpbm-glibc.patch -Patch0013: netpbm-docfix.patch -Patch0014: netpbm-fiasco-overflow.patch -Patch0015: netpbm-cmuwtopbm.patch -Patch0016: netpbm-pamtojpeg2k.patch -Patch0017: netpbm-manfix.patch -Patch0018: netpbm-manual-pages.patch - -BuildRequires: libjpeg-devel, libpng-devel, libtiff-devel, flex +Patch0003: netpbm-CVE-2017-2587.patch +Patch0004: netpbm-python3.patch +Patch0005: netpbm-time.patch +Patch0006: netpbm-gcc4.patch +Patch0007: netpbm-bmptopnm.patch +Patch0008: netpbm-CAN-2005-2471.patch +Patch0009: netpbm-xwdfix.patch +Patch0010: netpbm-multilib.patch +Patch0011: netpbm-glibc.patch +Patch0012: netpbm-docfix.patch +Patch0013: netpbm-cmuwtopbm.patch +Patch0014: netpbm-pamtojpeg2k.patch +Patch0015: netpbm-manfix.patch +Patch0016: netpbm-libdir-so.patch +Patch0017: netpbm-c99.patch + +BuildRequires: libjpeg-devel, libpng-devel, libtiff-devel, flex make BuildRequires: libX11-devel perl-generators python3 libxml2-devel ghostscript-core gcc perl Requires: ghostscript Provides: bundled(jbigkit) netpbm-progs = %{version}-%{release} @@ -85,7 +89,7 @@ make \ LINUXSVGALIB="NONE" X11LIB=%{_libdir}/libX11.so XML2LIBS="NONE" cd userguide -rm -f ppmtompeg* *.manual-pages *.manfix +rm -f *.manual-pages *.manfix for i in *.html ; do ../buildtools/makeman ${i} @@ -105,7 +109,6 @@ if [ "%{_libdir}" != "/usr/lib" ]; then fi cp -af lib/libnetpbm.a %{buildroot}%{_libdir}/libnetpbm.a -cp -l %{buildroot}%{_libdir}/libnetpbm.so.?? %{buildroot}%{_libdir}/libnetpbm.so install -d %{buildroot}%{_datadir} mv userguide/man %{buildroot}%{_mandir} @@ -155,6 +158,9 @@ cd - %{_mandir}/man5/* %changelog +* Wed Apr 19 2023 liyanan - 11.02.00-1 +- Update to 11.02.00 + * Wed Jan 05 2022 Ge Wang - 10.83.01-5 - Fix building error: Can not locate English.pm - Add perl in BuildRequires