pe_writer and allow reader::database to accept a buffer instead of a file path#326
Merged
Conversation
DefaultRyan
commented
Apr 17, 2019
| } | ||
|
|
||
| explicit database(std::string_view const& path, cache const* cache = nullptr) : file_view{ path }, m_path{ path }, m_cache{ cache } | ||
| explicit database(std::vector<uint8_t>&& buffer, cache const* cache = nullptr) : m_buffer{ std::move(buffer) }, m_view{ m_buffer.data(), m_buffer.data() + m_buffer.size() }, m_cache{ cache } |
Member
Author
There was a problem hiding this comment.
This diff isn't rendering well. All that really happened here is:
- Moved the code in the current constructor into a private
initializemethod - Added a constructor that takes
std::vector<uint8_t>
Scottj1s
approved these changes
Apr 18, 2019
Scottj1s
left a comment
Member
There was a problem hiding this comment.
I could see generalizing a steam concept to pass into the writer, defaulting to file. But this is fine for now.
kennykerr
approved these changes
Apr 18, 2019
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This change introduces
xlang::meta::writer::pe_writer, which can write out a compliant PE format executable file (aka winmd).To improve testability, I've also modified
xlang::meta::reader::databaseto accept astd::vector<uint8_t>buffer instead of a file path. This way, we can consume and decode the writer's output without needing to touch the file system.