aboutsummaryrefslogtreecommitdiff
path: root/mesalib/progs
diff options
context:
space:
mode:
Diffstat (limited to 'mesalib/progs')
-rw-r--r--mesalib/progs/util/readtex.c20
1 files changed, 14 insertions, 6 deletions
diff --git a/mesalib/progs/util/readtex.c b/mesalib/progs/util/readtex.c
index d1c50a494..f6f511481 100644
--- a/mesalib/progs/util/readtex.c
+++ b/mesalib/progs/util/readtex.c
@@ -9,6 +9,7 @@
#include <GL/gl.h>
#include <GL/glu.h>
+#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -89,6 +90,7 @@ static rawImageRec *RawImageOpen(const char *fileName)
rawImageRec *raw;
GLenum swapFlag;
int x;
+ size_t result;
endianTest.testWord = 1;
if (endianTest.testByte[0] == 1) {
@@ -114,7 +116,8 @@ static rawImageRec *RawImageOpen(const char *fileName)
}
}
- fread(raw, 1, 12, raw->file);
+ result = fread(raw, 1, 12, raw->file);
+ assert(result == 12);
if (swapFlag) {
ConvertShort(&raw->imagic, 1);
@@ -162,8 +165,10 @@ static rawImageRec *RawImageOpen(const char *fileName)
}
raw->rleEnd = 512 + (2 * x);
fseek(raw->file, 512, SEEK_SET);
- fread(raw->rowStart, 1, x, raw->file);
- fread(raw->rowSize, 1, x, raw->file);
+ result = fread(raw->rowStart, 1, x, raw->file);
+ assert(result == x);
+ result = fread(raw->rowSize, 1, x, raw->file);
+ assert(result == x);
if (swapFlag) {
ConvertLong(raw->rowStart, (long) (x/sizeof(GLuint)));
ConvertLong((GLuint *)raw->rowSize, (long) (x/sizeof(GLint)));
@@ -193,11 +198,13 @@ static void RawImageGetRow(rawImageRec *raw, unsigned char *buf, int y, int z)
{
unsigned char *iPtr, *oPtr, pixel;
int count, done = 0;
+ size_t result;
if ((raw->type & 0xFF00) == 0x0100) {
fseek(raw->file, (long) raw->rowStart[y+z*raw->sizeY], SEEK_SET);
- fread(raw->tmp, 1, (unsigned int)raw->rowSize[y+z*raw->sizeY],
- raw->file);
+ result = fread(raw->tmp, 1, (unsigned int)raw->rowSize[y+z*raw->sizeY],
+ raw->file);
+ assert(result == (unsigned int)raw->rowSize[y+z*raw->sizeY]);
iPtr = raw->tmp;
oPtr = buf;
@@ -222,7 +229,8 @@ static void RawImageGetRow(rawImageRec *raw, unsigned char *buf, int y, int z)
} else {
fseek(raw->file, 512+(y*raw->sizeX)+(z*raw->sizeX*raw->sizeY),
SEEK_SET);
- fread(buf, 1, raw->sizeX, raw->file);
+ result = fread(buf, 1, raw->sizeX, raw->file);
+ assert(result == raw->sizeX);
}
}