Skip to content

Commit

Permalink
Do not warn about primitives of size 0.
Browse files Browse the repository at this point in the history
Otherwise this shows a warning for every RPG Maker 2003 English database which contains a 0-byte version field.

This issue always existed but was hidden behind LCF_DEBUG_TRACE.
  • Loading branch information
Ghabry committed Aug 25, 2024
1 parent d8c4cc8 commit 7518676
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/reader_struct.h
Original file line number Diff line number Diff line change
Expand Up @@ -267,13 +267,17 @@ struct Primitive<int32_t> {
ref = stream.ReadInt();
#ifdef LCF_DEBUG_TRACE
fprintf(stderr, " %d\n", ref);
#endif
} else if (length == 0) {
ref = 0;
#ifdef LCF_DEBUG_TRACE
fprintf(stderr, " %d\n", ref);
#endif
} else {
ref = 0;
Log::Warning("Invalid integer at %X", stream.Tell());
stream.Seek(length, LcfReader::FromCurrent);
}

}
static void WriteLcf(const int32_t& ref, LcfWriter& stream) {
stream.WriteInt(ref);
Expand Down

0 comments on commit 7518676

Please sign in to comment.