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
|
@ -44,6 +44,7 @@ struct empfile {
|
|||
struct castr *cadef; /* table column selectors (column meta-data) */
|
||||
int base; /* view's base table, else EF_BAD */
|
||||
int size; /* size of a table entry */
|
||||
int nent; /* #table entries, -1 if variable */
|
||||
int flags; /* only EFF_IMMUTABLE immutable, see below
|
||||
for use of remaining bits */
|
||||
|
||||
|
@ -209,7 +210,7 @@ extern void ef_mark_fresh(int, void *);
|
|||
extern void *ef_ptr(int, int);
|
||||
extern char *ef_nameof(int);
|
||||
extern time_t ef_mtime(int);
|
||||
extern int ef_open(int, int, int);
|
||||
extern int ef_open(int, int);
|
||||
extern int ef_open_view(int);
|
||||
extern int ef_close(int);
|
||||
extern int ef_flush(int);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue