Skip to content

Commit 4dad849

Browse files
committed
remove the EbmlElement::SizeIsValid pure virtual method
We get that information from the EbmlCallbacks.
1 parent 904aef5 commit 4dad849

10 files changed

+1
-20
lines changed

ebml/EbmlBinary.h

-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ class EBML_DLL_API EbmlBinary : public EbmlElement {
3030
EbmlBinary& operator=(const EbmlBinary & ElementToClone);
3131
~EbmlBinary() override;
3232

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

3635
filepos_t RenderData(IOCallback & output, bool bForceRender, const ShouldWrite & writeFilter = WriteSkipDefault) override;

ebml/EbmlCrc32.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
namespace libebml {
1515

16-
DECLARE_EBML_BINARY_LENGTH(EbmlCrc32, 4)
16+
DECLARE_EBML_BINARY(EbmlCrc32)
1717
public:
1818
filepos_t RenderData(IOCallback & output, bool bForceRender, const ShouldWrite & writeFilter = WriteSkipDefault) override;
1919
filepos_t ReadData(IOCallback & input, ScopeMode ReadFully = SCOPE_ALL_DATA) override;

ebml/EbmlDate.h

-2
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,6 @@ class EBML_DLL_API EbmlDate : public EbmlElementDefaultSameStorage<std::int64_t>
4141
std::int64_t GetEpochDate() const {return EbmlToEpoch(EbmlElementDefaultSameStorage<std::int64_t>::GetValue());}
4242
std::int64_t GetValue() const {return GetEpochDate();}
4343

44-
bool SizeIsValid(std::uint64_t size) const override {return size == 8 || size == 0;}
45-
4644
static inline bool SizeIsValid(std::uint64_t size) {return size == 8 || size == 0;}
4745

4846
/*!

ebml/EbmlElement.h

-6
Original file line numberDiff line numberDiff line change
@@ -187,10 +187,6 @@ class DllApi x : public BaseClass { \
187187
#define DECLARE_xxx_BINARY(x,DllApi) \
188188
DECLARE_xxx_BASE(x, DllApi, libebml::EbmlBinary)
189189

190-
#define DECLARE_xxx_BINARY_LENGTH(x,len,DllApi) \
191-
DECLARE_xxx_BASE(x, DllApi, libebml::EbmlBinary) \
192-
bool SizeIsValid(std::uint64_t size) const override {return size == len;}
193-
194190
#define DECLARE_xxx_UINTEGER(x,DllApi) \
195191
DECLARE_xxx_BASE_NODEFAULT(x, DllApi, libebml::EbmlUInteger, std::uint64_t)
196192

@@ -231,7 +227,6 @@ class DllApi x : public BaseClass { \
231227
#define DECLARE_EBML_UINTEGER_DEF(x) DECLARE_xxx_UINTEGER_DEF(x,EBML_DLL_API)
232228
#define DECLARE_EBML_STRING_DEF(x) DECLARE_xxx_STRING_DEF( x,EBML_DLL_API)
233229
#define DECLARE_EBML_BINARY(x) DECLARE_xxx_BINARY( x,EBML_DLL_API)
234-
#define DECLARE_EBML_BINARY_LENGTH(x,len) DECLARE_xxx_BINARY_LENGTH(x,len,EBML_DLL_API)
235230

236231
#define EBML_CONCRETE_CLASS(Type) \
237232
public: \
@@ -509,7 +504,6 @@ class EBML_DLL_API EbmlElement {
509504
return false;
510505
}
511506

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

515509
std::uint64_t GetElementPosition() const {

ebml/EbmlFloat.h

-5
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,6 @@ class EBML_DLL_API EbmlFloat : public EbmlElementDefaultSameStorage<double> {
2525

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

28-
bool SizeIsValid(std::uint64_t size) const override
29-
{
30-
return (size == 4 || size == 8);
31-
}
32-
3328
static inline bool SizeIsValid(std::uint64_t size)
3429
{
3530
return (size == 4 || size == 8);

ebml/EbmlMaster.h

-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ class EBML_DLL_API EbmlMaster : public EbmlElement {
3131
explicit EbmlMaster(const EbmlCallbacks &, bool bSizeIsKnown = true);
3232
EbmlMaster(const EbmlMaster & ElementToClone);
3333
EbmlMaster& operator=(const EbmlMaster&) = delete;
34-
bool SizeIsValid(std::uint64_t /*size*/) const override {return true;}
3534
static inline bool SizeIsValid(std::uint64_t /*size*/) {return true;}
3635

3736
/*!

ebml/EbmlSInteger.h

-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ class EBML_DLL_API EbmlSInteger : public EbmlElementDefaultSameStorage<std::int6
3131
*/
3232
void SetDefaultSize(std::uint64_t nDefaultSize = DEFAULT_INT_SIZE) override {EbmlElement::SetDefaultSize(nDefaultSize); SetSize_(nDefaultSize);}
3333

34-
bool SizeIsValid(std::uint64_t size) const override {return size <= 8;}
3534
static inline bool SizeIsValid(std::uint64_t size) {return size <= 8;}
3635
filepos_t RenderData(IOCallback & output, bool bForceRender, const ShouldWrite & writeFilter = WriteSkipDefault) override;
3736
filepos_t ReadData(IOCallback & input, ScopeMode ReadFully = SCOPE_ALL_DATA) override;

ebml/EbmlString.h

-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ class EBML_DLL_API EbmlString : public EbmlElementDefaultStorage<const char *, s
2222
public:
2323
EbmlString(const EbmlCallbacksDefault<const char *> &);
2424

25-
bool SizeIsValid(std::uint64_t size) const override {return size < 0x7FFFFFFF;} // any size is possible
2625
static inline bool SizeIsValid(std::uint64_t size) {return size < 0x7FFFFFFF;} // any size is possible
2726
filepos_t RenderData(IOCallback & output, bool bForceRender, const ShouldWrite & writeFilter = WriteSkipDefault) override;
2827
filepos_t ReadData(IOCallback & input, ScopeMode ReadFully = SCOPE_ALL_DATA) override;

ebml/EbmlUInteger.h

-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ class EBML_DLL_API EbmlUInteger : public EbmlElementDefaultSameStorage<std::uint
2929
*/
3030
void SetDefaultSize(std::uint64_t nDefaultSize = DEFAULT_UINT_SIZE) override {EbmlElement::SetDefaultSize(nDefaultSize); SetSize_(nDefaultSize);}
3131

32-
bool SizeIsValid(std::uint64_t size) const override {return size <= 8;}
3332
static inline bool SizeIsValid(std::uint64_t size) {return size <= 8;}
3433
filepos_t RenderData(IOCallback & output, bool bForceRender, const ShouldWrite & writeFilter = WriteSkipDefault) override;
3534
filepos_t ReadData(IOCallback & input, ScopeMode ReadFully = SCOPE_ALL_DATA) override;

ebml/EbmlUnicodeString.h

-1
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,6 @@ class EBML_DLL_API EbmlUnicodeString : public EbmlElementDefaultStorage<const wc
6868
public:
6969
EbmlUnicodeString(const EbmlCallbacksDefault<const wchar_t *> &);
7070

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

0 commit comments

Comments
 (0)