diff options
author | giraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8> | 2022-03-20 17:26:12 +0000 |
---|---|---|
committer | giraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8> | 2022-03-20 17:26:12 +0000 |
commit | 925336fe011635da550369b9db527f034fbc587d (patch) | |
tree | acf50acf5e6fdb4e7ecaf57013ec1f96c94dccb6 /converter | |
parent | edd488e6e6220bad9cd1319bcbac2c50262e35ea (diff) | |
download | netpbm-mirror-925336fe011635da550369b9db527f034fbc587d.tar.gz netpbm-mirror-925336fe011635da550369b9db527f034fbc587d.tar.xz netpbm-mirror-925336fe011635da550369b9db527f034fbc587d.zip |
Release 10.86.32
git-svn-id: http://svn.code.sf.net/p/netpbm/code/stable@4311 9d0c8265-081b-0410-96cb-a4ca84ce46f8
Diffstat (limited to 'converter')
-rw-r--r-- | converter/other/pnmtorle.c | 36 |
1 files changed, 29 insertions, 7 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); |