X-Git-Url: https://git.artsoft.org/?a=blobdiff_plain;f=src%2Flibgame%2Fmisc.c;h=f9abe2ad457e6995aceaf0edaa35f877a851e974;hb=16018297276e05edcfbe7aeda9e04a61d19e1e4c;hp=d8140b7e8e09a189909ef7939bdba771ba45114b;hpb=d9ebb78b0e0290d76d3ee3d8f864ac6767cab61e;p=rocksndiamonds.git diff --git a/src/libgame/misc.c b/src/libgame/misc.c index d8140b7e..f9abe2ad 100644 --- a/src/libgame/misc.c +++ b/src/libgame/misc.c @@ -709,8 +709,11 @@ boolean getFileChunk(FILE *file, char *chunk_name, int *chunk_size, /* read chunk name */ fgets(chunk_name, chunk_name_length + 1, file); - /* read chunk size */ - *chunk_size = getFile32BitInteger(file, byte_order); + if (chunk_size != NULL) + { + /* read chunk size */ + *chunk_size = getFile32BitInteger(file, byte_order); + } return (feof(file) || ferror(file) ? FALSE : TRUE); } @@ -721,8 +724,11 @@ void putFileChunk(FILE *file, char *chunk_name, int chunk_size, /* write chunk name */ fputs(chunk_name, file); - /* write chunk size */ - putFile32BitInteger(file, chunk_size, byte_order); + if (chunk_size >= 0) + { + /* write chunk size */ + putFile32BitInteger(file, chunk_size, byte_order); + } } #define TRANSLATE_KEYSYM_TO_KEYNAME 0