-
-
Notifications
You must be signed in to change notification settings - Fork 28
Implement gzsetparams #356
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
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Flags with carried forward coverage won't be shown. Click here to find out more.
... and 6 files with indirect coverage changes 🚀 New features to boost your workflow:
|
let Ok(strategy) = Strategy::try_from(strategy) else { | ||
return Z_STREAM_ERROR; | ||
}; |
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.
This check isn't in zlib-ng, but I needed it for the Rust version because we use a Strategy
enum to hold the strategy internally. I return Z_STREAM_ERROR
here to for consistency with the Rust version of deflateParams
.
@folkertdev this isn't an issue for this PR, but do you have a preferred way to implement C FFI varargs? One of the few gz functions left to implement is:
There's a |
} | ||
// Safety: Because `state` is in write mode and `state.input` is non-null, `state.stream` | ||
// was initialized using `deflateInit2` in `gz_init`. | ||
unsafe { super::deflateParams(&mut state.stream, level, strategy as c_int) }; |
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.
it's really odd that the return value of this function is ignored. Basically, the user is responsible for providing values that are within the allowed ranges, and otherwise this function just silently fails.
Can you add a comment to that effect to the documentation of this function?
Hmm yeah that won't work. That feature is experimental, and I don't think it's anywhere near stabilization. So I think there are 3 options
None of those are good options, really. @bjorn3 do you have thoughts here? |
No description provided.