diff options
author | Vinson Lee <vlee@vmware.com> | 2010-02-20 01:34:16 -0800 |
---|---|---|
committer | Vinson Lee <vlee@vmware.com> | 2010-02-20 01:34:16 -0800 |
commit | 6cfdb61f738e8f7405a322bfa2c4241700145eec (patch) | |
tree | cf64d2842a572a7e0e1ba5a98c4b831d0ed22308 /progs | |
parent | 5fd84e0246f58cc59757d0bb2b94427899c944e1 (diff) | |
download | external_mesa3d-6cfdb61f738e8f7405a322bfa2c4241700145eec.zip external_mesa3d-6cfdb61f738e8f7405a322bfa2c4241700145eec.tar.gz external_mesa3d-6cfdb61f738e8f7405a322bfa2c4241700145eec.tar.bz2 |
progs/redbook: Silence warn_unused_result warnings.
Diffstat (limited to 'progs')
-rw-r--r-- | progs/redbook/convolution.c | 10 | ||||
-rw-r--r-- | progs/redbook/histogram.c | 10 | ||||
-rw-r--r-- | progs/redbook/minmax.c | 11 |
3 files changed, 22 insertions, 9 deletions
diff --git a/progs/redbook/convolution.c b/progs/redbook/convolution.c index 0898ef2..c04a872 100644 --- a/progs/redbook/convolution.c +++ b/progs/redbook/convolution.c @@ -75,6 +75,7 @@ readImage( const char* filename, GLsizei* width, GLsizei *height ) { int n; GLubyte* pixels; + size_t num_read; FILE* infile = fopen( filename, "rb" ); @@ -83,8 +84,10 @@ readImage( const char* filename, GLsizei* width, GLsizei *height ) exit(1); } - fread( width, sizeof( GLsizei ), 1, infile ); - fread( height, sizeof( GLsizei ), 1, infile ); + num_read = fread( width, sizeof( GLsizei ), 1, infile ); + assert(num_read == 1); + num_read = fread( height, sizeof( GLsizei ), 1, infile ); + assert(num_read == 1); *width = bswap(*width); *height = bswap(*height); @@ -101,7 +104,8 @@ readImage( const char* filename, GLsizei* width, GLsizei *height ) return NULL; } - fread( pixels, sizeof( GLubyte ), n, infile ); + num_read = fread( pixels, sizeof( GLubyte ), n, infile ); + assert(num_read == n); fclose( infile ); diff --git a/progs/redbook/histogram.c b/progs/redbook/histogram.c index 70a5282..12b0e31 100644 --- a/progs/redbook/histogram.c +++ b/progs/redbook/histogram.c @@ -83,6 +83,7 @@ readImage( const char* filename, GLsizei* width, GLsizei *height ) { int n; GLubyte* pixels; + size_t num_read; FILE* infile = fopen( filename, "rb" ); @@ -91,8 +92,10 @@ readImage( const char* filename, GLsizei* width, GLsizei *height ) exit(1); } - fread( width, sizeof( GLsizei ), 1, infile ); - fread( height, sizeof( GLsizei ), 1, infile ); + num_read = fread( width, sizeof( GLsizei ), 1, infile ); + assert(num_read == 1); + num_read = fread( height, sizeof( GLsizei ), 1, infile ); + assert(num_read == 1); *width = bswap(*width); *height = bswap(*height); @@ -106,7 +109,8 @@ readImage( const char* filename, GLsizei* width, GLsizei *height ) return NULL; } - fread( pixels, sizeof( GLubyte ), n, infile ); + num_read = fread( pixels, sizeof( GLubyte ), n, infile ); + assert(num_read == n); fclose( infile ); diff --git a/progs/redbook/minmax.c b/progs/redbook/minmax.c index 8281800..2c1356c 100644 --- a/progs/redbook/minmax.c +++ b/progs/redbook/minmax.c @@ -47,6 +47,7 @@ */ #include <GL/glew.h> #include <GL/glut.h> +#include <assert.h> #include <stdlib.h> #include <stdio.h> @@ -78,6 +79,7 @@ readImage( const char* filename, GLsizei* width, GLsizei *height ) { int n; GLubyte* pixels; + size_t num_read; FILE* infile = fopen( filename, "rb" ); @@ -86,8 +88,10 @@ readImage( const char* filename, GLsizei* width, GLsizei *height ) return NULL; } - fread( width, sizeof( GLsizei ), 1, infile ); - fread( height, sizeof( GLsizei ), 1, infile ); + num_read = fread( width, sizeof( GLsizei ), 1, infile ); + assert(num_read == 1); + num_read = fread( height, sizeof( GLsizei ), 1, infile ); + assert(num_read == 1); *width = bswap(*width); *height = bswap(*height); @@ -101,7 +105,8 @@ readImage( const char* filename, GLsizei* width, GLsizei *height ) return NULL; } - fread( pixels, sizeof( GLubyte ), n, infile ); + num_read = fread( pixels, sizeof( GLubyte ), n, infile ); + assert(num_read == n); fclose( infile ); |