Rework ColorSpace to match the latest spec (0 | 1)

This commit is contained in:
Ivan Smirnov 2021-12-31 13:34:27 +03:00
commit 2dcbdd19c2
5 changed files with 81 additions and 95 deletions

View file

@ -15,7 +15,7 @@ pub enum Error {
OutputBufferTooSmall { size: usize, required: usize },
InvalidMagic { magic: u32 },
UnexpectedBufferEnd,
// TODO: invalid colorspace
InvalidColorSpace { colorspace: u8 },
}
pub type Result<T> = StdResult<T, Error>;
@ -48,6 +48,9 @@ impl Display for Error {
Self::UnexpectedBufferEnd => {
write!(f, "unexpected input buffer end while decoding")
}
Self::InvalidColorSpace { colorspace } => {
write!(f, "invalid color space: {} (expected 0 or 1)", colorspace)
}
}
}
}