Skip to content

Commit

Permalink
make the EbmlElementDefaultSameStorage Value private
Browse files Browse the repository at this point in the history
This is how it was before the EbmlElementDefaultSameStorage split.
  • Loading branch information
robUx4 committed Jan 7, 2024
1 parent b268321 commit 3a1757e
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 11 deletions.
2 changes: 1 addition & 1 deletion ebml/EbmlElement.h
Original file line number Diff line number Diff line change
Expand Up @@ -606,7 +606,7 @@ class EBML_DLL_API EbmlElementDefaultSameStorage : public EbmlElementDefault<T>

explicit operator T() const { return Value; }

protected:
private:
T Value;
};

Expand Down
4 changes: 2 additions & 2 deletions src/EbmlFloat.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ EbmlFloat::EbmlFloat(const EbmlCallbacksDefault<double> & classInfo, const EbmlF
}
}

EbmlFloat::operator float() const {return static_cast<float>(Value);}
EbmlFloat::operator double() const {return (Value);}
EbmlFloat::operator float() const {return static_cast<float>(GetValue());}
EbmlFloat::operator double() const {return (GetValue());}

/*!
\todo handle exception on errors
Expand Down
9 changes: 5 additions & 4 deletions src/EbmlSInteger.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,10 @@ EbmlSInteger::EbmlSInteger(const EbmlCallbacksDefault<std::int64_t> & classInfo)
}
}

EbmlSInteger::operator std::int8_t() const {return static_cast<std::int8_t>(Value);}
EbmlSInteger::operator std::int16_t() const {return static_cast<std::int16_t>(Value);}
EbmlSInteger::operator std::int32_t() const {return static_cast<std::int32_t>(Value);}
EbmlSInteger::operator std::int64_t() const {return Value;}
EbmlSInteger::operator std::int8_t() const {return static_cast<std::int8_t>(GetValue());}
EbmlSInteger::operator std::int16_t() const {return static_cast<std::int16_t>(GetValue());}
EbmlSInteger::operator std::int32_t() const {return static_cast<std::int32_t>(GetValue());}
EbmlSInteger::operator std::int64_t() const {return GetValue();}

/*!
\todo handle exception on errors
Expand Down Expand Up @@ -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)) {
Expand Down
9 changes: 5 additions & 4 deletions src/EbmlUInteger.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ EbmlUInteger::EbmlUInteger(const EbmlCallbacksDefault<std::uint64_t> & classInfo
}
}

EbmlUInteger::operator std::uint8_t() const {return static_cast<std::uint8_t>(Value); }
EbmlUInteger::operator std::uint16_t() const {return static_cast<std::uint16_t>(Value);}
EbmlUInteger::operator std::uint32_t() const {return static_cast<std::uint32_t>(Value);}
EbmlUInteger::operator std::uint64_t() const {return Value;}
EbmlUInteger::operator std::uint8_t() const {return static_cast<std::uint8_t>(GetValue()); }
EbmlUInteger::operator std::uint16_t() const {return static_cast<std::uint16_t>(GetValue());}
EbmlUInteger::operator std::uint32_t() const {return static_cast<std::uint32_t>(GetValue());}
EbmlUInteger::operator std::uint64_t() const {return GetValue();}

/*!
\todo handle exception on errors
Expand Down Expand Up @@ -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) {
Expand Down

0 comments on commit 3a1757e

Please sign in to comment.