image-rs / deflate-rs

An implementation of a DEFLATE encoder in rust
Apache License 2.0
53 stars 14 forks source link

Readme claims no unsafe but there is one #46

Closed nico-abram closed 4 years ago

nico-abram commented 4 years ago

https://github.com/image-rs/deflate-rs/blob/2385f2a87fae302b9246fc894dbddbba40c7e07c/src/output_writer.rs#L101

I don't personally think this is a big deal and I think the readme is probably just outdated, but imo the readme should be corrected. Would something like "There is a single instance of unsafe behind a feature flag that proved to measurably affect performance" be ok?

oyvindln commented 4 years ago

Oh yeah, that's just an oversight. Will just change it to use a safe lookup, compiler may optimize it anyway. Thought I had done a search for unsafe. The function is only used RLE mode, which has to explicitly chosen when compressing so it's not often used.