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

Use a vector in MemIOCallback #198

Merged
merged 2 commits into from
Dec 31, 2023
Merged

Conversation

robUx4
Copy link
Contributor

@robUx4 robUx4 commented Dec 30, 2023

No description provided.

Since the instance is not supposed to be modified, neither are its data.
It allows simple reallocation (resizing). It should be more efficient when adding data little by little.
@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 Dec 30, 2023
@@ -61,7 +63,7 @@ class EBML_DLL_API MemIOCallback : public IOCallback
*/
void close() override {}

binary *GetDataBuffer() const {return dataBuffer;}
const binary *GetDataBuffer() const {return dataBuffer.data();}
Copy link
Contributor

Choose a reason for hiding this comment

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

I assume that the intention of the GetDataBuffer function is to have direct read-only access to the underlying storage. If write access is also wanted, then you could leave out the const & return &dataBuffer[0] instead.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We can also use data() for that, we just need to leave the const on both sides of the method.

@robUx4 robUx4 merged commit 6855edd into Matroska-Org:master Dec 31, 2023
15 checks passed
@robUx4 robUx4 deleted the memio_vector branch December 31, 2023 06:19
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.

2 participants