diff options
Diffstat (limited to 'converter/ppm')
-rw-r--r-- | converter/ppm/picttoppm.c | 3 | ||||
-rw-r--r-- | converter/ppm/pjtoppm.c | 9 |
2 files changed, 11 insertions, 1 deletions
diff --git a/converter/ppm/picttoppm.c b/converter/ppm/picttoppm.c index b8fb8642..06074684 100644 --- a/converter/ppm/picttoppm.c +++ b/converter/ppm/picttoppm.c @@ -1204,7 +1204,7 @@ doDiffSize(struct Rect const clipsrc, struct rgbPlanes const dst, unsigned int const dstwid) { - unsigned int const dstadd = dstwid - xsize; + unsigned int const dstadd = dstwid - rectwidth(&clipdst); FILE * pamscalePipeP; const char * command; @@ -1960,6 +1960,7 @@ ClipRgn(struct canvas * const canvasP, */ readRect(&clip_rect); + rectinter(clip_rect, picFrame, &clip_rect); /* XXX should clip this by picFrame */ if (verbose) dumpRect("clipping to", clip_rect); diff --git a/converter/ppm/pjtoppm.c b/converter/ppm/pjtoppm.c index b8b94f74..cd558855 100644 --- a/converter/ppm/pjtoppm.c +++ b/converter/ppm/pjtoppm.c @@ -10,6 +10,8 @@ ** implied warranty. */ +#include <stdbool.h> + #include "ppm.h" #include "pm_c_util.h" #include "mallocvar.h" @@ -54,6 +56,7 @@ main(int argc, const char ** argv) { int *imlen; FILE * ifP; int mode; + bool modeIsSet; int argn; unsigned char bf[3]; pixel * pixrow; @@ -74,6 +77,7 @@ main(int argc, const char ** argv) { row = 0; /* initial value */ plane = 0; /* initial value */ + modeIsSet = false; /* initial value */ while ((c = fgetc(ifP)) != -1) { if (c != '\033') @@ -145,6 +149,7 @@ main(int argc, const char ** argv) { if (val != 0 && val != 1) pm_error("unimplemented trasmission mode %d", val); mode = val; + modeIsSet = true; break; case 'V': /* send plane */ case 'W': /* send last plane */ @@ -214,6 +219,10 @@ main(int argc, const char ** argv) { } /* switch */ } pm_close(ifP); + + if (!modeIsSet) + pm_error("Input does not contain a 'bM' transmission mode order"); + rows = row; if (mode == 1) { int const newcols = 10240; /* It could not be larger that that! */ |