fix unused fread return value warnings

This commit is contained in:
yenatch
2017-12-28 01:25:25 -05:00
parent bad9e33530
commit 40305f205e
6 changed files with 47 additions and 16 deletions

View File

@@ -100,7 +100,10 @@ void create_tilemap(struct Tilemap* tilemap, struct Graphic* graphic, char* grap
fprintf(stderr, "malloc failure\n");
exit(1);
}
fread(graphics, 1, graphics_size, f);
if (graphics_size != (long)fread(graphics, 1, graphics_size, f)) {
fprintf(stderr, "failed to read file %s\n", graphics_filename);
exit(1);
}
fclose(f);
int num_tiles_per_frame = width * height;
@@ -213,7 +216,10 @@ int main(int argc, char* argv[]) {
if (!f) {
exit(1);
}
fread(bytes, 1, 1, f);
if (1 != fread(bytes, 1, 1, f)) {
fprintf(stderr, "failed to read file %s\n", dimensions_filename);
exit(1);
}
fclose(f);
width = bytes[0] & 0xf;
height = bytes[0] >> 4;