Merge branch 'master' into master

This commit is contained in:
Sven Nilsen authored and GitHub committed 2018-09-19 15:25:24 +02:00
commit 742784ddc7
4 files changed
+93 -60

No files matched your search

+4 -6
View File
@@ -4,7 +4,7 @@ use std::io::{self, Read, Seek};
use std::collections::{HashMap};
use super::stream::{ByteOrder, SmartReader, EndianReader};
use ::{TiffError, TiffResult};
use ::{TiffError, TiffFormatError, TiffUnsupportedError, TiffResult};
use self::Value::{Unsigned, List, Rational, Ascii};
@@ -86,7 +86,7 @@ pub enum Type {
#[allow(unused_qualifications)]
#[derive(Debug)]
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub enum Value {
//Signed(i32),
Unsigned(u32),
@@ -99,9 +99,7 @@ impl Value {
pub fn into_u32(self) -> TiffResult<u32> {
match self {
Unsigned(val) => Ok(val),
val => Err(TiffError::FormatError(format!(
"Expected unsigned integer, {:?} found.", val
)))
val => Err(TiffError::FormatError(TiffFormatError::UnsignedIntegerExpected(val))),
}
}
pub fn into_u32_vec(self) -> TiffResult<Vec<u32>> {
@@ -202,7 +200,7 @@ impl Entry {
let string = try!(decoder.read_string(n as usize));
Ok(Ascii(string))
}
_ => Err(TiffError::UnsupportedError("Unsupported data type.".to_string()))
_ => Err(TiffError::UnsupportedError(TiffUnsupportedError::UnsupportedDataType))
}
}
}