Clean up how game state file sizes are checked
New struct empfile member nent replaces ef_open() parameter nelt.
Cleaner, because the expected size is a property of the file, not of
how it's used. Also fixes empdump to check file sizes.
Complication: with EFF_CREATE, ef_open() creates an empty file, to be
extended to the correct size. Callers passed nelt argument -1 along
with EFF_CREATE, to make ef_open() accept the empty file. Can't do
the same for empfile member nent. Instead, make ef_open() not check
the (zero) size then.
Replaces commit 5750107b
, v4.3.15.
This commit is contained in:
parent
516ab86a6e
commit
0fcd935999
7 changed files with 68 additions and 64 deletions
|
@ -136,7 +136,7 @@ main(int argc, char *argv[])
|
|||
for (i = 0; i < EF_MAX; i++) {
|
||||
if (!EF_IS_GAME_STATE(i))
|
||||
continue;
|
||||
if (!ef_open(i, EFF_CREATE | EFF_NOTIME, -1)) {
|
||||
if (!ef_open(i, EFF_CREATE | EFF_NOTIME)) {
|
||||
perror("ef_open");
|
||||
exit(1);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue