Revision: 55047
          http://brlcad.svn.sourceforge.net/brlcad/?rev=55047&view=rev
Author:   carlmoore
Date:     2013-04-04 14:35:20 +0000 (Thu, 04 Apr 2013)
Log Message:
-----------
improve error reporting in decimate command

Modified Paths:
--------------
    brlcad/trunk/src/util/decimate.c

Modified: brlcad/trunk/src/util/decimate.c
===================================================================
--- brlcad/trunk/src/util/decimate.c    2013-04-04 13:35:00 UTC (rev 55046)
+++ brlcad/trunk/src/util/decimate.c    2013-04-04 14:35:20 UTC (rev 55047)
@@ -65,6 +65,8 @@
     size_t dh, dw;
     size_t todo;
 
+    int failure;
+
     if (argc < 4) {
        fputs(usage, stderr);
        bu_exit (1, NULL);
@@ -79,12 +81,20 @@
        oheight = atoi(argv[5]);
     }
 
-    if (nbytes <= 0 || nbytes > INT_MAX || iwidth <= 0 || iwidth > INT_MAX || 
iheight <= 0 || iheight > INT_MAX ) {
-       bu_log("Input size of range: %ldx%ld\n", (long int)iwidth, (long 
int)iheight);
-       return EXIT_FAILURE;
+    failure = (nbytes <= 0 || nbytes > INT_MAX);
+    if (failure){
+       bu_log("decimate: bad nbytes/pixel: %ld\n",(long int)nbytes);
     }
+    if (iwidth <= 0 || iwidth > INT_MAX || iheight <= 0 || iheight > INT_MAX ) 
{
+       failure = 1 ;
+       bu_log("decimate: bad size of input range: %ldx%ld\n", (long 
int)iwidth, (long int)iheight);
+    }
     if (owidth <= 0 || owidth > INT_MAX || oheight <= 0 || oheight > INT_MAX ) 
{
-       bu_log("Output size of range: %ldx%ld\n", (long int)owidth, (long 
int)oheight);
+       failure = 1 ;
+       bu_log("decimate: bad size of output range: %ldx%ld\n", (long 
int)owidth, (long int)oheight);
+    }
+    if (failure){
+       fputs(usage, stderr);
        return EXIT_FAILURE;
     }
 

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.


------------------------------------------------------------------------------
Minimize network downtime and maximize team effectiveness.
Reduce network management and security costs.Learn how to hire 
the most talented Cisco Certified professionals. Visit the 
Employer Resources Portal
http://www.cisco.com/web/learning/employer_resources/index.html
_______________________________________________
BRL-CAD Source Commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/brlcad-commits

Reply via email to