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 memory mapped files access #1781

Draft
wants to merge 7 commits into
base: master
Choose a base branch
from
Draft

Use memory mapped files access #1781

wants to merge 7 commits into from

Conversation

lhog
Copy link
Collaborator

@lhog lhog commented Nov 25, 2024

No description provided.

std::vector<std::uint8_t> buf;

if (!ar->GetFile(fileName, buf) || buf.empty()) {
// use the same buffer to avoid allocation costs for every invocation
Copy link
Collaborator

Choose a reason for hiding this comment

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

Perhaps this could be static to the function instead of class member?

#endif
return false;
Copy link
Collaborator

@sprunk sprunk Nov 28, 2024

Choose a reason for hiding this comment

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

The non-TOOLS path will have two unconditional returns in a row now, the second one is dead code and may confuse static analysis (or produce warnings etc)

@@ -6,6 +6,7 @@
#include <vector>
#include <string>
#include <fstream>
#include <memory>
Copy link
Collaborator

Choose a reason for hiding this comment

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

Shouldn't this be added to some .cpp file(s) instead? Looks like no new code was added below so probably doesn't need to be in the header (gets applies everywhere the .h is included even if not all .cpp files need it)

@p2004a
Copy link
Collaborator

p2004a commented Nov 28, 2024

Please add it as git submodule, not copy paste code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants