diff options
Diffstat (limited to 'converter/ppm/ppmtoapplevol.c')
-rw-r--r-- | converter/ppm/ppmtoapplevol.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/converter/ppm/ppmtoapplevol.c b/converter/ppm/ppmtoapplevol.c index e1c7f2dc..50c85dc6 100644 --- a/converter/ppm/ppmtoapplevol.c +++ b/converter/ppm/ppmtoapplevol.c @@ -68,14 +68,18 @@ 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); 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 = @@ -93,3 +97,6 @@ main (int argc, const char * argv[]) { return 0; } + + + |