Skip to content

Commit

Permalink
remove the EbmlElement::SizeIsValid pure virtual method
Browse files Browse the repository at this point in the history
We get that information from the EbmlCallbacks.
  • Loading branch information
robUx4 committed Feb 25, 2024
1 parent 904aef5 commit 4dad849
Show file tree
Hide file tree
Showing 10 changed files with 1 addition and 20 deletions.
1 change: 0 additions & 1 deletion ebml/EbmlBinary.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ class EBML_DLL_API EbmlBinary : public EbmlElement {
EbmlBinary& operator=(const EbmlBinary & ElementToClone);
~EbmlBinary() override;

bool SizeIsValid(std::uint64_t size) const override {return size < 0x7FFFFFFF;} // we don't mind about what's inside
static inline bool SizeIsValid(std::uint64_t size) {return size < 0x7FFFFFFF;} // we don't mind about what's inside

filepos_t RenderData(IOCallback & output, bool bForceRender, const ShouldWrite & writeFilter = WriteSkipDefault) override;
Expand Down
2 changes: 1 addition & 1 deletion ebml/EbmlCrc32.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

namespace libebml {

DECLARE_EBML_BINARY_LENGTH(EbmlCrc32, 4)
DECLARE_EBML_BINARY(EbmlCrc32)
public:
filepos_t RenderData(IOCallback & output, bool bForceRender, const ShouldWrite & writeFilter = WriteSkipDefault) override;
filepos_t ReadData(IOCallback & input, ScopeMode ReadFully = SCOPE_ALL_DATA) override;
Expand Down
2 changes: 0 additions & 2 deletions ebml/EbmlDate.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,6 @@ class EBML_DLL_API EbmlDate : public EbmlElementDefaultSameStorage<std::int64_t>
std::int64_t GetEpochDate() const {return EbmlToEpoch(EbmlElementDefaultSameStorage<std::int64_t>::GetValue());}
std::int64_t GetValue() const {return GetEpochDate();}

bool SizeIsValid(std::uint64_t size) const override {return size == 8 || size == 0;}

static inline bool SizeIsValid(std::uint64_t size) {return size == 8 || size == 0;}

/*!
Expand Down
6 changes: 0 additions & 6 deletions ebml/EbmlElement.h
Original file line number Diff line number Diff line change
Expand Up @@ -187,10 +187,6 @@ class DllApi x : public BaseClass { \
#define DECLARE_xxx_BINARY(x,DllApi) \
DECLARE_xxx_BASE(x, DllApi, libebml::EbmlBinary)

#define DECLARE_xxx_BINARY_LENGTH(x,len,DllApi) \
DECLARE_xxx_BASE(x, DllApi, libebml::EbmlBinary) \
bool SizeIsValid(std::uint64_t size) const override {return size == len;}

#define DECLARE_xxx_UINTEGER(x,DllApi) \
DECLARE_xxx_BASE_NODEFAULT(x, DllApi, libebml::EbmlUInteger, std::uint64_t)

Expand Down Expand Up @@ -231,7 +227,6 @@ class DllApi x : public BaseClass { \
#define DECLARE_EBML_UINTEGER_DEF(x) DECLARE_xxx_UINTEGER_DEF(x,EBML_DLL_API)
#define DECLARE_EBML_STRING_DEF(x) DECLARE_xxx_STRING_DEF( x,EBML_DLL_API)
#define DECLARE_EBML_BINARY(x) DECLARE_xxx_BINARY( x,EBML_DLL_API)
#define DECLARE_EBML_BINARY_LENGTH(x,len) DECLARE_xxx_BINARY_LENGTH(x,len,EBML_DLL_API)

#define EBML_CONCRETE_CLASS(Type) \
public: \
Expand Down Expand Up @@ -509,7 +504,6 @@ class EBML_DLL_API EbmlElement {
return false;
}

virtual bool SizeIsValid(std::uint64_t) const = 0;
bool ValidateSize() const { return ElementSpec().IsSizeValid(GetSize()); }

std::uint64_t GetElementPosition() const {
Expand Down
5 changes: 0 additions & 5 deletions ebml/EbmlFloat.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,6 @@ class EBML_DLL_API EbmlFloat : public EbmlElementDefaultSameStorage<double> {

EbmlFloat(const EbmlCallbacksDefault<double> &, Precision prec = FLOAT_32);

bool SizeIsValid(std::uint64_t size) const override
{
return (size == 4 || size == 8);
}

static inline bool SizeIsValid(std::uint64_t size)
{
return (size == 4 || size == 8);
Expand Down
1 change: 0 additions & 1 deletion ebml/EbmlMaster.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ class EBML_DLL_API EbmlMaster : public EbmlElement {
explicit EbmlMaster(const EbmlCallbacks &, bool bSizeIsKnown = true);
EbmlMaster(const EbmlMaster & ElementToClone);
EbmlMaster& operator=(const EbmlMaster&) = delete;
bool SizeIsValid(std::uint64_t /*size*/) const override {return true;}
static inline bool SizeIsValid(std::uint64_t /*size*/) {return true;}

/*!
Expand Down
1 change: 0 additions & 1 deletion ebml/EbmlSInteger.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ class EBML_DLL_API EbmlSInteger : public EbmlElementDefaultSameStorage<std::int6
*/
void SetDefaultSize(std::uint64_t nDefaultSize = DEFAULT_INT_SIZE) override {EbmlElement::SetDefaultSize(nDefaultSize); SetSize_(nDefaultSize);}

bool SizeIsValid(std::uint64_t size) const override {return size <= 8;}
static inline bool SizeIsValid(std::uint64_t size) {return size <= 8;}
filepos_t RenderData(IOCallback & output, bool bForceRender, const ShouldWrite & writeFilter = WriteSkipDefault) override;
filepos_t ReadData(IOCallback & input, ScopeMode ReadFully = SCOPE_ALL_DATA) override;
Expand Down
1 change: 0 additions & 1 deletion ebml/EbmlString.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ class EBML_DLL_API EbmlString : public EbmlElementDefaultStorage<const char *, s
public:
EbmlString(const EbmlCallbacksDefault<const char *> &);

bool SizeIsValid(std::uint64_t size) const override {return size < 0x7FFFFFFF;} // any size is possible
static inline bool SizeIsValid(std::uint64_t size) {return size < 0x7FFFFFFF;} // any size is possible
filepos_t RenderData(IOCallback & output, bool bForceRender, const ShouldWrite & writeFilter = WriteSkipDefault) override;
filepos_t ReadData(IOCallback & input, ScopeMode ReadFully = SCOPE_ALL_DATA) override;
Expand Down
1 change: 0 additions & 1 deletion ebml/EbmlUInteger.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ class EBML_DLL_API EbmlUInteger : public EbmlElementDefaultSameStorage<std::uint
*/
void SetDefaultSize(std::uint64_t nDefaultSize = DEFAULT_UINT_SIZE) override {EbmlElement::SetDefaultSize(nDefaultSize); SetSize_(nDefaultSize);}

bool SizeIsValid(std::uint64_t size) const override {return size <= 8;}
static inline bool SizeIsValid(std::uint64_t size) {return size <= 8;}
filepos_t RenderData(IOCallback & output, bool bForceRender, const ShouldWrite & writeFilter = WriteSkipDefault) override;
filepos_t ReadData(IOCallback & input, ScopeMode ReadFully = SCOPE_ALL_DATA) override;
Expand Down
1 change: 0 additions & 1 deletion ebml/EbmlUnicodeString.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@ class EBML_DLL_API EbmlUnicodeString : public EbmlElementDefaultStorage<const wc
public:
EbmlUnicodeString(const EbmlCallbacksDefault<const wchar_t *> &);

bool SizeIsValid(std::uint64_t /*size*/) const override {return true;} // any size is possible
static inline bool SizeIsValid(std::uint64_t /*size*/) {return true;} // any size is possible
filepos_t RenderData(IOCallback & output, bool bForceRender, const ShouldWrite & writeFilter = WriteSkipDefault) override;
filepos_t ReadData(IOCallback & input, ScopeMode ReadFully = SCOPE_ALL_DATA) override;
Expand Down

0 comments on commit 4dad849

Please sign in to comment.