Revision: 41230
http://brlcad.svn.sourceforge.net/brlcad/?rev=41230&view=rev
Author: brlcad
Date: 2010-11-02 17:38:11 +0000 (Tue, 02 Nov 2010)
Log Message:
-----------
quell verbose strict warnings on linux
Modified Paths:
--------------
brlcad/trunk/src/anim/anim_fly.c
brlcad/trunk/src/anim/anim_hardtrack.c
brlcad/trunk/src/anim/anim_keyread.c
brlcad/trunk/src/anim/anim_script.c
brlcad/trunk/src/anim/anim_track.c
brlcad/trunk/src/anim/anim_turn.c
brlcad/trunk/src/anim/chan_permute.c
Modified: brlcad/trunk/src/anim/anim_fly.c
===================================================================
--- brlcad/trunk/src/anim/anim_fly.c 2010-11-02 14:57:15 UTC (rev 41229)
+++ brlcad/trunk/src/anim/anim_fly.c 2010-11-02 17:38:11 UTC (rev 41230)
@@ -223,9 +223,13 @@
/* read first two lines of table to determine the time step used */
/* (a constant time step is assumed throughout the rest of the file)*/
- scanf("%lf %lf %lf %lf", first, first+1, first+2, first+3);
- scanf("%lf %lf %lf %lf", second, second+1, second+2, second+3);
+ count = scanf("%lf %lf %lf %lf", first, first+1, first+2, first+3);
+ count += scanf("%lf %lf %lf %lf", second, second+1, second+2, second+3);
stepsize = second[0]-first[0];
+
+ if (count != 8) {
+ bu_exit(1, "%s: ERROR: expecting at least eight values (in the first
two lines of the table) to determine the time step used\n", argv[0]);
+ }
/* determine n, the number of points to store ahead and behind the
* current point. 2n points are stored, minimum enn=2
Modified: brlcad/trunk/src/anim/anim_hardtrack.c
===================================================================
--- brlcad/trunk/src/anim/anim_hardtrack.c 2010-11-02 14:57:15 UTC (rev
41229)
+++ brlcad/trunk/src/anim/anim_hardtrack.c 2010-11-02 17:38:11 UTC (rev
41230)
@@ -315,6 +315,8 @@
VSETALL(to_track, 0.0);
VSETALL(centroid, 0.0);
VSETALL(rcentroid, 0.0);
+ VSETALL(wheel_now, 0.0);
+ VSETALL(wheel_prev, 0.0);
init_dist = y_rot = radius= 0.0;
first_frame = num_wheels = steer = axes = cent = links_placed=0;
num_wheels = num_links = last_frame = 0;
@@ -344,12 +346,16 @@
num_wheels = -1;
if (!NEAR_ZERO(radius, SMALL_FASTF)) {
while (!feof(stream)) {
- fscanf(stream, "%*f %*f %*f");
+ count = fscanf(stream, "%*f %*f %*f");
+ if (count != 3)
+ break;
num_wheels++;
}
} else {
while (!feof(stream)) {
- fscanf(stream, "%*f %*f %*f %*f");
+ count = fscanf(stream, "%*f %*f %*f %*f");
+ if (count != 4)
+ break;
num_wheels++;
}
}
@@ -359,11 +365,16 @@
x = (struct all *) bu_calloc(num_wheels, sizeof(struct all), "struct all");
/*read rest of track info */
for (i=0;i<NW;i++) {
- fscanf(stream, "%lf %lf %lf", temp, temp+1, temp+2);
+ count = fscanf(stream, "%lf %lf %lf", temp, temp+1, temp+2);
+ if (count != 3)
+ break;
if (!NEAR_ZERO(radius, SMALL_FASTF))
x[i].w.rad = radius;
- else
- fscanf(stream, "%lf", & x[i].w.rad);
+ else {
+ count = fscanf(stream, "%lf", & x[i].w.rad);
+ if (count != 1)
+ break;
+ }
MAT4X3PNT(x[i].w.pos, m_rev_axes, temp);
if (i==0)
track_y = x[0].w.pos[1];
@@ -398,10 +409,13 @@
/*p2 is current position. p3 is next;p1 is previous*/
VMOVE(p1, p2);
VMOVE(p2, p3);
- scanf("%*f");/*time stamp*/
+ count = scanf("%*f");/*time stamp*/
val = scanf("%lf %lf %lf", p3, p3+1, p3 + 2);
if (!steer) {
- scanf("%lf %lf %lf", &yaw, &pitch, &roll);
+ count = scanf("%lf %lf %lf", &yaw, &pitch, &roll);
+ if (count != 3) {
+ bu_exit(2, "Unexpected/Missing raw, pitch, roll value(s)! Read
%d values.\n", count);
+ }
anim_dy_p_r2mat(mat_v, yaw, pitch, roll);
anim_add_trans(mat_v, p3, rcentroid);
} else {
Modified: brlcad/trunk/src/anim/anim_keyread.c
===================================================================
--- brlcad/trunk/src/anim/anim_keyread.c 2010-11-02 14:57:15 UTC (rev
41229)
+++ brlcad/trunk/src/anim/anim_keyread.c 2010-11-02 17:38:11 UTC (rev
41230)
@@ -103,6 +103,7 @@
{
int c;
fastf_t time, viewsize;
+ int count;
fastf_t eyept[3], viewrot[16], angle[3], quat[4];
@@ -111,21 +112,22 @@
while (!feof(stdin)) {
/* read one keyframe */
- scanf("%lf", &time);
- scanf("%lf", &viewsize);
- scanf("%lf %lf %lf", eyept, eyept+1, eyept+2);
+ count = 0;
+
+ count += scanf("%lf", &time);
+ count += scanf("%lf", &viewsize);
+ count += scanf("%lf %lf %lf", eyept, eyept+1, eyept+2);
/* read in transposed matrix */
- scanf("%lf %lf %lf %lf", viewrot+0, viewrot+4, viewrot+8, viewrot+12);
- scanf("%lf %lf %lf %lf", viewrot+1, viewrot+5, viewrot+9, viewrot+13);
- scanf("%lf %lf %lf %lf", viewrot+2, viewrot+6, viewrot+10, viewrot+14);
- scanf("%lf %lf %lf %lf", viewrot+3, viewrot+7, viewrot+11, viewrot+15);
+ count += scanf("%lf %lf %lf %lf", viewrot+0, viewrot+4, viewrot+8,
viewrot+12);
+ count += scanf("%lf %lf %lf %lf", viewrot+1, viewrot+5, viewrot+9,
viewrot+13);
+ count += scanf("%lf %lf %lf %lf", viewrot+2, viewrot+6, viewrot+10,
viewrot+14);
+ count += scanf("%lf %lf %lf %lf", viewrot+3, viewrot+7, viewrot+11,
viewrot+15);
- if (feof(stdin)) break;
+ if (feof(stdin) || count != 21)
+ break;
- printf("%.10g\t%.10g\t%.10g\t%.10g\t%.10g\t", time, viewsize,
- eyept[0], eyept[1], eyept[2]);
+ printf("%.10g\t%.10g\t%.10g\t%.10g\t%.10g\t", time, viewsize, eyept[0],
eyept[1], eyept[2]);
-
if (mode==YPR) {
anim_v_unpermute(viewrot);
c = anim_mat2ypr(angle, viewrot);
Modified: brlcad/trunk/src/anim/anim_script.c
===================================================================
--- brlcad/trunk/src/anim/anim_script.c 2010-11-02 14:57:15 UTC (rev 41229)
+++ brlcad/trunk/src/anim/anim_script.c 2010-11-02 17:38:11 UTC (rev 41230)
@@ -182,17 +182,17 @@
/* read one line of table */
val = scanf("%*f"); /*ignore time */
if (readview)
- scanf("%lf", &viewsize);
+ val = scanf("%lf", &viewsize);
if (translate)
- val=scanf("%lf %lf %lf", point, point+1, point+2);
+ val = scanf("%lf %lf %lf", point, point+1, point+2);
if (rotate&&quaternion) {
val = scanf("%lf %lf %lf %lf", quat, quat+1, quat+2, quat+3);
val -= 1;
} else if (rotate) {
- val=scanf("%lf %lf %lf", &yaw, &pitch, &roll);
+ val = scanf("%lf %lf %lf", &yaw, &pitch, &roll);
}
- if (val < 3) {
+ if (val < 3 && !readview) {
/* ie. scanf not completely successful */
/* with steering option, must go extra loop after end of file */
if (steer && !last_steer)
Modified: brlcad/trunk/src/anim/anim_track.c
===================================================================
--- brlcad/trunk/src/anim/anim_track.c 2010-11-02 14:57:15 UTC (rev 41229)
+++ brlcad/trunk/src/anim/anim_track.c 2010-11-02 17:38:11 UTC (rev 41230)
@@ -441,6 +441,8 @@
VSETALL(to_track, 0.0);
VSETALL(centroid, 0.0);
VSETALL(rcentroid, 0.0);
+ VSETALL(wheel_now, 0.0);
+ VSETALL(wheel_prev, 0.0);
y_rot = 0.0;
num_wheels = 0;
last_steer = last_frame = 0;
@@ -467,12 +469,16 @@
num_wheels = -1;
if (one_radius) {
while (!feof(stream)) {
- fscanf(stream, "%*f %*f %*f");
+ count = fscanf(stream, "%*f %*f %*f");
+ if (count != 3)
+ break;
num_wheels++;
}
} else {
while (!feof(stream)) {
- fscanf(stream, "%*f %*f %*f %*f");
+ count = fscanf(stream, "%*f %*f %*f %*f");
+ if (count != 3)
+ break;
num_wheels++;
}
}
@@ -487,11 +493,14 @@
/*read original wheel positions*/
for (i=0;i<NW;i++) {
- fscanf(stream, "%lf %lf %lf", temp, temp+1, temp+2);
+ count = fscanf(stream, "%lf %lf %lf", temp, temp+1, temp+2);
+ if (count != 3)
+ break;
+
if (one_radius)
x[i].w.rad = radius;
else
- fscanf(stream, "%lf", & x[i].w.rad);
+ count = fscanf(stream, "%lf", & x[i].w.rad);
MAT4X3PNT(x[i].w.pos, m_rev_axes, temp);
if (i==0)
track_y = x[0].w.pos[1];
@@ -519,7 +528,7 @@
if (dist_mode==STEERED) {
/* prime the pumps */
- scanf("%*f");/*time*/
+ val = scanf("%*f");/*time*/
val = scanf("%lf %lf %lf", cent_pos, cent_pos+1, cent_pos + 2);
if (val < 3)
return 0;
@@ -538,14 +547,14 @@
frame = first_frame;
for (; ; frame++) {
if (dist_mode==GIVEN) {
- scanf("%*f");/*time*/
+ val = scanf("%*f");/*time*/
val = scanf("%lf", &distance);
if (val < 1) {
break;
}
} else if (dist_mode==CALCULATED) {
- scanf("%*f");/*time*/
- scanf("%lf %lf %lf", cent_pos, cent_pos+1, cent_pos+2);
+ val = scanf("%*f");/*time*/
+ val = scanf("%lf %lf %lf", cent_pos, cent_pos+1, cent_pos+2);
val = scanf("%lf %lf %lf", &yaw, &pch, &roll);
if (val < 3)
break;
@@ -557,7 +566,7 @@
if (read_wheels) {
/* read in all wheel positions */
for (i=0;i<NW;i++) {
- val=scanf("%lf %lf", x[i].w.pos, x[i].w.pos + 2);
+ val = scanf("%lf %lf", x[i].w.pos, x[i].w.pos + 2);
if (val < 2) {
break;
}
@@ -565,7 +574,7 @@
}
if (dist_mode==STEERED) {
- scanf("%*f");/*time*/
+ val = scanf("%*f");/*time*/
val = scanf("%lf %lf %lf", cent_pos, cent_pos+1, cent_pos + 2);
if (val < 3) {
if (last_steer)
Modified: brlcad/trunk/src/anim/anim_turn.c
===================================================================
--- brlcad/trunk/src/anim/anim_turn.c 2010-11-02 14:57:15 UTC (rev 41229)
+++ brlcad/trunk/src/anim/anim_turn.c 2010-11-02 17:38:11 UTC (rev 41230)
@@ -109,10 +109,16 @@
if (!angle_set) {
/* set angle if not yet done */
- scanf("%*f%*[^-0123456789]");
- VSCAN(temp1);
- scanf("%*f%*[^-0123456789]");
- VSCAN(temp2);
+ count = scanf("%*f%*[^-0123456789]");
+ count = VSCAN(temp1);
+ if (count != 3)
+ return 1;
+
+ count = scanf("%*f%*[^-0123456789]");
+ count = VSCAN(temp2);
+ if (count != 3)
+ return 1;
+
angle = bn_atan2((temp2[1]-temp1[1]), (temp2[0]-temp1[0]));
rewind(stdin);
}
Modified: brlcad/trunk/src/anim/chan_permute.c
===================================================================
--- brlcad/trunk/src/anim/chan_permute.c 2010-11-02 14:57:15 UTC (rev
41229)
+++ brlcad/trunk/src/anim/chan_permute.c 2010-11-02 17:38:11 UTC (rev
41230)
@@ -66,7 +66,7 @@
main(int argc, char *argv[])
{
int i, j, maxlength, num_done;
- int icount, ocount;
+ int count, icount, ocount;
struct unit *x, *y;
Word *arrayd;
@@ -122,11 +122,13 @@
if (num_done >= icount)
;/*chill - all in files done */
else if (x->i_o == 1) {
- if (feof(x->file))
+ if (feof(x->file)) {
num_done += 1;
- else
- for (j=0;j<x->channels;j++)
- fscanf(x->file, "%40s ", arrayd[x->list[j]]);
+ } else {
+ for (j=0;j<x->channels;j++) {
+ count = fscanf(x->file, "%40s ", arrayd[x->list[j]]);
+ }
+ }
} else if (x->i_o == 0) {
for (j=0;j<x->channels;j++)
fprintf(x->file, "%s\t", arrayd[x->list[j]]);
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
Nokia and AT&T present the 2010 Calling All Innovators-North America contest
Create new apps & games for the Nokia N8 for consumers in U.S. and Canada
$10 million total in prizes - $4M cash, 500 devices, nearly $6M in marketing
Develop with Nokia Qt SDK, Web Runtime, or Java and Publish to Ovi Store
http://p.sf.net/sfu/nokia-dev2dev
_______________________________________________
BRL-CAD Source Commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/brlcad-commits