We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent e7057dc commit a9d74e9Copy full SHA for a9d74e9
src/png/decoder.rs
@@ -242,9 +242,12 @@ impl<R: Read> PNGDecoder<R> {
242
)))
243
}
244
245
- self.interlace_method = match FromPrimitive::from_u8(try!(try!(m.by_ref().bytes().next().ok_or(ImageError::ImageEnd)))) {
246
- Some(method) => method,
247
- None => return Err(ImageError::UnsupportedError(
+ const NONE_U8: u8 = InterlaceMethod::None as u8;
+ const ADAM7_U8: u8 = InterlaceMethod::Adam7 as u8;
+ self.interlace_method = match try!(try!(m.by_ref().bytes().next().ok_or(ImageError::ImageEnd))) {
248
+ NONE_U8 => InterlaceMethod::None,
249
+ ADAM7_U8 => InterlaceMethod::Adam7,
250
+ _ => return Err(ImageError::UnsupportedError(
251
"Unsupported interlace method.".to_string()
252
))
253
};
0 commit comments