From a5ab3ed1b2bc67a4fc726bf2c5d8b95ce6dbfe11 Mon Sep 17 00:00:00 2001 From: Martchus Date: Tue, 16 May 2023 23:18:27 +0200 Subject: [PATCH] Avoid abusing OggPage header flags to store whether last segment unconcluded --- ogg/oggpage.cpp | 2 +- ogg/oggpage.h | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/ogg/oggpage.cpp b/ogg/oggpage.cpp index 68dcb6e..eafe0cb 100644 --- a/ogg/oggpage.cpp +++ b/ogg/oggpage.cpp @@ -62,7 +62,7 @@ void OggPage::parseHeader(istream &stream, std::uint64_t startOffset, std::int32 if (++i < m_segmentCount && entry < 0xFF) { m_segmentSizes.emplace_back(0); } else if (i == m_segmentCount && entry == 0xFF) { - m_headerTypeFlag |= 0x80; // FIXME v11: don't abuse header type flags + m_lastSegmentUnconcluded = true; } } // check whether the maximum size is exceeded diff --git a/ogg/oggpage.h b/ogg/oggpage.h index cc9b721..3afc07f 100644 --- a/ogg/oggpage.h +++ b/ogg/oggpage.h @@ -48,6 +48,7 @@ private: std::uint32_t m_sequenceNumber; std::uint32_t m_checksum; std::uint8_t m_segmentCount; + bool m_lastSegmentUnconcluded; std::vector m_segmentSizes; }; @@ -63,6 +64,7 @@ inline OggPage::OggPage() , m_sequenceNumber(0) , m_checksum(0) , m_segmentCount(0) + , m_lastSegmentUnconcluded(false) { } @@ -134,7 +136,7 @@ inline bool OggPage::isLastPage() const */ inline bool OggPage::isLastSegmentUnconcluded() const { - return m_headerTypeFlag & 0x80; + return m_lastSegmentUnconcluded; } /*!