diff options
author | giraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8> | 2022-03-27 03:11:13 +0000 |
---|---|---|
committer | giraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8> | 2022-03-27 03:11:13 +0000 |
commit | 6f9d75acb45235a93b1520beec7f96a98bde0412 (patch) | |
tree | 903719a5984cd8008cdd079af7a445de271c23e4 /converter | |
parent | e15e137ba527ba97c82149ad8c6bed59088d8616 (diff) | |
download | netpbm-mirror-6f9d75acb45235a93b1520beec7f96a98bde0412.tar.gz netpbm-mirror-6f9d75acb45235a93b1520beec7f96a98bde0412.tar.xz netpbm-mirror-6f9d75acb45235a93b1520beec7f96a98bde0412.zip |
Release 10.73.39
git-svn-id: http://svn.code.sf.net/p/netpbm/code/super_stable@4314 9d0c8265-081b-0410-96cb-a4ca84ce46f8
Diffstat (limited to 'converter')
-rw-r--r-- | converter/other/pnmtorle.c | 36 | ||||
-rw-r--r-- | converter/ppm/picttoppm.c | 6 | ||||
-rw-r--r-- | converter/ppm/ppmtoapplevol.c | 6 | ||||
-rw-r--r-- | converter/ppm/ppmtoilbm.c | 1 |
4 files changed, 38 insertions, 11 deletions
diff --git a/converter/other/pnmtorle.c b/converter/other/pnmtorle.c index 8908c356..7c378246 100644 --- a/converter/other/pnmtorle.c +++ b/converter/other/pnmtorle.c @@ -207,12 +207,35 @@ write_rle_data(void) { +static void +skip_data(FILE * const fp, + int const width, + int const height, + gray const maxval, + int const format) { + + xel * xelrow; + unsigned int scan; + + MALLOCARRAY(xelrow, width); + if (xelrow == NULL) + pm_error("Failed to allocate memory for row of %u pixels", width); + + for(scan=0; scan < height; ++scan) + pnm_readpnmrow(fp, xelrow, width, maxval, format); + + free(xelrow); +} + + + int main(int argc, char ** argv) { const char * pnmname; const char * outname; int oflag; + int eof; pnm_init(&argc, argv); @@ -245,18 +268,17 @@ main(int argc, char ** argv) { hdr.rle_file = rle_open_f( hdr.cmd, outname, "wb" ); - if (header) + for (eof = 0; !eof; ) { read_pnm_header(); - else { - int eof; - for (eof = 0; !eof; ) { - read_pnm_header(); + + if (header) + skip_data(fp, width, height, maxval, format); + else { rle_addhist(argv, NULL, &hdr); write_rle_header(); write_rle_data(); - - pnm_nextimage(fp, &eof); } + pnm_nextimage(fp, &eof); } pm_close(fp); diff --git a/converter/ppm/picttoppm.c b/converter/ppm/picttoppm.c index 1a833b33..f5fbd7be 100644 --- a/converter/ppm/picttoppm.c +++ b/converter/ppm/picttoppm.c @@ -1273,7 +1273,7 @@ doDiffSize(struct Rect const clipsrc, } break; case 32: { - unsigned int const planeSize = srcwid / 4; + unsigned int const planeSize = rectwidth(&srcRect); unsigned int rowNumber; for (rowNumber = 0; rowNumber < ysize; ++rowNumber) { @@ -1443,7 +1443,7 @@ doSameSize(transfer_func trf, } } break; case 32: { - unsigned int const planeSize = srcwid / 4; + unsigned int const planeSize = xsize; unsigned int rowNumber; for (rowNumber = 0; rowNumber < ysize; ++rowNumber) { @@ -1526,7 +1526,7 @@ blitIdempotent(unsigned int const pixSize, } } break; case 32: { - unsigned int const planeSize = srcwid / 4; + unsigned int const planeSize = xsize; unsigned int rowNumber; for (rowNumber = 0; rowNumber < ysize; ++rowNumber) { diff --git a/converter/ppm/ppmtoapplevol.c b/converter/ppm/ppmtoapplevol.c index e1c7f2dc..eb4b6b2a 100644 --- a/converter/ppm/ppmtoapplevol.c +++ b/converter/ppm/ppmtoapplevol.c @@ -68,6 +68,10 @@ main (int argc, const char * argv[]) { if (rows != 12) pm_error("Input image must be 12 rows tall. Yours is %u", rows); + if (cols > 255) + pm_error("Input image must not be more than 255 columns wide." + " Yours is %u", cols); + writeHeader(cols, stdout); pixelrow = ppm_allocrow(cols); @@ -75,7 +79,7 @@ main (int argc, const char * argv[]) { for (row = 0; row < rows; row++) { unsigned int col; - ppm_readppmrow(stdin, pixelrow, cols, maxval, format); + ppm_readppmrow(ifP, pixelrow, cols, maxval, format); for (col = 0; col < cols; ++col) { unsigned int const maxval15Value = diff --git a/converter/ppm/ppmtoilbm.c b/converter/ppm/ppmtoilbm.c index 595aa3f4..c5fa4d00 100644 --- a/converter/ppm/ppmtoilbm.c +++ b/converter/ppm/ppmtoilbm.c @@ -2274,6 +2274,7 @@ main(int argc, char ** argv) { if (colors == 0) pm_error("empty colormap??"); pm_message("%d colors found in colormap", colors); + nPlanes = pm_maxvaltobits(colors-1); } if (maskmethod != mskNone) { |