summaryrefslogtreecommitdiffstats
path: root/progs/redbook/convolution.c
diff options
context:
space:
mode:
Diffstat (limited to 'progs/redbook/convolution.c')
-rw-r--r--progs/redbook/convolution.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/progs/redbook/convolution.c b/progs/redbook/convolution.c
index 0898ef25e10..c04a8727a71 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 );