-
Notifications
You must be signed in to change notification settings - Fork 1
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
Caller passes in dst to decompress #125
Conversation
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## master #125 +/- ##
==========================================
- Coverage 82.32% 82.29% -0.03%
==========================================
Files 17 16 -1
Lines 628 627 -1
Branches 37 38 +1
==========================================
- Hits 517 516 -1
Misses 94 94
Partials 17 17 ☔ View full report in Codecov by Sentry. |
383b58c
to
4b68cb5
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some comments about addressing sad path cases.
Those mostly align with the missing coverage from this patch.
Not sure if you wanted to address those in a follow-up but it's approved if that's the case.
if (header->type == NoCompression) { // no compression | ||
// Any bits of input up to the next byte boundary are ignored. | ||
src_bits.consume_to_byte_boundary(); | ||
const std::uint16_t len = src_bits.pop_16(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we know the input is large enough to store this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Guessing you mean "Do we know src_bits.size() >= 16
"?
bit_span.pop()
asserts that, but we should probably handle it here, in the same way that we handle the "not enough bits in src" issue below. I'll do that in another PR, this one is getting a little big.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah exactly
4b68cb5
to
c29dd8c
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the quick review. Missing coverage is mostly not actually new, just seems like it because I moved from .hpp to .cpp. Probably should have done that in 2 commits.
if (header->type == NoCompression) { // no compression | ||
// Any bits of input up to the next byte boundary are ignored. | ||
src_bits.consume_to_byte_boundary(); | ||
const std::uint16_t len = src_bits.pop_16(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Guessing you mean "Do we know src_bits.size() >= 16
"?
bit_span.pop()
asserts that, but we should probably handle it here, in the same way that we handle the "not enough bits in src" issue below. I'll do that in another PR, this one is getting a little big.
This avoids allocation inside decompress. Also: * Doxygen style comments for public interface. * Move decompress implementation to .cpp since it is no longer templated. * Move checking of final to the top of the loop. Change-Id: I4afa1e306c5d20c1a83d3173292b77ab6e8fc01c
c29dd8c
to
6ee5b24
Compare
@oliverlee I made some fairly significant changes in response to your feedback. I'll merge now but feel free to add comments and I'll respond later. |
Caller passes in dst to decompress
This avoids allocation inside decompress.
Also:
templated.
Change-Id: I4afa1e306c5d20c1a83d3173292b77ab6e8fc01c