Revision: 42210
http://brlcad.svn.sourceforge.net/brlcad/?rev=42210&view=rev
Author: brlcad
Date: 2011-01-13 05:07:34 +0000 (Thu, 13 Jan 2011)
Log Message:
-----------
more fixing of warnings from erik's linux build log. don't ignore the return
values from fread/fwrite/read/write/scanf.
Modified Paths:
--------------
brlcad/trunk/src/fb/cat-fb.c
brlcad/trunk/src/fb/fb-bw.c
brlcad/trunk/src/fb/pl-fb.c
brlcad/trunk/src/fb/pp-fb.c
Modified: brlcad/trunk/src/fb/cat-fb.c
===================================================================
--- brlcad/trunk/src/fb/cat-fb.c 2011-01-13 05:06:30 UTC (rev 42209)
+++ brlcad/trunk/src/fb/cat-fb.c 2011-01-13 05:07:34 UTC (rev 42210)
@@ -928,6 +928,7 @@
int l;
for (l = 0; l < nlines; l++) {
+ size_t ret;
if (cur_fb_line < 0 ) {
/* Ran off bottom of screen */
if ( fbp )
@@ -959,10 +960,15 @@
}
buf++;
}
- if ( output_pix )
- fwrite( scanline, scr_width*3, 1, stdout );
- else
- fb_write( fbp, 0, cur_fb_line, scanline, scr_width );
+ if ( output_pix ) {
+ ret = fwrite( scanline, scr_width*3, 1, stdout );
+ if (ret != 1)
+ perror("fwrite");
+ } else {
+ ret = fb_write( fbp, 0, cur_fb_line, scanline, scr_width );
+ if (ret != (size_t)scanline)
+ perror("fwrite");
+ }
cur_fb_line--;
}
return 0;
Modified: brlcad/trunk/src/fb/fb-bw.c
===================================================================
--- brlcad/trunk/src/fb/fb-bw.c 2011-01-13 05:06:30 UTC (rev 42209)
+++ brlcad/trunk/src/fb/fb-bw.c 2011-01-13 05:07:34 UTC (rev 42210)
@@ -149,6 +149,7 @@
if (yin > height) yin = height;
for (y = scr_yoff; y < scr_yoff + yin; y++) {
+ size_t ret;
if (inverse) {
(void)fb_read(fbp, scr_xoff, fb_getheight(fbp)-1-y, inbuf, xin);
} else {
@@ -158,7 +159,9 @@
obuf[x] = (((int)inbuf[3*x+RED]) + ((int)inbuf[3*x+GRN])
+ ((int)inbuf[3*x+BLU])) / 3;
}
- fwrite(&obuf[0], sizeof(char), xin, outfp);
+ ret = fwrite(&obuf[0], sizeof(char), xin, outfp);
+ if (ret != (size_t)xin)
+ perror("fwrite");
}
fb_close(fbp);
Modified: brlcad/trunk/src/fb/pl-fb.c
===================================================================
--- brlcad/trunk/src/fb/pl-fb.c 2011-01-13 05:06:30 UTC (rev 42209)
+++ brlcad/trunk/src/fb/pl-fb.c 2011-01-13 05:07:34 UTC (rev 42210)
@@ -795,7 +795,9 @@
bool ret;
ret = GetCoords(coop);
- fread(trash, sizeof(trash), 1, pfin);
+ if (fread(trash, sizeof(trash), 1, pfin) != 1)
+ return false;
+
return ret;
}
Modified: brlcad/trunk/src/fb/pp-fb.c
===================================================================
--- brlcad/trunk/src/fb/pp-fb.c 2011-01-13 05:06:30 UTC (rev 42209)
+++ brlcad/trunk/src/fb/pp-fb.c 2011-01-13 05:07:34 UTC (rev 42210)
@@ -128,6 +128,7 @@
int i, j, k, lclr, iquit=0, ichg=0, gclr(void), cclr(char *pc);
int il, iu, iclr, iskp, jclr, bsp(void);
int scr_w=512, scr_h=512, scr_set=0;
+ int ret;
printf("GIFT-PRETTY File painted on Generic Framebuffer\n");
/* check invocation */
@@ -255,14 +256,18 @@
break;
case 'a':
printf("Old color? ");
- scanf("%3s", cs);
+ ret = scanf("%3s", cs);
+ if (ret != 1)
+ perror("scanf");
iclr=cclr(cs);
if (iclr<0) {
prtclr(0);
break;
}
printf("New color? ");
- scanf("%3s", cs);
+ ret = scanf("%3s", cs);
+ if (ret != 1)
+ perror("scanf");
jclr=cclr(cs);
if (jclr<0) {
prtclr(0);
@@ -284,7 +289,9 @@
break;
case 'b':
printf("%s background changed to ", colortab[ibc].name);
- scanf("%3s", cs);
+ ret = scanf("%3s", cs);
+ if (ret != 1)
+ perror("scanf");
ibc=cclr(cs);
if (ibc<0) {
ibc=0;
@@ -294,7 +301,9 @@
case 't':
printf("%s transparent color changed to ",
colortab[itc].name);
- scanf("%3s", cs);
+ ret = scanf("%3s", cs);
+ if (ret != 1)
+ perror("scanf");
itc=cclr(cs);
if (itc<0) {
prtclr(0);
@@ -319,7 +328,9 @@
if ((i%20)==19) {
char cbuf[16];
printf("(c)ontine, (s)top? ");
- scanf("%1s", cbuf);
+ ret = scanf("%1s", cbuf);
+ if (ret != 1)
+ perror("scanf");
c = cbuf[0];
if (c=='s') break;
}
@@ -341,6 +352,7 @@
iquit=1;
case 'v':
if (ichg!=0) {
+ ssize_t writeret;
for (i=0;i<ni;i++) {
loci+=6;
lseek(ifd, (off_t)loci, 0);
@@ -348,7 +360,9 @@
for (j=0, cp=colortab[itmc[i]].name;j<3;
cp++, j++) {
loci++;
- write(ifd, cp, 1);
+ writeret = write(ifd, cp, 1);
+ if (writeret < 0)
+ perror("write");
}
lseek(ifd, (off_t)++loci, 0);
while ((c=gc())!='\n') loci++;
@@ -364,11 +378,17 @@
goto view;
case 'r':
printf("Lower limit? ");
- scanf("%d", &il);
+ ret = scanf("%d", &il);
+ if (ret != 1)
+ perror("scanf");
printf("Upper limit? ");
- scanf("%d", &iu);
+ ret = scanf("%d", &iu);
+ if (ret != 1)
+ perror("scanf");
printf("Color? ");
- scanf("%3s", cs);
+ ret = scanf("%3s", cs);
+ if (ret != 1)
+ perror("scanf");
iclr=cclr(cs);
if (iclr<0) {
prtclr(0);
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
Protect Your Site and Customers from Malware Attacks
Learn about various malware tactics and how to avoid them. Understand
malware threats, the impact they can have on your business, and how you
can protect your company and customers by using code signing.
http://p.sf.net/sfu/oracle-sfdevnl
_______________________________________________
BRL-CAD Source Commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/brlcad-commits