diff options
author | giraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8> | 2023-06-28 17:29:32 +0000 |
---|---|---|
committer | giraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8> | 2023-06-28 17:29:32 +0000 |
commit | 23ce26f64c34e30951ad9ade2151552ed77e7357 (patch) | |
tree | d73b31a0c2f7c7be4a69f8a8e84e00dd39c432b5 /converter/pbm/pbmtoescp2.c | |
parent | 1b6e51a266008348ad93ed8b6ac9ec91b5024fea (diff) | |
download | netpbm-mirror-23ce26f64c34e30951ad9ade2151552ed77e7357.tar.gz netpbm-mirror-23ce26f64c34e30951ad9ade2151552ed77e7357.tar.xz netpbm-mirror-23ce26f64c34e30951ad9ade2151552ed77e7357.zip |
promote Advanced to Stable
git-svn-id: http://svn.code.sf.net/p/netpbm/code/stable@4558 9d0c8265-081b-0410-96cb-a4ca84ce46f8
Diffstat (limited to 'converter/pbm/pbmtoescp2.c')
-rw-r--r-- | converter/pbm/pbmtoescp2.c | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/converter/pbm/pbmtoescp2.c b/converter/pbm/pbmtoescp2.c index 6f284f3c..942ecec9 100644 --- a/converter/pbm/pbmtoescp2.c +++ b/converter/pbm/pbmtoescp2.c @@ -18,6 +18,7 @@ * * ESC/P Reference Manual (1997) * ftp://download.epson-europe.com/pub/download/182/epson18162eu.zip +* See Part 1 "ESC ." Print Raster Graphics */ #include <string.h> @@ -28,7 +29,7 @@ #include "runlength.h" #include "pbm.h" - +#define MAXCOLS (127 * 256 + 255) /* Limit in official Epson manual */ static char const esc = 033; @@ -57,19 +58,19 @@ parseCommandLine(int argc, const char ** argv, opt.opt_table = option_def; opt.short_allowed = FALSE; opt.allowNegNum = FALSE; - OPTENT3(0, "compress", OPT_UINT, &cmdlineP->compress, + OPTENT3(0, "compress", OPT_UINT, &cmdlineP->compress, &compressSpec, 0); - OPTENT3(0, "resolution", OPT_UINT, &cmdlineP->resolution, + OPTENT3(0, "resolution", OPT_UINT, &cmdlineP->resolution, &resolutionSpec, 0); - OPTENT3(0, "stripeheight", OPT_UINT, &cmdlineP->stripeHeight, + OPTENT3(0, "stripeheight", OPT_UINT, &cmdlineP->stripeHeight, &stripeHeightSpec, 0); - OPTENT3(0, "raw", OPT_FLAG, NULL, + OPTENT3(0, "raw", OPT_FLAG, NULL, &rawSpec, 0); - OPTENT3(0, "formfeed", OPT_FLAG, NULL, + OPTENT3(0, "formfeed", OPT_FLAG, NULL, &formfeedSpec, 0); - + pm_optParseOptions3(&argc, (char **)argv, opt, sizeof(opt), 0); - + if (argc-1 > 1) pm_error("Too many arguments: %d. " "Only argument is the filename", argc-1); @@ -155,7 +156,7 @@ main(int argc, const char * argv[]) { unsigned char * bitrow[256]; unsigned char * compressedData; struct CmdlineInfo cmdline; - + pm_proginit(&argc, argv); parseCommandLine(argc, argv, &cmdline); @@ -164,7 +165,7 @@ main(int argc, const char * argv[]) { pbm_readpbminit(ifP, &cols, &rows, &format); - if (cols / 256 > 127) /* Limit in official Epson manual */ + if (cols > MAXCOLS) pm_error("Image width is too large"); outColByteCt = pbm_packed_bytes(cols); @@ -229,7 +230,7 @@ main(int argc, const char * argv[]) { } } - free(inBuff); + free(inBuff); free(compressedData); pm_close(ifP); |