summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNiels Martin Hansen <nielsm@indvikleren.dk>2019-01-05 14:13:38 +0100
committerNiels Martin Hansen <nielsm@indvikleren.dk>2019-01-05 17:16:53 +0100
commit12ba56c5a3173054ac25899bef481f4801d5b6e8 (patch)
tree9a86777378a61ddb2d45cc4cac62296770b960e4
parent0aa69693c69849498ac70b14b8bfc9c5ab1ee449 (diff)
downloadopenttd-12ba56c5a3173054ac25899bef481f4801d5b6e8.tar.xz
Fix 6accbf9: Silence warnings about unused fread() result
-rw-r--r--src/script/squirrel.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/script/squirrel.cpp b/src/script/squirrel.cpp
index d11e85bee..23163f6b3 100644
--- a/src/script/squirrel.cpp
+++ b/src/script/squirrel.cpp
@@ -449,7 +449,8 @@ SQRESULT Squirrel::LoadFile(HSQUIRRELVM vm, const char *filename, SQBool printer
}
unsigned short bom = 0;
if (size >= 2) {
- fread(&bom, 1, sizeof(bom), file); // Inside tar, no point checking return value of fread
+ size_t sr = fread(&bom, 1, sizeof(bom), file);
+ (void)sr; // Inside tar, no point checking return value of fread
}
SQLEXREADFUNC func;
@@ -487,8 +488,7 @@ SQRESULT Squirrel::LoadFile(HSQUIRRELVM vm, const char *filename, SQBool printer
return sq_throwerror(vm, "I/O error");
}
unsigned char uc;
- fread(&uc, 1, sizeof(uc), file);
- if (uc != 0xBF) {
+ if (fread(&uc, 1, sizeof(uc), file) != sizeof(uc) || uc != 0xBF) {
FioFCloseFile(file);
return sq_throwerror(vm, "Unrecognized encoding");
}