Adjust field names based on review
This commit is contained in:
1 parent
4d8c64bf1e
commit
6d7d92c605
2 files changed
+20
-14
No files matched your search
+5
-5
@@ -813,8 +813,8 @@ impl<R: Read + Seek> Decoder<R> {
|
|||||||
if bytes / buffer.byte_len() > strip_sample_count {
|
if bytes / buffer.byte_len() > strip_sample_count {
|
||||||
return Err(TiffError::FormatError(
|
return Err(TiffError::FormatError(
|
||||||
TiffFormatError::UnexpectedCompressedData {
|
TiffFormatError::UnexpectedCompressedData {
|
||||||
actual: bytes,
|
actual_bytes: bytes,
|
||||||
required: strip_sample_count * buffer.byte_len(),
|
required_bytes: strip_sample_count * buffer.byte_len(),
|
||||||
},
|
},
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
@@ -1048,9 +1048,9 @@ impl<R: Read + Seek> Decoder<R> {
|
|||||||
|
|
||||||
if units_read < buffer_size {
|
if units_read < buffer_size {
|
||||||
return Err(TiffError::FormatError(
|
return Err(TiffError::FormatError(
|
||||||
TiffFormatError::InconsistentStripElements {
|
TiffFormatError::InconsistentStripSamples {
|
||||||
actual: units_read,
|
actual_samples: units_read,
|
||||||
required: buffer_size,
|
required_samples: buffer_size,
|
||||||
},
|
},
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|||||||
+15
-9
@@ -44,12 +44,12 @@ pub enum TiffFormatError {
|
|||||||
ImageFileDirectoryNotFound,
|
ImageFileDirectoryNotFound,
|
||||||
InconsistentSizesEncountered,
|
InconsistentSizesEncountered,
|
||||||
UnexpectedCompressedData {
|
UnexpectedCompressedData {
|
||||||
actual: usize,
|
actual_bytes: usize,
|
||||||
required: usize,
|
required_bytes: usize,
|
||||||
},
|
},
|
||||||
InconsistentStripElements {
|
InconsistentStripSamples {
|
||||||
actual: usize,
|
actual_samples: usize,
|
||||||
required: usize,
|
required_samples: usize,
|
||||||
},
|
},
|
||||||
InvalidTag,
|
InvalidTag,
|
||||||
InvalidTagValueType(Tag),
|
InvalidTagValueType(Tag),
|
||||||
@@ -74,18 +74,24 @@ impl fmt::Display for TiffFormatError {
|
|||||||
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."),
|
InconsistentSizesEncountered => write!(fmt, "Inconsistent sizes encountered."),
|
||||||
UnexpectedCompressedData { actual, required } => {
|
UnexpectedCompressedData {
|
||||||
|
actual_bytes,
|
||||||
|
required_bytes,
|
||||||
|
} => {
|
||||||
write!(
|
write!(
|
||||||
fmt,
|
fmt,
|
||||||
"Decompression returned different amount of bytes than expected: got {}, expected {}.",
|
"Decompression returned different amount of bytes than expected: got {}, expected {}.",
|
||||||
actual, required
|
actual_bytes, required_bytes
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
InconsistentStripElements { actual, required } => {
|
InconsistentStripSamples {
|
||||||
|
actual_samples,
|
||||||
|
required_samples,
|
||||||
|
} => {
|
||||||
write!(
|
write!(
|
||||||
fmt,
|
fmt,
|
||||||
"Inconsistent elements in strip: got {}, expected {}.",
|
"Inconsistent elements in strip: got {}, expected {}.",
|
||||||
actual, required
|
actual_samples, required_samples
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
InvalidTag => write!(fmt, "Image contains invalid tag."),
|
InvalidTag => write!(fmt, "Image contains invalid tag."),
|
||||||
|
|||||||
Reference in new issue
Block a user