Skip to content

Conversation

@peckpeck
Copy link
Contributor

Decompress does not limit how many bytes it writes to the buffer.

This means that we will lose any byte present before the call, which is not a problem when we decompress all in one go, but is annoying when we want to use the buffer as a ring buffer.

So I added a decompress_with_limit which takes a maximum number of bytes to decompress. With it, it is possible to use the output buffer as a ring buffer, just don't overwrite bytes that have not yet been consumed.

@oyvindln
Copy link
Collaborator

This looks fine though I'm not entirely clear on what this achieves that over just limiting the length of the output slice you are passing in achieves?

@peckpeck
Copy link
Contributor Author

It is mostly the same as limiting the length of the output slice, except that it is not possible to change this length in practice when you are not passing TINFL_FLAG_USING_NON_WRAPPING_OUTPUT_BUF since the output slice is required to contain old data and have a size of the power of 2.

@peckpeck
Copy link
Contributor Author

I added a little more documentation to explain that usage

@peckpeck
Copy link
Contributor Author

peckpeck commented Oct 3, 2025

You do not seem to be convinced

@oyvindln oyvindln merged commit bac1abe into Frommi:master Oct 3, 2025
10 checks passed
@oyvindln
Copy link
Collaborator

oyvindln commented Oct 3, 2025

Nah it looks fine, I've had some extra health issues recently so haven't had the energy to look over things and there aren't any other maintainers on this library. Will try to check over this and the issue you posted sometime within next week.

I don't really have any objections to it, though I do want to make sure changing what is checked against in the buffer doesn't have any impact on performance characteristics.

@peckpeck
Copy link
Contributor Author

peckpeck commented Oct 4, 2025

I'm sorry to hear that. I hope you go well.
Thank you for your time.

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.

2 participants