Fix missing errors
This commit is contained in:
1 parent
fcd097adc6
commit
c3aaadaa4e
2 files changed
+7
-3
No files matched your search
+1
-1
@@ -493,7 +493,7 @@ impl<R: Read + Seek> Decoder<R> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if units_read < buffer_size {
|
if units_read < buffer_size {
|
||||||
return Err(TiffError::FormatError("Inconsistent sizes encountered.".to_string()));
|
return Err(TiffError::FormatError(TiffFormatError::InconsistentSizesEncountered));
|
||||||
}
|
}
|
||||||
if let Ok(predictor) = self.get_tag_u32(ifd::Tag::Predictor) {
|
if let Ok(predictor) = self.get_tag_u32(ifd::Tag::Predictor) {
|
||||||
result = match FromPrimitive::from_u32(predictor) {
|
result = match FromPrimitive::from_u32(predictor) {
|
||||||
|
|||||||
+6
-2
@@ -25,6 +25,8 @@ pub enum TiffFormatError {
|
|||||||
TiffSignatureNotFound,
|
TiffSignatureNotFound,
|
||||||
TiffSignatureInvalid,
|
TiffSignatureInvalid,
|
||||||
ImageFileDirectoryNotFound,
|
ImageFileDirectoryNotFound,
|
||||||
|
InconsistentSizesEncountered,
|
||||||
|
InvalidTag,
|
||||||
RequiredTagNotFound(Tag),
|
RequiredTagNotFound(Tag),
|
||||||
UnknownPredictor(u32),
|
UnknownPredictor(u32),
|
||||||
UnsignedIntegerExpected(Value),
|
UnsignedIntegerExpected(Value),
|
||||||
@@ -37,6 +39,8 @@ impl fmt::Display for TiffFormatError {
|
|||||||
TiffSignatureNotFound => write!(fmt, "TIFF signature not found."),
|
TiffSignatureNotFound => write!(fmt, "TIFF signature not found."),
|
||||||
TiffSignatureInvalid => write!(fmt, "TIFF signature invalid."),
|
TiffSignatureInvalid => write!(fmt, "TIFF signature invalid."),
|
||||||
ImageFileDirectoryNotFound => write!(fmt, "Image file directory not found."),
|
ImageFileDirectoryNotFound => write!(fmt, "Image file directory not found."),
|
||||||
|
InconsistentSizesEncountered => write!(fmt, "Inconsistent sizes encountered."),
|
||||||
|
InvalidTag => write!(fmt, "Image contains invalid tag."),
|
||||||
RequiredTagNotFound(ref tag) => write!(fmt, "Required tag `{:?}` not found.", tag),
|
RequiredTagNotFound(ref tag) => write!(fmt, "Required tag `{:?}` not found.", tag),
|
||||||
UnknownPredictor(ref predictor) => write!(fmt, "Unknown predictor “{}” encountered", predictor),
|
UnknownPredictor(ref predictor) => write!(fmt, "Unknown predictor “{}” encountered", predictor),
|
||||||
UnsignedIntegerExpected(ref val) => write!(fmt, "Expected unsigned integer, {:?} found.", val),
|
UnsignedIntegerExpected(ref val) => write!(fmt, "Expected unsigned integer, {:?} found.", val),
|
||||||
@@ -113,8 +117,8 @@ impl From<io::Error> for TiffError {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl From<string::FromUtf8Error> for TiffError {
|
impl From<string::FromUtf8Error> for TiffError {
|
||||||
fn from(err: string::FromUtf8Error) -> TiffError {
|
fn from(_err: string::FromUtf8Error) -> TiffError {
|
||||||
TiffError::FormatError(String::from("Image contains invalid tag."))
|
TiffError::FormatError(TiffFormatError::InvalidTag)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user