Repository navigation
Delete unsafe from brotli refcount translation - #618
Merged
Merged
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.
The previous refcount translation of brotli used unsafe FFI. This PR adds a safe shim that keeps the API structure of C while using the safe brotli crate in the background.
For example in C,
BrotliDecoderStateis an opaque pointer and functions return memory inside it:In the safe brotli crate the pattern is:
The shim bridges these 2 APIs:
The safe rust brotli crate promises byte-by-byte identical output to C only for compression levels 0-9. For 10 and 11 the output of the encoder might differ.
This is fine, encoders are not required to be byte-by-byte identical. Only decoding requires that. This means that we need to change the scripts in cpp2rust-testsuite.