From 647de77b707af0897cf8070844a9cf98a78b8621 Mon Sep 17 00:00:00 2001 From: raph Date: Thu, 10 Sep 2020 18:37:15 +0200 Subject: [PATCH] Add support for UNDEFINED type According to TIFF spec this is an byte-array that may contain arbitrary data. --- src/decoder/ifd.rs | 5 ++++- src/tags.rs | 1 + 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/decoder/ifd.rs b/src/decoder/ifd.rs index d11319b..e8f8f16 100644 --- a/src/decoder/ifd.rs +++ b/src/decoder/ifd.rs @@ -425,7 +425,10 @@ impl Entry { let string = decoder.read_string(n)?; Ok(Ascii(string)) } - } + }, + (Type::UNDEFINED, n) => self.decode_offset(n, bo, limits, decoder, |decoder| { + Ok(Unsigned(u32::from(decoder.read_byte()?))) + }), _ => Err(TiffError::UnsupportedError( TiffUnsupportedError::UnsupportedDataType, )), diff --git a/src/tags.rs b/src/tags.rs index d28808a..1364fa6 100644 --- a/src/tags.rs +++ b/src/tags.rs @@ -130,6 +130,7 @@ pub enum Type(u16) { LONG = 4, RATIONAL = 5, SBYTE = 6, + UNDEFINED = 7, SSHORT = 8, SLONG = 9, SRATIONAL = 10,