Revision: 55238
http://sourceforge.net/p/brlcad/code/55238
Author: brlcad
Date: 2013-04-25 03:20:05 +0000 (Thu, 25 Apr 2013)
Log Message:
-----------
call bu_exit() and avoid setting an expression boolean to a variable
Modified Paths:
--------------
brlcad/trunk/src/util/decimate.c
Modified: brlcad/trunk/src/util/decimate.c
===================================================================
--- brlcad/trunk/src/util/decimate.c 2013-04-25 03:10:41 UTC (rev 55237)
+++ brlcad/trunk/src/util/decimate.c 2013-04-25 03:20:05 UTC (rev 55238)
@@ -68,8 +68,7 @@
int failure;
if (argc < 4) {
- fputs(usage, stderr);
- bu_exit (1, NULL);
+ bu_exit (1, "%s", usage);
}
nbytes = atoi(argv[1]);
@@ -81,21 +80,20 @@
oheight = atoi(argv[5]);
}
- failure = (nbytes <= 0 || nbytes > INT_MAX);
- if (failure){
- bu_log("decimate: bad nbytes/pixel: %ld\n",(long int)nbytes);
+ if (nbytes <= 0 || nbytes > INT_MAX) {
+ failure = 1 ;
+ bu_log("decimate: bad nbytes/pixel: %ld\n", (long int)nbytes);
}
- if (iwidth <= 0 || iwidth > INT_MAX || iheight <= 0 || iheight > INT_MAX )
{
+ 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 )
{
+ if (owidth <= 0 || owidth > INT_MAX || oheight <= 0 || oheight > INT_MAX) {
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;
+ if (failure) {
+ bu_exit(EXIT_FAILURE, usage);
}
/* Determine how many samples/lines to discard after each one saved,
@@ -109,7 +107,6 @@
discard = dh;
if (dw > discard) discard = dw;
-
wpad = owidth - (iwidth / (discard+1));
iline = (unsigned char *)bu_calloc((iwidth+1), nbytes, "iline");
@@ -125,7 +122,8 @@
/* Scrunch down first scanline of input data */
ret = fread(iline, nbytes, iwidth, stdin);
- if (ret != iwidth) break;
+ if (ret != iwidth)
+ break;
ip = iline;
op = oline;
for (i=0; i < todo; i++) {
@@ -147,7 +145,7 @@
}
}
- out:
+out:
bu_free(iline, "iline");
bu_free(oline, "oline");
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
Try New Relic Now & We'll Send You this Cool Shirt
New Relic is the only SaaS-based application performance monitoring service
that delivers powerful full stack analytics. Optimize and monitor your
browser, app, & servers with just a few lines of code. Try New Relic
and get this awesome Nerd Life shirt! http://p.sf.net/sfu/newrelic_d2d_apr
_______________________________________________
BRL-CAD Source Commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/brlcad-commits