From 3a1757edf10eae9e69aec4443184d93fc9a5d1aa Mon Sep 17 00:00:00 2001 From: Steve Lhomme Date: Fri, 29 Dec 2023 15:43:31 +0100 Subject: [PATCH] make the EbmlElementDefaultSameStorage Value private This is how it was before the EbmlElementDefaultSameStorage split. --- ebml/EbmlElement.h | 2 +- src/EbmlFloat.cpp | 4 ++-- src/EbmlSInteger.cpp | 9 +++++---- src/EbmlUInteger.cpp | 9 +++++---- 4 files changed, 13 insertions(+), 11 deletions(-) diff --git a/ebml/EbmlElement.h b/ebml/EbmlElement.h index a28767ec..ef9fb92f 100644 --- a/ebml/EbmlElement.h +++ b/ebml/EbmlElement.h @@ -606,7 +606,7 @@ class EBML_DLL_API EbmlElementDefaultSameStorage : public EbmlElementDefault explicit operator T() const { return Value; } - protected: + private: T Value; }; diff --git a/src/EbmlFloat.cpp b/src/EbmlFloat.cpp index 7e3d710e..8ba11bac 100644 --- a/src/EbmlFloat.cpp +++ b/src/EbmlFloat.cpp @@ -23,8 +23,8 @@ EbmlFloat::EbmlFloat(const EbmlCallbacksDefault & classInfo, const EbmlF } } -EbmlFloat::operator float() const {return static_cast(Value);} -EbmlFloat::operator double() const {return (Value);} +EbmlFloat::operator float() const {return static_cast(GetValue());} +EbmlFloat::operator double() const {return (GetValue());} /*! \todo handle exception on errors diff --git a/src/EbmlSInteger.cpp b/src/EbmlSInteger.cpp index 8849dc42..3bac3b14 100644 --- a/src/EbmlSInteger.cpp +++ b/src/EbmlSInteger.cpp @@ -41,10 +41,10 @@ EbmlSInteger::EbmlSInteger(const EbmlCallbacksDefault & classInfo) } } -EbmlSInteger::operator std::int8_t() const {return static_cast(Value);} -EbmlSInteger::operator std::int16_t() const {return static_cast(Value);} -EbmlSInteger::operator std::int32_t() const {return static_cast(Value);} -EbmlSInteger::operator std::int64_t() const {return Value;} +EbmlSInteger::operator std::int8_t() const {return static_cast(GetValue());} +EbmlSInteger::operator std::int16_t() const {return static_cast(GetValue());} +EbmlSInteger::operator std::int32_t() const {return static_cast(GetValue());} +EbmlSInteger::operator std::int64_t() const {return GetValue();} /*! \todo handle exception on errors @@ -73,6 +73,7 @@ std::uint64_t EbmlSInteger::UpdateSize(ShouldWrite writeFilter, bool /* bForceRe if (!writeFilter(*this)) return 0; + const auto Value = GetValue(); if (Value <= 0x7F && Value >= (-0x80)) { SetSize_(1); } else if (Value <= 0x7FFF && Value >= (-0x8000)) { diff --git a/src/EbmlUInteger.cpp b/src/EbmlUInteger.cpp index ecb50f61..c62df850 100644 --- a/src/EbmlUInteger.cpp +++ b/src/EbmlUInteger.cpp @@ -23,10 +23,10 @@ EbmlUInteger::EbmlUInteger(const EbmlCallbacksDefault & classInfo } } -EbmlUInteger::operator std::uint8_t() const {return static_cast(Value); } -EbmlUInteger::operator std::uint16_t() const {return static_cast(Value);} -EbmlUInteger::operator std::uint32_t() const {return static_cast(Value);} -EbmlUInteger::operator std::uint64_t() const {return Value;} +EbmlUInteger::operator std::uint8_t() const {return static_cast(GetValue()); } +EbmlUInteger::operator std::uint16_t() const {return static_cast(GetValue());} +EbmlUInteger::operator std::uint32_t() const {return static_cast(GetValue());} +EbmlUInteger::operator std::uint64_t() const {return GetValue();} /*! \todo handle exception on errors @@ -54,6 +54,7 @@ std::uint64_t EbmlUInteger::UpdateSize(ShouldWrite writeFilter, bool /* bForceRe if (!writeFilter(*this)) return 0; + const auto Value = GetValue(); if (Value <= 0xFF) { SetSize_(1); } else if (Value <= 0xFFFF) {