v1/v2: clean the access of EbmlId data
git-svn-id: https://matroska.svn.sourceforge.net/svnroot/matroska/trunk/libebml@124 a6f86f6d-0131-4f8e-9e7b-e335508773d5
This commit is contained in:
parent
769a6c3ab7
commit
19ae0bb418
@ -407,7 +407,7 @@ class EBML_DLL_API EbmlElement {
|
|||||||
virtual bool IsMaster() const {return false;}
|
virtual bool IsMaster() const {return false;}
|
||||||
|
|
||||||
uint8 HeadSize() const {
|
uint8 HeadSize() const {
|
||||||
return EBML_ID_LENGTH(EbmlId(*this)) + CodedSizeLength(Size, SizeLength, bSizeIsFinite);
|
return EBML_ID_LENGTH((const EbmlId&)*this) + CodedSizeLength(Size, SizeLength, bSizeIsFinite);
|
||||||
} /// return the size of the head, on reading/writing
|
} /// return the size of the head, on reading/writing
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
|
@ -42,11 +42,11 @@ START_LIBEBML_NAMESPACE
|
|||||||
|
|
||||||
|
|
||||||
#if defined(EBML_STRICT_API)
|
#if defined(EBML_STRICT_API)
|
||||||
#define EBML_ID_VALUE(id) id.GetValue()
|
#define EBML_ID_VALUE(id) (id).GetValue()
|
||||||
#define EBML_ID_LENGTH(id) id.GetLength()
|
#define EBML_ID_LENGTH(id) (id).GetLength()
|
||||||
#else
|
#else
|
||||||
#define EBML_ID_VALUE(id) id.Value
|
#define EBML_ID_VALUE(id) (id).Value
|
||||||
#define EBML_ID_LENGTH(id) id.Length
|
#define EBML_ID_LENGTH(id) (id).Length
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
|
@ -81,7 +81,7 @@ class EBML_DLL_API EbmlMaster : public EbmlElement {
|
|||||||
}
|
}
|
||||||
|
|
||||||
uint64 GetDataStart() const {
|
uint64 GetDataStart() const {
|
||||||
return GetElementPosition() + EBML_ID_LENGTH(EbmlId(*this)) + CodedSizeLength(GetSize(), GetSizeLength(), IsFiniteSize());
|
return GetElementPosition() + EBML_ID_LENGTH((const EbmlId&)*this) + CodedSizeLength(GetSize(), GetSizeLength(), IsFiniteSize());
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
|
@ -605,7 +605,7 @@ filepos_t EbmlElement::Render(IOCallback & output, bool bWithDefault, bool bKeep
|
|||||||
*/
|
*/
|
||||||
filepos_t EbmlElement::RenderHead(IOCallback & output, bool bForceRender, bool bWithDefault, bool bKeepPosition)
|
filepos_t EbmlElement::RenderHead(IOCallback & output, bool bForceRender, bool bWithDefault, bool bKeepPosition)
|
||||||
{
|
{
|
||||||
if (EBML_ID_LENGTH(EbmlId(*this)) <= 0 || EBML_ID_LENGTH(EbmlId(*this)) > 4)
|
if (EBML_ID_LENGTH((const EbmlId&)*this) <= 0 || EBML_ID_LENGTH((const EbmlId&)*this) > 4)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
UpdateSize(bWithDefault, bForceRender);
|
UpdateSize(bWithDefault, bForceRender);
|
||||||
@ -618,7 +618,7 @@ filepos_t EbmlElement::MakeRenderHead(IOCallback & output, bool bKeepPosition)
|
|||||||
binary FinalHead[4+8]; // Class D + 64 bits coded size
|
binary FinalHead[4+8]; // Class D + 64 bits coded size
|
||||||
unsigned int FinalHeadSize;
|
unsigned int FinalHeadSize;
|
||||||
|
|
||||||
FinalHeadSize = EBML_ID_LENGTH(EbmlId(*this));
|
FinalHeadSize = EBML_ID_LENGTH((const EbmlId&)*this);
|
||||||
EbmlId(*this).Fill(FinalHead);
|
EbmlId(*this).Fill(FinalHead);
|
||||||
|
|
||||||
int CodedSize = CodedSizeLength(Size, SizeLength, bSizeIsFinite);
|
int CodedSize = CodedSizeLength(Size, SizeLength, bSizeIsFinite);
|
||||||
@ -628,7 +628,7 @@ filepos_t EbmlElement::MakeRenderHead(IOCallback & output, bool bKeepPosition)
|
|||||||
output.writeFully(FinalHead, FinalHeadSize);
|
output.writeFully(FinalHead, FinalHeadSize);
|
||||||
if (!bKeepPosition) {
|
if (!bKeepPosition) {
|
||||||
ElementPosition = output.getFilePointer() - FinalHeadSize;
|
ElementPosition = output.getFilePointer() - FinalHeadSize;
|
||||||
SizePosition = ElementPosition + EBML_ID_LENGTH(EbmlId(*this));
|
SizePosition = ElementPosition + EBML_ID_LENGTH((const EbmlId&)*this);
|
||||||
}
|
}
|
||||||
|
|
||||||
return FinalHeadSize;
|
return FinalHeadSize;
|
||||||
@ -638,7 +638,7 @@ uint64 EbmlElement::ElementSize(bool bWithDefault) const
|
|||||||
{
|
{
|
||||||
if (!bWithDefault && IsDefaultValue())
|
if (!bWithDefault && IsDefaultValue())
|
||||||
return 0; // won't be saved
|
return 0; // won't be saved
|
||||||
return Size + EBML_ID_LENGTH(EbmlId(*this)) + CodedSizeLength(Size, SizeLength, bSizeIsFinite);
|
return Size + EBML_ID_LENGTH((const EbmlId&)*this) + CodedSizeLength(Size, SizeLength, bSizeIsFinite);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool EbmlElement::IsSmallerThan(const EbmlElement *Cmp) const
|
bool EbmlElement::IsSmallerThan(const EbmlElement *Cmp) const
|
||||||
|
Loading…
x
Reference in New Issue
Block a user