From 252a86861fef6ad8bf0cf0cc2adad6600bf2ff97 Mon Sep 17 00:00:00 2001 From: giraffedata Date: Sat, 29 Dec 2007 19:10:48 +0000 Subject: validate dimension inputs git-svn-id: http://svn.code.sf.net/p/netpbm/code/trunk@511 9d0c8265-081b-0410-96cb-a4ca84ce46f8 --- generator/pgmramp.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) (limited to 'generator') diff --git a/generator/pgmramp.c b/generator/pgmramp.c index b84ed345..30d224db 100644 --- a/generator/pgmramp.c +++ b/generator/pgmramp.c @@ -96,14 +96,8 @@ parseCommandLine(int argc, char ** argv, pm_error("Only two arguments allowed: width and height. " "You specified %d", argc-1); else { - cmdlineP->cols = atoi(argv[1]); - cmdlineP->rows = atoi(argv[2]); - if (cmdlineP->cols <= 0) - pm_error("width argument must be a positive number. You " - "specified '%s'", argv[1]); - if (cmdlineP->rows <= 0) - pm_error("height argument must be a positive number. You " - "specified '%s'", argv[2]); + cmdlineP->cols = pm_parse_width(argv[1]); + cmdlineP->rows = pm_parse_height(argv[2]); } } -- cgit 1.4.1