From 2753bfd8a3434260416ac2a0784a4044db6706a5 Mon Sep 17 00:00:00 2001 From: Steve Lhomme Date: Mon, 19 Apr 2010 12:41:49 +0000 Subject: [PATCH] v1/v2: simplify EBML_SEM_ID(EBML_CTX_IDX()) to EBML_CTX_IDX_ID() git-svn-id: https://matroska.svn.sourceforge.net/svnroot/matroska/trunk/libebml@138 a6f86f6d-0131-4f8e-9e7b-e335508773d5 --- ebml/EbmlElement.h | 4 ++-- src/EbmlElement.cpp | 6 +++--- src/EbmlMaster.cpp | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/ebml/EbmlElement.h b/ebml/EbmlElement.h index a1e7de1..15ccc53 100644 --- a/ebml/EbmlElement.h +++ b/ebml/EbmlElement.h @@ -194,7 +194,6 @@ extern const EbmlSemanticContext Context_EbmlGlobal; #define EBML_INFO_CONTEXT(cb) (cb).GetContext() #define EBML_SEM_UNIQUE(s) (s).IsUnique() -#define EBML_SEM_ID(s) ((const EbmlCallbacks &)(s)).ClassId() #define EBML_SEM_CONTEXT(s) ((const EbmlCallbacks &)(s)).GetContext() #define EBML_SEM_CREATE(s) (s).Create() @@ -203,6 +202,7 @@ extern const EbmlSemanticContext Context_EbmlGlobal; #define EBML_CTX_PARENT(c) (c).Parent() #define EBML_CTX_IDX(c,i) (c).GetSemantic(i) #define EBML_CTX_IDX_INFO(c,i) (const EbmlCallbacks &)((c).GetSemantic(i)) +#define EBML_CTX_IDX_ID(c,i) ((const EbmlCallbacks &)((c).GetSemantic(i))).ClassId() #else #define EBML_CONCRETE_CLASS(Type) \ public: \ @@ -227,7 +227,6 @@ extern const EbmlSemanticContext Context_EbmlGlobal; #define EBML_INFO_CONTEXT(cb) (cb).Context #define EBML_SEM_UNIQUE(s) (s).Unique -#define EBML_SEM_ID(s) (s).GetCallbacks.GlobalId #define EBML_SEM_CONTEXT(s) (s).GetCallbacks.Context #define EBML_SEM_CREATE(s) (s).Create() @@ -236,6 +235,7 @@ extern const EbmlSemanticContext Context_EbmlGlobal; #define EBML_CTX_PARENT(c) (c).UpTable #define EBML_CTX_IDX(c,i) (c).MyTable[(i)] #define EBML_CTX_IDX_INFO(c,i) (c).MyTable[(i)].GetCallbacks +#define EBML_CTX_IDX_ID(c,i) (c).MyTable[(i)].GetCallbacks.GlobalId #endif #if !defined(INVALID_FILEPOS_T) diff --git a/src/EbmlElement.cpp b/src/EbmlElement.cpp index f037b05..f75902f 100644 --- a/src/EbmlElement.cpp +++ b/src/EbmlElement.cpp @@ -492,7 +492,7 @@ EbmlElement * EbmlElement::SkipData(EbmlStream & DataStream, const EbmlSemanticC unsigned int EltIndex; // data known in this Master's context for (EltIndex = 0; EltIndex < EBML_CTX_SIZE(Context); EltIndex++) { - if (EbmlId(*Result) == EBML_SEM_ID(EBML_CTX_IDX(Context,EltIndex))) { + if (EbmlId(*Result) == EBML_CTX_IDX_ID(Context,EltIndex)) { // skip the data with its own context Result = Result->SkipData(DataStream, EBML_SEM_CONTEXT(EBML_CTX_IDX(Context,EltIndex)), NULL); break; // let's go to the next ID @@ -527,8 +527,8 @@ EbmlElement *EbmlElement::CreateElementUsingContext(const EbmlId & aID, const Eb // elements at the current level for (ContextIndex = 0; ContextIndex < EBML_CTX_SIZE(Context); ContextIndex++) { - if (aID == EBML_SEM_ID(EBML_CTX_IDX(Context,ContextIndex))) { - return &EBML_CTX_IDX(Context,ContextIndex).Create(); + if (aID == EBML_CTX_IDX_ID(Context,ContextIndex)) { + return &EBML_SEM_CREATE(EBML_CTX_IDX(Context,ContextIndex)); } } diff --git a/src/EbmlMaster.cpp b/src/EbmlMaster.cpp index d49556c..ba3a79a 100644 --- a/src/EbmlMaster.cpp +++ b/src/EbmlMaster.cpp @@ -189,8 +189,8 @@ bool EbmlMaster::ProcessMandatory() unsigned int EltIdx; for (EltIdx = 0; EltIdx < EBML_CTX_SIZE(Context); EltIdx++) { if (EBML_CTX_IDX(Context,EltIdx).IsMandatory() && EBML_CTX_IDX(Context,EltIdx).IsUnique()) { -// assert(EBML_CTX_IDX(Context,EltIdx).Create() != NULL); - PushElement(EBML_CTX_IDX(Context,EltIdx).Create()); +// assert(EBML_CTX_IDX(Context,EltIdx).Create != NULL); + PushElement(EBML_SEM_CREATE(EBML_CTX_IDX(Context,EltIdx))); } } return true;