Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reduce the number of methods and cleanup some macros #247

Merged
merged 13 commits into from
Feb 24, 2024

Conversation

robUx4
Copy link
Contributor

@robUx4 robUx4 commented Feb 4, 2024

We can do with less methods and reuse the methods that already exist to do the same calls.

That will make things easier to maintain.

@robUx4 robUx4 added api-break breaks the API (e.g. programs using it will have to adjust their source code) abi-break breaks the ABI (e.g. programs linked against the library have to be recompiled) labels Feb 4, 2024
@neheb
Copy link
Contributor

neheb commented Feb 9, 2024

unreferenced inline function has been removed

hmmmmm

@@ -234,32 +234,31 @@ class DllApi x : public BaseClass { \

#define EBML_CONCRETE_CLASS(Type) \
public: \
libebml::EbmlElement & CreateElement() const override {return Create();} \
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't work for me. There are places where I have a generic EbmlElement, and I need to create another instance of the same type. Before I could just use this function; now I cannot see a way to do it anymore.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indeed, we need this for generic usage. I dropped this commit.

@robUx4 robUx4 force-pushed the direct_create branch 2 times, most recently from 01f8416 to b1f9ac1 Compare February 24, 2024 10:30
@@ -427,10 +427,9 @@ EbmlElement *EbmlElement::CreateElementUsingContext(const EbmlId & aID, const Eb
// elements at the current level
for (unsigned int ContextIndex = 0; ContextIndex < EBML_CTX_SIZE(Context); ContextIndex++) {
if (aID == EBML_CTX_IDX_ID(Context,ContextIndex)) {
auto ClassInfos = EBML_CTX_IDX(Context,ContextIndex);
if (AsInfiniteSize && !ClassInfos.GetCallbacks().CanHaveInfiniteSize())
if (AsInfiniteSize && !EBML_CTX_IDX_INFO(Context,ContextIndex).CanHaveInfiniteSize())
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When merging this PR to the current master, this line doesn't compile anymore:

lib/libebml/src/EbmlElement.cpp:430:70: fatal error: no member named 'CanHaveInfiniteSize' in 'libebml::EbmlSemantic'
      if (AsInfiniteSize && !EBML_CTX_IDX_INFO(Context,ContextIndex).CanHaveInfiniteSize()) 

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rebased on top of #267 which has a bit more macro usage and fixes that issue.

We can differentiate between the "pure" access macros and the "wrapper" ones.
EBML_CTX_IDX(MasterContext,EltIdx).GetCallbacks() is equivalent to
EBML_CTX_IDX_INFO(MasterContext,EltIdx)
We can just use the semantic. No need to create
a function for each existing class.
According to 8613939
it was kept for compatibility, but we're breaking the API.
Just like every other Ebml element that will have a Create().
But not static as some may be exported.
@mbunkus mbunkus merged commit 0b55fec into Matroska-Org:master Feb 24, 2024
5 of 15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
abi-break breaks the ABI (e.g. programs linked against the library have to be recompiled) api-break breaks the API (e.g. programs using it will have to adjust their source code)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants