Error::BadDecodingDataSize -> InputBufferTooSmall

This commit is contained in:
Ivan Smirnov 2021-12-01 16:01:17 +00:00
commit d7c8346e39
2 changed files with 8 additions and 6 deletions

View file

@ -36,7 +36,10 @@ where
Pixel<N>: SupportedChannels,
{
if data.len() < QOI_HEADER_SIZE + QOI_PADDING {
return Err(Error::BadDecodingDataSize { size: data.len() });
return Err(Error::InputBufferTooSmall {
size: data.len(),
required: QOI_HEADER_SIZE + QOI_PADDING,
});
}
let header = Header::from_bytes(unsafe {
// Safety: Header is a POD type and we have just checked that the data fits it