From 8557f7a401d265d17f0757c5f299b691bb49a3da Mon Sep 17 00:00:00 2001 From: Christian Seiler Date: Fri, 29 May 2026 23:25:15 +0200 Subject: [PATCH] C++: fix various bugs related to different section types --- cpp/src/monoformat_parseonly.cpp | 4 ++-- cpp/src/monoformat_structured.cpp | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/cpp/src/monoformat_parseonly.cpp b/cpp/src/monoformat_parseonly.cpp index 3d2ae27..90d48e3 100644 --- a/cpp/src/monoformat_parseonly.cpp +++ b/cpp/src/monoformat_parseonly.cpp @@ -80,14 +80,14 @@ static std::expected parseTimeBasedDr if (!type) { return std::unexpected(type.error()); } - if (*type != static_cast(SectionType::AlwaysDrawn)) { + if (*type != static_cast(SectionType::TimeBasedDrawn)) { return std::unexpected(ParseError::InvalidValue); } auto size = readU24LE(data); if (!size) { return std::unexpected(size.error()); } - if (*size < 8) { + if (*size < 24) { return std::unexpected(ParseError::InvalidValue); } auto flags = readU16LE(data); diff --git a/cpp/src/monoformat_structured.cpp b/cpp/src/monoformat_structured.cpp index ff1bee6..2bfe01c 100644 --- a/cpp/src/monoformat_structured.cpp +++ b/cpp/src/monoformat_structured.cpp @@ -2137,7 +2137,7 @@ std::uint32_t TimeBasedDrawnSection::minimumFormatVersion() const { std::size_t TimeBasedDrawnSection::serializeTo(std::span target, std::uint32_t formatVersion) const { std::size_t pos = 0; - pos = writeU8LE(target, pos, static_cast(SectionType::AlwaysDrawn)); + pos = writeU8LE(target, pos, static_cast(SectionType::TimeBasedDrawn)); // Will be replaced later pos = writeU24LE(target, pos, 0); std::uint16_t flags = 0; @@ -2303,7 +2303,7 @@ std::size_t CustomFontSection::serializeTo(std::span target, std::uin std::ignore = formatVersion; std::size_t pos = 0; - pos = writeU8LE(target, pos, static_cast(SectionType::AlwaysDrawn)); + pos = writeU8LE(target, pos, static_cast(SectionType::CustomFont)); // Will be replaced later pos = writeU24LE(target, pos, 0); pos = writeU24LE(target, pos, m_fontData.size());