Merge pull request #12 from bvssvni/fix-missing-errors

Fix missing errors
This commit is contained in:
Sven Nilsen authored and GitHub committed 2018-09-19 18:14:16 +02:00
commit f4c864c047
2 files changed
+7 -3

No files matched your search

+1 -1
View File
@@ -493,7 +493,7 @@ impl<R: Read + Seek> Decoder<R> {
}
}
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) {
result = match FromPrimitive::from_u32(predictor) {
+6 -2
View File
@@ -25,6 +25,8 @@ pub enum TiffFormatError {
TiffSignatureNotFound,
TiffSignatureInvalid,
ImageFileDirectoryNotFound,
InconsistentSizesEncountered,
InvalidTag,
RequiredTagNotFound(Tag),
UnknownPredictor(u32),
UnsignedIntegerExpected(Value),
@@ -37,6 +39,8 @@ impl fmt::Display for TiffFormatError {
TiffSignatureNotFound => write!(fmt, "TIFF signature not found."),
TiffSignatureInvalid => write!(fmt, "TIFF signature invalid."),
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),
UnknownPredictor(ref predictor) => write!(fmt, "Unknown predictor “{}” encountered", predictor),
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 {
fn from(err: string::FromUtf8Error) -> TiffError {
TiffError::FormatError(String::from("Image contains invalid tag."))
fn from(_err: string::FromUtf8Error) -> TiffError {
TiffError::FormatError(TiffFormatError::InvalidTag)
}
}