Skip to content
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

Expose ZSTD_error_dstSize_tooSmall in the bulk API #276

Open
newpavlov opened this issue Apr 17, 2024 · 0 comments
Open

Expose ZSTD_error_dstSize_tooSmall in the bulk API #276

newpavlov opened this issue Apr 17, 2024 · 0 comments

Comments

@newpavlov
Copy link

In my project I compress blocks of known size into buffers with the same block size. If data is not compressible (should not happen in practice, but still theoretically possible), then there is a separate fallback path in which block data is stored without any compression.

Right now, I have to use compress2 from zstd_safe with manual matching of error code on 70 (value of ZSTD_error_dstSize_tooSmall taken from zstd_errors.h). At the very least, it would be nice to expose the error constant (and maybe the other error codes as well for consistency) in zstd_safe and ideally it would be great to be able to efficiently detect "destination buffer is too small" case in the bulk API. For example, it could be done by introducing a method which returns io::Result<Option<usize>>, with Ok(None) used for the "too small" case.

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

No branches or pull requests

1 participant