From 7518676824c60c070a3fac29706441a62a289a82 Mon Sep 17 00:00:00 2001 From: Ghabry Date: Mon, 26 Aug 2024 01:05:19 +0200 Subject: [PATCH] Do not warn about primitives of size 0. 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. --- src/reader_struct.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/reader_struct.h b/src/reader_struct.h index c26dfda0..d247714a 100644 --- a/src/reader_struct.h +++ b/src/reader_struct.h @@ -267,13 +267,17 @@ struct Primitive { 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);