diff options
author | giraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8> | 2011-04-01 01:56:45 +0000 |
---|---|---|
committer | giraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8> | 2011-04-01 01:56:45 +0000 |
commit | bd344dc79dbe8f67e97acb6e3fe0b1e94e3bb24e (patch) | |
tree | b61ee5fc2c7a9113fb0d71966ffce6897462b0ff /converter/other/pnmtops.c | |
parent | be242df7305436f0cf192b70fa7c21c34e8cffba (diff) | |
download | netpbm-mirror-bd344dc79dbe8f67e97acb6e3fe0b1e94e3bb24e.tar.gz netpbm-mirror-bd344dc79dbe8f67e97acb6e3fe0b1e94e3bb24e.tar.xz netpbm-mirror-bd344dc79dbe8f67e97acb6e3fe0b1e94e3bb24e.zip |
Fix use of unset variable
git-svn-id: http://svn.code.sf.net/p/netpbm/code/trunk@1458 9d0c8265-081b-0410-96cb-a4ca84ce46f8
Diffstat (limited to 'converter/other/pnmtops.c')
-rw-r--r-- | converter/other/pnmtops.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/converter/other/pnmtops.c b/converter/other/pnmtops.c index 2d513853..bcca8bfb 100644 --- a/converter/other/pnmtops.c +++ b/converter/other/pnmtops.c @@ -149,11 +149,13 @@ validateCompDimension(unsigned int const value, the actual computations don't have to be complicated with arithmetic overflow checks, so they're easier to read. -----------------------------------------------------------------------------*/ - unsigned int const maxWidthHeight = INT_MAX - 2; - unsigned int const maxScaleFactor = maxWidthHeight / value; + if (value > 0) { + unsigned int const maxWidthHeight = INT_MAX - 2; + unsigned int const maxScaleFactor = maxWidthHeight / value; - if (scaleFactor > maxScaleFactor) - pm_error("%s is too large for compuations: %u", vname, value); + if (scaleFactor > maxScaleFactor) + pm_error("%s is too large for compuations: %u", vname, value); + } } @@ -225,10 +227,10 @@ parseCommandLine(int argc, const char ** argv, cmdlineP->scale = 1.0; if (!widthSpec) - cmdlineP->width = 8.5; + width = 8.5; if (!heightSpec) - cmdlineP->height = 11.0; + height = 11.0; if (dpiSpec) parseDpi(dpiOpt, &cmdlineP->dpiX, &cmdlineP->dpiY); |