Revision: 65246
          http://sourceforge.net/p/brlcad/code/65246
Author:   carlmoore
Date:     2015-06-10 17:28:54 +0000 (Wed, 10 Jun 2015)
Log Message:
-----------
avoid the missing of some errors -- e.g., if both horizontal cut size & 
vertical cut size are bad, complain of both

Modified Paths:
--------------
    brlcad/trunk/src/libicv/crop.c

Modified: brlcad/trunk/src/libicv/crop.c
===================================================================
--- brlcad/trunk/src/libicv/crop.c      2015-06-10 17:26:54 UTC (rev 65245)
+++ brlcad/trunk/src/libicv/crop.c      2015-06-10 17:28:54 UTC (rev 65246)
@@ -34,21 +34,32 @@
     size_t row;
     double *p, *in_data, *out_data;
     size_t widthstep_in, widthstep_out, bytes_row; /**<  */
+    int errorflag;
 
     ICV_IMAGE_VAL_INT(img);
 
-    if (xnum < 1)
-       bu_exit(1, "icv_rect : ERROR: Horizontal Cut Size\n");
+    errorflag=0;
+    if (xnum < 1) {
+       fprintf(stderr,"icv_rect : ERROR: Horizontal Cut Size\n");
+       errorflag=1;
+    }
+    if (ynum < 1) {
+       fprintf(stderr,"icv_rect : ERROR: Vertical Cut Size\n");
+       errorflag=1;
+    }
+    if (errorflag) bu_exit(1,NULL);
 
-    if (ynum < 1)
-       bu_exit(1, "icv_rect : ERROR: Vertical Cut Size\n");
+    errorflag=0;
+    if (xorig+xnum > img->width) {
+       fprintf(stderr,"icv_rect : Cut not possible; input parameters exceed 
the width.\n");
+       errorflag=1;
+    }
+    if (yorig+ynum > img->height) {
+       fprintf(stderr,"icv_rect : Cut not possible; input parameters exceed 
the height.\n");
+       errorflag=1;
+    }
+    if (errorflag) bu_exit(1,NULL);
 
-    if (xorig+xnum > img->width)
-       bu_exit(1, "icv_rect : Cut not possible; input parameters exceed the 
width.\n");
-
-    if (yorig+ynum > img->height)
-       bu_exit(1, "icv_rect : Cut not possible; input parameters exceed the 
height.\n");
-
     /* initialization of variables to insure cropping and copying */
     widthstep_in = img->width*img->channels;
     widthstep_out = xnum*img->channels;

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


------------------------------------------------------------------------------
_______________________________________________
BRL-CAD Source Commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/brlcad-commits

Reply via email to