Conversation
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.
Two new methods for
IfdDecoder:find_tag_buf(&mut self, &mut ValueBuffer) -> Result<Option<Entry>, _>find_tag_bytes(&mut self, buf: &mut [u8], offset: u64) -> Result<Option<usize>, _>Both will only access bytes belonging to the tag entry if present. The former returns the entry itself as convenience. It must be an option for case the tag is missing, which we want to signal as success and
Entryoccurs naturally. Most of the information would be present on the buffer afterwards though. The byte version returns the number of bytes that have been written. You're expected to have calledfind_entryto allocate the buffer so the entry itself will likely not provide new information.Note that
find_tag_bufis not implemented in terms of the other since there is a potential optimization that delays allocating the buffer until we found that the reader actually has enough data present. (Similar to<dyn Read>::read_to_end). We always enforce the limit so this is pure optimization left for later.