Revision: 41481
http://brlcad.svn.sourceforge.net/brlcad/?rev=41481&view=rev
Author: brlcad
Date: 2010-11-30 14:15:40 +0000 (Tue, 30 Nov 2010)
Log Message:
-----------
quiet LOTS of verbose compilation warnings for various issues including shadow
vars, return from non-void, unused params, unused vars, floating point
comparisons, missing headers, and signedness matching
Modified Paths:
--------------
brlcad/trunk/src/util/azel.c
brlcad/trunk/src/util/buffer.c
brlcad/trunk/src/util/bw-a.c
brlcad/trunk/src/util/bw-imp.c
brlcad/trunk/src/util/bw-png.c
brlcad/trunk/src/util/bw-ps.c
brlcad/trunk/src/util/bw-rle.c
brlcad/trunk/src/util/bwcrop.c
brlcad/trunk/src/util/bwfilter.c
brlcad/trunk/src/util/bwhisteq.c
brlcad/trunk/src/util/bwscale.c
brlcad/trunk/src/util/bwstat.c
brlcad/trunk/src/util/dbcp.c
brlcad/trunk/src/util/decimate.c
brlcad/trunk/src/util/dpix-pix.c
brlcad/trunk/src/util/dsp_add.c
brlcad/trunk/src/util/dunncomm.c
brlcad/trunk/src/util/dunnsnap.c
brlcad/trunk/src/util/fix_polysolids.c
brlcad/trunk/src/util/imgdims.c
brlcad/trunk/src/util/loop.c
brlcad/trunk/src/util/lowp.c
brlcad/trunk/src/util/mac-pix.c
brlcad/trunk/src/util/pl-X.c
brlcad/trunk/src/util/pl-dm.c
Modified: brlcad/trunk/src/util/azel.c
===================================================================
--- brlcad/trunk/src/util/azel.c 2010-11-30 14:12:17 UTC (rev 41480)
+++ brlcad/trunk/src/util/azel.c 2010-11-30 14:15:40 UTC (rev 41481)
@@ -264,7 +264,8 @@
fprintf(outPtr, "%g\t%g\t%s\n", V2, W2, Tail);
LineNm++;
}
- bu_exit (0, NULL);
+
+ return 0;
}
Modified: brlcad/trunk/src/util/buffer.c
===================================================================
--- brlcad/trunk/src/util/buffer.c 2010-11-30 14:12:17 UTC (rev 41480)
+++ brlcad/trunk/src/util/buffer.c 2010-11-30 14:15:40 UTC (rev 41481)
@@ -50,10 +50,13 @@
main(int argc, char *argv[])
{
FILE *fp;
- int count;
+ long count;
int tfd;
- if ((count = bu_mread(0, buf, sizeof(buf))) < sizeof(buf)) {
+ if (argc > 1)
+ bu_log("%s: unrecognized argument(s)\n", argv[0]);
+
+ if ((count = bu_mread(0, buf, sizeof(buf))) < (long)sizeof(buf)) {
if (count < 0) {
perror("buffer: mem read");
exit(1);
Modified: brlcad/trunk/src/util/bw-a.c
===================================================================
--- brlcad/trunk/src/util/bw-a.c 2010-11-30 14:12:17 UTC (rev 41480)
+++ brlcad/trunk/src/util/bw-a.c 2010-11-30 14:15:40 UTC (rev 41481)
@@ -42,6 +42,7 @@
#include "bu.h"
#include "vmath.h"
#include "bn.h"
+#include "fb.h"
static long int file_width = 512L;
Modified: brlcad/trunk/src/util/bw-imp.c
===================================================================
--- brlcad/trunk/src/util/bw-imp.c 2010-11-30 14:12:17 UTC (rev 41480)
+++ brlcad/trunk/src/util/bw-imp.c 2010-11-30 14:15:40 UTC (rev 41481)
@@ -70,8 +70,8 @@
static FILE *infp; /* input file handle */
static char *file_name = "-"; /* name of input file, for banner */
-static int height; /* input height */
-static int width; /* input width */
+static size_t height; /* input height */
+static size_t width; /* input width */
static int thresh = -1; /* Threshold */
@@ -83,9 +83,9 @@
unsigned char line[MAXWIDTH]; /* grey-scale input buffer */
static int im_mag; /* magnification (1, 2 or 4) */
-static int im_width; /* image size (in Imagen dots) */
-static int im_wpatches; /* # 32-bit patches width */
-static int im_hpatches; /* # 32-bit patches height */
+static size_t im_width; /* image size (in Imagen dots) */
+static size_t im_wpatches; /* # 32-bit patches width */
+static size_t im_hpatches; /* # 32-bit patches height */
bool get_args(int argc, char **argv);
bool im_close(void);
@@ -161,7 +161,7 @@
int
main(int argc, char **argv)
{
- int y;
+ size_t y;
height = width = 512; /* Defaults */
@@ -183,7 +183,7 @@
im_wpatches = (im_width+31) / 32;
im_hpatches = ((height * im_mag)+31) / 32;
if (im_wpatches*32 > 2560) {
- fprintf(stderr, "bw-imp: output %d too wide, limit is 2560\n",
+ fprintf(stderr, "bw-imp: output %ld too wide, limit is 2560\n",
im_wpatches*32);
return 1;
}
@@ -239,11 +239,11 @@
void
im_write(int y)
{
- int y1;
+ size_t y1;
/* Process one 32-bit high output swath */
for (y1 = 0; y1 < 32; y1 += im_mag) {
- int x;
+ size_t x;
/* Obtain a single line of 8-bit pixels */
if (fread(line, 1, width, infp) != width) {
@@ -292,7 +292,7 @@
/* output the swath */
{
- int xx, yy;
+ size_t xx, yy;
for (xx = 0; xx < im_wpatches; ++xx) {
for (yy = 0; yy < 32; ++yy) {
long b = swath[yy][xx];
Modified: brlcad/trunk/src/util/bw-png.c
===================================================================
--- brlcad/trunk/src/util/bw-png.c 2010-11-30 14:12:17 UTC (rev 41480)
+++ brlcad/trunk/src/util/bw-png.c 2010-11-30 14:15:40 UTC (rev 41481)
@@ -27,14 +27,16 @@
#include <stdlib.h>
#include <math.h>
+#include "zlib.h"
#include "bio.h"
#include "png.h"
#include "bu.h"
#include "vmath.h"
#include "bn.h"
-#include "zlib.h"
+#include "fb.h"
+
static long int file_width = 512; /* default input width */
static long int file_height = 512; /* default input height */
static int autosize = 0; /* !0 to autosize input */
Modified: brlcad/trunk/src/util/bw-ps.c
===================================================================
--- brlcad/trunk/src/util/bw-ps.c 2010-11-30 14:12:17 UTC (rev 41480)
+++ brlcad/trunk/src/util/bw-ps.c 2010-11-30 14:15:40 UTC (rev 41481)
@@ -39,19 +39,19 @@
static int center = 0; /* center output on 8.5 x 11 page */
static int landscape = 0; /* landscape mode */
-static int width = 512; /* input size in pixels */
-static int height = 512;
+static size_t width = 512; /* input size in pixels */
+static size_t height = 512;
static double outwidth; /* output image size in inches */
static double outheight;
-static int xpoints; /* output image size in points */
-static int ypoints;
-static int pagewidth = 612; /* page size in points - 8.5 inches */
-static int pageheight = 792; /* 11 inches */
+static size_t xpoints; /* output image size in points */
+static size_t ypoints;
+static size_t pagewidth = 612; /* page size in points - 8.5 inches */
+static size_t pageheight = 792; /* 11 inches */
static char *file_name;
static FILE *infp;
-void prolog(FILE *fp, char *name, int width, int height);
+void prolog(FILE *fp, char *name, int w, int h);
void postlog(FILE *fp);
static char usage[] = "\
@@ -133,9 +133,9 @@
main(int argc, char **argv)
{
FILE *ofp = stdout;
- int num = 0;
- int scans_per_patch, bytes_per_patch;
- int y;
+ size_t num = 0;
+ size_t scans_per_patch, bytes_per_patch;
+ size_t y;
outwidth = outheight = DEFAULT_SIZE;
@@ -161,7 +161,7 @@
for (y = 0; y < height; y += scans_per_patch) {
/* start a patch */
fprintf(ofp, "save\n");
- fprintf(ofp, "%d %d 8 [%d 0 0 %d 0 %d] {<\n ",
+ fprintf(ofp, "%ld %ld 8 [%ld 0 0 %ld 0 %ld] {<\n ",
width, scans_per_patch, /* patch size */
width, height, /* total size = 1.0 */
-y); /* patch y origin */
@@ -185,7 +185,7 @@
void
-prolog(FILE *fp, char *name, int width, int height)
+prolog(FILE *fp, char *name, int w, int h)
/* in points */
@@ -207,7 +207,7 @@
fputs("%%Creator: BRL-CAD bw-ps\n", fp);
fprintf(fp, "%%%%CreationDate: %s", ctime(<ime));
}
- fprintf(fp, "%%%%BoundingBox: 0 0 %d %d\n", width, height);
+ fprintf(fp, "%%%%BoundingBox: 0 0 %d %d\n", w, h);
fputs("%%EndComments\n\n", fp);
if (!encapsulated && landscape) {
@@ -216,15 +216,15 @@
pagewidth = pageheight;
pageheight = tmp;
fprintf(fp, "90 rotate\n");
- fprintf(fp, "0 -%d translate\n", pageheight);
+ fprintf(fp, "0 -%ld translate\n", pageheight);
}
if (!encapsulated && center) {
int xtrans, ytrans;
- xtrans = (pagewidth - width)/2.0;
- ytrans = (pageheight - height)/2.0;
+ xtrans = (pagewidth - w)/2.0;
+ ytrans = (pageheight - h)/2.0;
fprintf(fp, "%d %d translate\n", xtrans, ytrans);
}
- fprintf(fp, "%d %d scale\n\n", width, height);
+ fprintf(fp, "%d %d scale\n\n", w, h);
}
Modified: brlcad/trunk/src/util/bw-rle.c
===================================================================
--- brlcad/trunk/src/util/bw-rle.c 2010-11-30 14:12:17 UTC (rev 41480)
+++ brlcad/trunk/src/util/bw-rle.c 2010-11-30 14:15:40 UTC (rev 41481)
@@ -54,8 +54,8 @@
static int background[3];
-static int file_width = 512;
-static int file_height = 512;
+static size_t file_width = 512;
+static size_t file_height = 512;
static char usage[] = "\
Usage: pix-rle [-h] [-s squarefilesize] [-C bg]\n\
@@ -144,7 +144,7 @@
main(int argc, char **argv)
{
unsigned char *scan_buf;
- int y;
+ size_t y;
infp = stdin;
outfp = stdout;
@@ -195,7 +195,7 @@
for (y = 0; y < file_height; y++) {
if (fread((char *)scan_buf, sizeof(unsigned char), (size_t)file_width,
infp) != file_width) {
(void) fprintf(stderr,
- "pix-rle: read of %d pixels on line %d failed!\n",
+ "pix-rle: read of %ld pixels on line %ld failed!\n",
file_width, y);
bu_exit (1, NULL);
}
@@ -204,7 +204,7 @@
{
unsigned char *pp = scan_buf;
rle_pixel *rp = rows[0];
- int i;
+ size_t i;
for (i=0; i<file_width; i++) {
*rp++ = *pp++;
@@ -216,7 +216,8 @@
fclose(infp);
fclose(outfp);
- bu_exit (0, NULL);
+
+ return 0;
}
Modified: brlcad/trunk/src/util/bwcrop.c
===================================================================
--- brlcad/trunk/src/util/bwcrop.c 2010-11-30 14:12:17 UTC (rev 41480)
+++ brlcad/trunk/src/util/bwcrop.c 2010-11-30 14:15:40 UTC (rev 41481)
@@ -43,11 +43,11 @@
#define MAXBUFBYTES 1024*1024 /* max bytes to malloc in buffer space */
unsigned char *buffer;
-int scanlen; /* length of infile scanlines */
-int buflines; /* Number of lines held in buffer */
+size_t scanlen; /* length of infile scanlines */
+size_t buflines; /* Number of lines held in buffer */
int buf_start = -1000; /* First line in buffer */
-float xnum, ynum; /* Number of pixels in new file */
+float xnum, ynum; /* Number of pixels in new file */
float ulx, uly, urx, ury, lrx, lry, llx, lly; /* Corners of original file */
FILE *ifp, *ofp;
@@ -63,12 +63,12 @@
* XXX - CHECK FILE SIZE
*/
void
-init_buffer(int scanlen)
+init_buffer(int len)
{
int max;
/* See how many we could buffer */
- max = MAXBUFBYTES / scanlen;
+ max = MAXBUFBYTES / len;
/*
* Do a max of 512. We really should see how big
@@ -78,7 +78,7 @@
if (max > 512) max = 512;
buflines = max;
- buffer = (unsigned char *)bu_malloc(buflines * scanlen, "buffer");
+ buffer = (unsigned char *)bu_malloc(buflines * len, "buffer");
}
@@ -101,7 +101,7 @@
main(int argc, char **argv)
{
float row, col, x1, y1, x2, y2, x, y;
- int yindex;
+ size_t yindex;
char value;
if (argc < 3) {
@@ -127,9 +127,11 @@
llx = atoi(argv[12]);
lly = atoi(argv[13]);
} else {
+ unsigned long len;
/* Get info */
printf("Scanline length in input file: ");
- scanf("%d", &scanlen);
+ scanf("%lu", &len);
+ scanlen = len;
if (scanlen <= 0) {
bu_exit(4, "bwcrop: scanlen = %d, don't be ridiculous\n", scanlen);
}
@@ -172,7 +174,7 @@
/* Make sure we are in the buffer */
yindex = round(y) - buf_start;
- if (yindex < 0 || yindex >= buflines) {
+ if (yindex >= buflines) {
fill_buffer(round(y));
yindex = round(y) - buf_start;
}
Modified: brlcad/trunk/src/util/bwfilter.c
===================================================================
--- brlcad/trunk/src/util/bwfilter.c 2010-11-30 14:12:17 UTC (rev 41480)
+++ brlcad/trunk/src/util/bwfilter.c 2010-11-30 14:15:40 UTC (rev 41481)
@@ -212,7 +212,7 @@
if (verbose)
fprintf(stderr, "Max = %d, Min = %d\n", max, min);
- bu_exit (0, NULL);
+ return 0;
}
Modified: brlcad/trunk/src/util/bwhisteq.c
===================================================================
--- brlcad/trunk/src/util/bwhisteq.c 2010-11-30 14:12:17 UTC (rev 41480)
+++ brlcad/trunk/src/util/bwhisteq.c 2010-11-30 14:15:40 UTC (rev 41481)
@@ -29,6 +29,9 @@
#include <stdlib.h>
#include <ctype.h>
#include <string.h>
+#ifdef HAVE_UNISTD_H
+# include <unistd.h>
+#endif
#include "bu.h"
Modified: brlcad/trunk/src/util/bwscale.c
===================================================================
--- brlcad/trunk/src/util/bwscale.c 2010-11-30 14:12:17 UTC (rev 41480)
+++ brlcad/trunk/src/util/bwscale.c 2010-11-30 14:15:40 UTC (rev 41481)
@@ -177,12 +177,12 @@
* XXX - CHECK FILE SIZE
*/
void
-init_buffer(int scanlen)
+init_buffer(int len)
{
int max;
/* See how many we could buffer */
- max = MAXBUFBYTES / scanlen;
+ max = MAXBUFBYTES / len;
/*
* XXX We really should see how big
@@ -193,7 +193,7 @@
buflines = max;
buf_start = (-buflines);
- buffer = (unsigned char *)bu_calloc(buflines, scanlen, "buffer");
+ buffer = (unsigned char *)bu_calloc(buflines, len, "buffer");
}
Modified: brlcad/trunk/src/util/bwstat.c
===================================================================
--- brlcad/trunk/src/util/bwstat.c 2010-11-30 14:12:17 UTC (rev 41480)
+++ brlcad/trunk/src/util/bwstat.c 2010-11-30 14:15:40 UTC (rev 41481)
@@ -55,14 +55,14 @@
* Display the histogram values.
*/
void
-show_hist(long int *bin, int sum)
+show_hist(long int *histogram, int sum)
{
int i;
printf("Histogram:\n");
for (i = 0; i < 256; i++) {
- printf("%3d: %10ld (%10f)\n", i, bin[i], (float)bin[i]/sum * 100.0);
+ printf("%3d: %10ld (%10f)\n", i, histogram[i], (float)histogram[i]/sum
* 100.0);
}
}
Modified: brlcad/trunk/src/util/dbcp.c
===================================================================
--- brlcad/trunk/src/util/dbcp.c 2010-11-30 14:12:17 UTC (rev 41480)
+++ brlcad/trunk/src/util/dbcp.c 2010-11-30 14:15:40 UTC (rev 41481)
@@ -68,8 +68,8 @@
main(int argc, char **argv)
{
char *buffer;
- unsigned int size;
- unsigned int nread;
+ size_t size;
+ long nread;
int rfd; /* pipe to read message from */
int wfd; /* pipe to write message to */
int exitval=0;
@@ -134,7 +134,8 @@
exitval = 0;
count = 0L;
while (1) {
- if ((nread = bu_mread (0, buffer, size)) != size) {
+ nread = bu_mread (0, buffer, size);
+ if ((size_t)nread != size) {
saverrno = errno;
msgchar = STOP;
} else
@@ -144,7 +145,7 @@
bu_log("dbcp: (%s) ", pid ? "PARENT" : "CHILD");
bu_log("Can't send READ message\n");
}
- if ((int)nread == (-1)) {
+ if (nread == -1) {
errno = saverrno;
perror("dbcp input read:");
bu_log("dbcp: (%s) ", pid ? "PARENT" : "CHILD");
@@ -158,9 +159,9 @@
}
break;
}
- if (nread != size) {
+ if ((size_t)nread != size) {
bu_log("dbcp: (%s) ", pid ? "PARENT" : "CHILD");
- bu_log("partial read (nread = %u)\n", nread);
+ bu_log("partial read (nread = %ld)\n", nread);
}
if (read(rfd, &msgchar, 1) != 1) {
perror("dbcp: WRITE message error");
@@ -188,7 +189,7 @@
bu_log("dbcp: (%s) ", pid ? "PARENT" : "CHILD");
bu_log("wrote %d\n", nread);
}
- if (nread != size) {
+ if ((size_t)nread != size) {
break;
}
childstart:
Modified: brlcad/trunk/src/util/decimate.c
===================================================================
--- brlcad/trunk/src/util/decimate.c 2010-11-30 14:12:17 UTC (rev 41480)
+++ brlcad/trunk/src/util/decimate.c 2010-11-30 14:15:40 UTC (rev 41481)
@@ -44,26 +44,26 @@
Usage: decimate nbytes/pixel width height [outwidth outheight]\n\
";
-int nbytes;
-int iwidth;
-int iheight;
-int owidth = 512;
-int oheight = 512;
+size_t nbytes;
+size_t iwidth;
+size_t iheight;
+size_t owidth = 512;
+size_t oheight = 512;
unsigned char *iline;
unsigned char *oline;
-int discard;
-int wpad;
+size_t discard;
+size_t wpad;
int
main(int argc, char **argv)
{
- int i;
- int j;
- int nh, nw;
- int dh, dw;
- int todo;
+ size_t i;
+ size_t j;
+ size_t nh, nw;
+ size_t dh, dw;
+ size_t todo;
if (argc < 4) {
fputs(usage, stderr);
@@ -99,16 +99,14 @@
todo = iwidth / (discard+1) * (discard+1);
if (owidth < todo) todo = owidth;
if (todo > iwidth/(discard+1)) todo = iwidth/(discard+1);
-#if 0
- fprintf(stderr, "dh=%d dw=%d, discard=%d\n", dh, dw, discard);
- fprintf(stderr, "todo=%d\n", todo);
-#endif
while (!feof(stdin)) {
+ size_t ret;
unsigned char *ip, *op;
/* Scrunch down first scanline of input data */
- if (fread(iline, nbytes, iwidth, stdin) != iwidth) break;
+ ret = fread(iline, nbytes, iwidth, stdin);
+ if (ret != iwidth) break;
ip = iline;
op = oline;
for (i=0; i < todo; i++) {
Modified: brlcad/trunk/src/util/dpix-pix.c
===================================================================
--- brlcad/trunk/src/util/dpix-pix.c 2010-11-30 14:12:17 UTC (rev 41480)
+++ brlcad/trunk/src/util/dpix-pix.c 2010-11-30 14:15:40 UTC (rev 41481)
@@ -45,8 +45,8 @@
int
main(int argc, char **argv)
{
- int count; /* count of items */
- int got; /* count of bytes */
+ size_t count; /* count of items */
+ ssize_t got; /* count of bytes */
int fd; /* UNIX file descriptor */
double *dp; /* ptr to d */
double *ep;
@@ -137,7 +137,7 @@
/* fd 1 is stdout */
got = write(1, (char *)&cha[0], count*sizeof(cha[0]));
- if (got != count*sizeof(cha[0])) {
+ if (got < 0 || (size_t)got != count*sizeof(cha[0])) {
perror("write");
exit(2);
}
Modified: brlcad/trunk/src/util/dsp_add.c
===================================================================
--- brlcad/trunk/src/util/dsp_add.c 2010-11-30 14:12:17 UTC (rev 41480)
+++ brlcad/trunk/src/util/dsp_add.c 2010-11-30 14:15:40 UTC (rev 41481)
@@ -146,7 +146,7 @@
add_int(unsigned short *buf1, unsigned short *buf2, unsigned long count)
{
int int_value;
- int i;
+ unsigned long i;
unsigned short s;
for (i=0; i < count; i++) {
Modified: brlcad/trunk/src/util/dunncomm.c
===================================================================
--- brlcad/trunk/src/util/dunncomm.c 2010-11-30 14:12:17 UTC (rev 41480)
+++ brlcad/trunk/src/util/dunncomm.c 2010-11-30 14:15:40 UTC (rev 41481)
@@ -95,7 +95,7 @@
int polaroid = 0; /* 0 = aux camera, 1 = Polaroid 8x10 */
void
-unsnooze(int x)
+unsnooze(int UNUSED(x))
{
bu_exit(1, "\007dunnsnap: request timed out, aborting\n");
}
Modified: brlcad/trunk/src/util/dunnsnap.c
===================================================================
--- brlcad/trunk/src/util/dunnsnap.c 2010-11-30 14:12:17 UTC (rev 41480)
+++ brlcad/trunk/src/util/dunnsnap.c 2010-11-30 14:15:40 UTC (rev 41481)
@@ -156,12 +156,14 @@
}
if (fbp != FBIO_NULL)
fb_close(fbp);
- bu_exit (0, NULL);
+ return 0;
+
bad:
if (fbp != FBIO_NULL)
fb_close(fbp);
- bu_exit (1, NULL);
+
+ return 1;
}
Modified: brlcad/trunk/src/util/fix_polysolids.c
===================================================================
--- brlcad/trunk/src/util/fix_polysolids.c 2010-11-30 14:12:17 UTC (rev
41480)
+++ brlcad/trunk/src/util/fix_polysolids.c 2010-11-30 14:15:40 UTC (rev
41481)
@@ -45,11 +45,6 @@
main(int argc, char *argv[])
{
static int verbose;
- static char *out_file = NULL; /* Output filename */
- static FILE *fp_out; /* Output file pointer */
- static FILE *fp_in; /* input file pointer */
-
- static struct rt_tess_tol ttol;
static struct bn_tol tol;
static const char usage[] = "Usage: %s [-v] [-xX lvl] < brlcad_db.g > new
db.g\n\
@@ -78,14 +73,17 @@
/* Get command line arguments. */
while ((c = bu_getopt(argc, argv, "vx:X:")) != EOF) {
switch (c) {
+ unsigned int debug;
case 'v':
verbose++;
break;
case 'x':
- sscanf(bu_optarg, "%x", &rt_g.debug);
+ sscanf(bu_optarg, "%x", &debug);
+ rt_g.debug = debug;
break;
case 'X':
- sscanf(bu_optarg, "%x", &rt_g.NMG_debug);
+ sscanf(bu_optarg, "%x", &debug);
+ rt_g.NMG_debug = debug;
break;
default:
bu_exit(1, usage, argv[0]);
@@ -162,6 +160,8 @@
}
}
bu_ptbl_free(&faces);
+
+ return 0;
}
Modified: brlcad/trunk/src/util/imgdims.c
===================================================================
--- brlcad/trunk/src/util/imgdims.c 2010-11-30 14:12:17 UTC (rev 41480)
+++ brlcad/trunk/src/util/imgdims.c 2010-11-30 14:15:40 UTC (rev 41481)
@@ -35,6 +35,7 @@
#include "bu.h"
#include "vmath.h"
#include "bn.h"
+#include "fb.h"
#define BELIEVE_NAME 0
@@ -164,7 +165,8 @@
bu_exit (0, NULL);
done:
- bu_exit (0, "%lu %lu\n", width, height);
+ bu_log("%lu %lu\n", width, height);
+ return 0;
}
Modified: brlcad/trunk/src/util/loop.c
===================================================================
--- brlcad/trunk/src/util/loop.c 2010-11-30 14:12:17 UTC (rev 41480)
+++ brlcad/trunk/src/util/loop.c 2010-11-30 14:15:40 UTC (rev 41481)
@@ -40,6 +40,7 @@
#include <math.h>
#include "bu.h"
+#include "vmath.h"
#define INTEGER 0
@@ -72,7 +73,9 @@
/* determine if any arguments are real */
for (i = 1; i < argc; i++) {
- if (atof(argv[i]) != ((double)atoi(argv[i]))) {
+ double dval = atof(argv[i]);
+ int ival = atoi(argv[i]);
+ if (!NEAR_ZERO(dval - (double)ival, SMALL_FASTF)) {
status = REAL;
break;
}
Modified: brlcad/trunk/src/util/lowp.c
===================================================================
--- brlcad/trunk/src/util/lowp.c 2010-11-30 14:12:17 UTC (rev 41480)
+++ brlcad/trunk/src/util/lowp.c 2010-11-30 14:15:40 UTC (rev 41481)
@@ -28,6 +28,10 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include <fcntl.h>
+#ifdef HAVE_UNISTD_H
+# include <unistd.h>
+#endif
#include "bu.h"
Modified: brlcad/trunk/src/util/mac-pix.c
===================================================================
--- brlcad/trunk/src/util/mac-pix.c 2010-11-30 14:12:17 UTC (rev 41480)
+++ brlcad/trunk/src/util/mac-pix.c 2010-11-30 14:15:40 UTC (rev 41481)
@@ -325,7 +325,8 @@
for (y = 0; y < y3; y++)
fwrite(black, scr_width, 3, stdout);
}
- bu_exit (0, NULL);
+
+ return 0;
}
Modified: brlcad/trunk/src/util/pl-X.c
===================================================================
--- brlcad/trunk/src/util/pl-X.c 2010-11-30 14:12:17 UTC (rev 41480)
+++ brlcad/trunk/src/util/pl-X.c 2010-11-30 14:15:40 UTC (rev 41481)
@@ -210,25 +210,25 @@
void
-draw(double x1, double y1, double z1, double x2, double y2, double z2)
+draw(double x_1, double y_1, double UNUSED(z_1), double x_2, double y_2,
double z_2)
/* from point */
/* to point */
{
- int sx1, sy1, sx2, sy2;
+ int sx_1, sy_1, sx_2, sy_2;
- sx1 = (x1 - sp[0]) / (sp[3] - sp[0]) * width;
- sy1 = height - (y1 - sp[1]) / (sp[4] - sp[1]) * height;
- sx2 = (x2 - sp[0]) / (sp[3] - sp[0]) * width;
- sy2 = height - (y2 - sp[1]) / (sp[4] - sp[1]) * height;
+ sx_1 = (x_1 - sp[0]) / (sp[3] - sp[0]) * width;
+ sy_1 = height - (y_1 - sp[1]) / (sp[4] - sp[1]) * height;
+ sx_2 = (x_2 - sp[0]) / (sp[3] - sp[0]) * width;
+ sy_2 = height - (y_2 - sp[1]) / (sp[4] - sp[1]) * height;
- if (sx1 == sx2 && sy1 == sy2)
- XDrawPoint(dpy, win, gc, sx1, sy1);
+ if (sx_1 == sx_2 && sy_1 == sy_2)
+ XDrawPoint(dpy, win, gc, sx_1, sy_1);
else
- XDrawLine(dpy, win, gc, sx1, sy1, sx2, sy2);
+ XDrawLine(dpy, win, gc, sx_1, sy_1, sx_2, sy_2);
- cx = x2;
- cy = y2;
- cz = z2;
+ cx = x_2;
+ cy = y_2;
+ cz = z_2;
}
Modified: brlcad/trunk/src/util/pl-dm.c
===================================================================
--- brlcad/trunk/src/util/pl-dm.c 2010-11-30 14:12:17 UTC (rev 41480)
+++ brlcad/trunk/src/util/pl-dm.c 2010-11-30 14:15:40 UTC (rev 41481)
@@ -58,7 +58,7 @@
#define MOUSE_MODE_ZOOM 4
#define APP_SCALE 180.0 / 512.0
-Tcl_Interp *interp;
+Tcl_Interp *INTERP;
struct dm *dmp;
mat_t toViewcenter;
mat_t Viewrot;
@@ -351,7 +351,7 @@
* Event handler for the X display manager.
*/
static int
-X_doEvent(ClientData clientData, XEvent *eventPtr)
+X_doEvent(ClientData UNUSED(clientData), XEvent *eventPtr)
{
double app_scale = APP_SCALE;
@@ -397,7 +397,7 @@
val = 1.0 + (omy - my) /
(fastf_t)dmp->dm_height;
- zoom(interp, val);
+ zoom(INTERP, val);
new_mats();
refresh();
}
@@ -431,7 +431,7 @@
start_catching_output(&tmp_vls);
stop_catching_output(&tmp_vls);
- Tcl_AppendResult(interp, bu_vls_addr(&tmp_vls), (char *)NULL);
+ Tcl_AppendResult(INTERP, bu_vls_addr(&tmp_vls), (char *)NULL);
bu_vls_free(&tmp_vls);
return TCL_OK;
}
@@ -440,7 +440,7 @@
vect_t view_pos;
if (argc < 4) {
- Tcl_AppendResult(interp, "dm m: need more parameters\n",
+ Tcl_AppendResult(INTERP, "dm m: need more parameters\n",
"dm m button 1|0 xpos ypos\n", (char *)NULL);
return TCL_ERROR;
}
@@ -459,7 +459,7 @@
int buttonpress;
if (argc < 5) {
- Tcl_AppendResult(interp, "dm am: need more parameters\n",
+ Tcl_AppendResult(INTERP, "dm am: need more parameters\n",
"dm am <r|t|z> 1|0 xpos ypos\n", (char *)NULL);
return TCL_ERROR;
}
@@ -566,7 +566,7 @@
* Open one or more plot files.
*/
static int
-cmd_openpl(ClientData clientData, Tcl_Interp *interp, int argc, char **argv)
+cmd_openpl(ClientData UNUSED(clientData), Tcl_Interp *interp, int argc, char
**argv)
{
static int not_first = 0;
int i;
@@ -653,7 +653,7 @@
* Rotate the view.
*/
static int
-cmd_vrot(ClientData clientData, Tcl_Interp *interp, int argc, char **argv)
+cmd_vrot(ClientData UNUSED(clientData), Tcl_Interp *interp, int argc, char
**argv)
{
if (argc != 4) {
struct bu_vls vls;
@@ -677,7 +677,7 @@
* Do display manager specific commands.
*/
static int
-cmd_dm(ClientData clientData, Tcl_Interp *interp, int argc, char **argv)
+cmd_dm(ClientData UNUSED(clientData), Tcl_Interp *interp, int argc, char
**argv)
{
if (argc < 2) {
struct bu_vls vls;
@@ -700,7 +700,7 @@
* Clear the screen.
*/
static int
-cmd_clear(ClientData clientData, Tcl_Interp *interp, int argc, char **argv)
+cmd_clear(ClientData UNUSED(clientData), Tcl_Interp *interp, int argc, char
**UNUSED(argv))
{
struct plot_list *plp;
@@ -726,7 +726,7 @@
* Close the specified plots.
*/
static int
-cmd_closepl(ClientData clientData, Tcl_Interp *interp, int argc, char **argv)
+cmd_closepl(ClientData UNUSED(clientData), Tcl_Interp *interp, int argc, char
**argv)
{
int i;
struct plot_list *plp;
@@ -762,7 +762,7 @@
* Draw the specified plots.
*/
static int
-cmd_draw(ClientData clientData, Tcl_Interp *interp, int argc, char **argv)
+cmd_draw(ClientData UNUSED(clientData), Tcl_Interp *interp, int argc, char
**argv)
{
int i;
struct plot_list *plp;
@@ -795,7 +795,7 @@
* Erase the specified plots.
*/
static int
-cmd_erase(ClientData clientData, Tcl_Interp *interp, int argc, char **argv)
+cmd_erase(ClientData UNUSED(clientData), Tcl_Interp *interp, int argc, char
**argv)
{
int i;
struct plot_list *plp;
@@ -828,7 +828,7 @@
* Print a list of the load plot objects.
*/
static int
-cmd_list(ClientData clientData, Tcl_Interp *interp, int argc, char **argv)
+cmd_list(ClientData UNUSED(clientData), Tcl_Interp *interp, int argc, char
**UNUSED(argv))
{
struct plot_list *plp;
int len;
@@ -871,7 +871,7 @@
* (i.e., a zoom out) which is accomplished by reducing Viewscale in half.
*/
static int
-cmd_zoom(ClientData clientData, Tcl_Interp *interp, int argc, char **argv)
+cmd_zoom(ClientData UNUSED(clientData), Tcl_Interp *interp, int argc, char
**argv)
{
int status;
double val;
@@ -896,7 +896,7 @@
static int
-cmd_reset(ClientData clientData, Tcl_Interp *interp, int argc, char **argv)
+cmd_reset(ClientData UNUSED(clientData), Tcl_Interp *UNUSED(interp), int
UNUSED(argc), char **UNUSED(argv))
{
size_reset();
new_mats();
@@ -913,7 +913,7 @@
* make that point the new view center.
*/
static int
-cmd_slewview(ClientData clientData, Tcl_Interp *interp, int argc, char **argv)
+cmd_slewview(ClientData UNUSED(clientData), Tcl_Interp *interp, int argc, char
**argv)
{
int status;
vect_t view_pos;
@@ -942,7 +942,7 @@
/* set view using azimuth, elevation and twist angles */
static int
-cmd_aetview(ClientData clientData, Tcl_Interp *interp, int argc, char **argv)
+cmd_aetview(ClientData UNUSED(clientData), Tcl_Interp *interp, int argc, char
**argv)
{
fastf_t azimuth = (fastf_t)0.0;
fastf_t elevation = (fastf_t)0.0;
@@ -1005,7 +1005,7 @@
* Exit.
*/
static int
-cmd_exit(ClientData clientData, Tcl_Interp *interp, int argc, char **argv)
+cmd_exit(ClientData UNUSED(clientData), Tcl_Interp *UNUSED(interp), int
UNUSED(argc), char **UNUSED(argv))
{
if (dmp != DM_NULL)
DM_CLOSE(dmp);
@@ -1071,8 +1071,8 @@
av[2] = "sampler_bind_dm";
av[3] = (char *)NULL;
- if ((dmp = DM_OPEN(interp, DM_TYPE_X, 3, av)) == DM_NULL) {
- Tcl_AppendResult(interp, "Failed to open a display manager\n", (char
*)NULL);
+ if ((dmp = DM_OPEN(INTERP, DM_TYPE_X, 3, av)) == DM_NULL) {
+ Tcl_AppendResult(INTERP, "Failed to open a display manager\n", (char
*)NULL);
return TCL_ERROR;
}
@@ -1097,8 +1097,8 @@
av[2] = "sampler_bind_dm";
av[3] = (char *)NULL;
- if ((dmp = DM_OPEN(interp, DM_TYPE_OGL, 3, av)) == DM_NULL) {
- Tcl_AppendResult(interp, "Failed to open a display manager\n", (char
*)NULL);
+ if ((dmp = DM_OPEN(INTERP, DM_TYPE_OGL, 3, av)) == DM_NULL) {
+ Tcl_AppendResult(INTERP, "Failed to open a display manager\n", (char
*)NULL);
return TCL_ERROR;
}
@@ -1118,7 +1118,7 @@
struct bu_vls str2;
/* libdm uses interp */
- interp = _interp;
+ INTERP = _interp;
switch (dm_type) {
case DM_TYPE_OGL:
@@ -1129,17 +1129,17 @@
}
/* Evaluates init.tcl */
- if (Tcl_Init(interp) == TCL_ERROR)
- bu_exit (1, "Tcl_Init error %s\n", Tcl_GetStringResult(interp));
+ if (Tcl_Init(_interp) == TCL_ERROR)
+ bu_exit (1, "Tcl_Init error %s\n", Tcl_GetStringResult(_interp));
/*
* Creates the main window and registers all of Tk's commands
* into the interpreter.
*/
- if (Tk_Init(interp) == TCL_ERROR)
- bu_exit (1, "Tk_Init error %s\n", Tcl_GetStringResult(interp));
+ if (Tk_Init(_interp) == TCL_ERROR)
+ bu_exit (1, "Tk_Init error %s\n", Tcl_GetStringResult(_interp));
- if ((tkwin = Tk_MainWindow(interp)) == NULL)
+ if ((tkwin = Tk_MainWindow(_interp)) == NULL)
bu_exit (1, "appInit: Failed to get main window.\n");
/* Locate the BRL-CAD-specific Tcl scripts */
@@ -1150,12 +1150,12 @@
bu_vls_printf(&str2, "%s/pl-dm", filename);
bu_vls_printf(&str, "wm withdraw .; set auto_path [linsert $auto_path 0 %s
%s]",
bu_vls_addr(&str2), filename);
- (void)Tcl_Eval(interp, bu_vls_addr(&str));
+ (void)Tcl_Eval(_interp, bu_vls_addr(&str));
bu_vls_free(&str);
bu_vls_free(&str2);
/* application commands */
- cmd_setup(interp, cmdtab);
+ cmd_setup(_interp, cmdtab);
/* open display manager */
switch (dm_type) {
@@ -1184,14 +1184,13 @@
MAT_IDN(model2view);
MAT_IDN(view2model);
- if (cmd_openpl((ClientData)NULL, (Tcl_Interp *)NULL,
- argc-bu_optind+1, argv+bu_optind-1) == TCL_ERROR)
+ if (cmd_openpl((ClientData)NULL, (Tcl_Interp *)NULL, argc-bu_optind+1,
argv+bu_optind-1) == TCL_ERROR)
bu_exit (1, NULL);
argv[1] = (char *)NULL;
Tk_Main(1, argv, appInit);
- bu_exit (0, NULL);
+ return 0;
}
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
Increase Visibility of Your 3D Game App & Earn a Chance To Win $500!
Tap into the largest installed PC base & get more eyes on your game by
optimizing for Intel(R) Graphics Technology. Get started today with the
Intel(R) Software Partner Program. Five $500 cash prizes are up for grabs.
http://p.sf.net/sfu/intelisp-dev2dev
_______________________________________________
BRL-CAD Source Commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/brlcad-commits