diff options
author | giraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8> | 2009-01-02 16:50:56 +0000 |
---|---|---|
committer | giraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8> | 2009-01-02 16:50:56 +0000 |
commit | e625edd598d9809a2dfc7fe990fcad90ad73e2f4 (patch) | |
tree | 85f44a86a26a63f1283ef0eda99cbe971bcc7e04 /converter | |
parent | 44a31f1ba6fac1a84029a0d9d5c40f7af8717cca (diff) | |
download | netpbm-mirror-e625edd598d9809a2dfc7fe990fcad90ad73e2f4.tar.gz netpbm-mirror-e625edd598d9809a2dfc7fe990fcad90ad73e2f4.tar.xz netpbm-mirror-e625edd598d9809a2dfc7fe990fcad90ad73e2f4.zip |
improve messages
git-svn-id: http://svn.code.sf.net/p/netpbm/code/trunk@809 9d0c8265-081b-0410-96cb-a4ca84ce46f8
Diffstat (limited to 'converter')
-rw-r--r-- | converter/ppm/picttoppm.c | 33 |
1 files changed, 21 insertions, 12 deletions
diff --git a/converter/ppm/picttoppm.c b/converter/ppm/picttoppm.c index a89c3086..04d8cc5f 100644 --- a/converter/ppm/picttoppm.c +++ b/converter/ppm/picttoppm.c @@ -765,24 +765,33 @@ load_fontdir(const char * const dirfile) { static void +dumpRect(const char * const label, + struct Rect const rectangle) { + + pm_message("%s (%u,%u) (%u,%u)", + label, + rectangle.left, rectangle.top, + rectangle.right, rectangle.bottom); +} + + + +static void read_rect(struct Rect * const r) { r->top = read_word(); r->left = read_word(); r->bottom = read_word(); r->right = read_word(); -} - + if (r->top < r->bottom || r->right < r->left) + dumpRect("Invalid rectangle", *r); -static void -dumpRect(const char * const label, - struct Rect const rectangle) { - - pm_message("%s (%u,%u) (%u,%u)", - label, - rectangle.left, rectangle.top, - rectangle.right, rectangle.bottom); + if (r->top < r->bottom) + pm_error("Invalid PICT: a rectangle has a top below its bottom"); + if (r->right < r->left) + pm_error("Invalid PICT: a rectangle has a right edge " + "left of its left edge"); } @@ -3942,14 +3951,14 @@ interpret_pict(FILE * const ofP) { picSize = read_word(); if (verbose) - pm_message("picture size = %d (0x%x)", picSize, picSize); + pm_message("picture size = %u (0x%x)", picSize, picSize); stage = "reading picture frame"; read_rect(&picFrame); if (verbose) { dumpRect("Picture frame:", picFrame); - pm_message("Picture size is %d x %d", + pm_message("Picture size is %u x %u", picFrame.right - picFrame.left, picFrame.bottom - picFrame.top); } |