summaryrefslogtreecommitdiff
path: root/tools/pokemon_animation_graphics.c
diff options
context:
space:
mode:
authoryenatch <yenatch@gmail.com>2017-12-28 01:31:00 -0500
committerGitHub <noreply@github.com>2017-12-28 01:31:00 -0500
commite2b378f5e32ea1416fbc9ac5e96d23be244e4a6b (patch)
tree70fd1d4709150af457258763be04960931acd95b /tools/pokemon_animation_graphics.c
parentda28d1a84b0499bead314e17ae2ff0d13eb03196 (diff)
parent9af2aee640b555f9f52503233bc06d299b99974d (diff)
Merge pull request #442 from yenatch/fix-fread
fix fread warnings
Diffstat (limited to 'tools/pokemon_animation_graphics.c')
-rw-r--r--tools/pokemon_animation_graphics.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/tools/pokemon_animation_graphics.c b/tools/pokemon_animation_graphics.c
index 3ee1bd4cb..d57fa5b9c 100644
--- a/tools/pokemon_animation_graphics.c
+++ b/tools/pokemon_animation_graphics.c
@@ -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;