Skip to content

Commit

Permalink
Cast Short to u16 instead of u32
Browse files Browse the repository at this point in the history
Adapted from 84ff679
  • Loading branch information
weiji14 committed Jul 22, 2024
1 parent 5808cd0 commit 36f8ee0
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/decoder/ifd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,7 @@ impl Value {
}
Ok(new_vec)
}
Short(val) => Ok(vec![val.into()]),
Unsigned(val) => Ok(vec![val]),
UnsignedBig(val) => Ok(vec![u32::try_from(val)?]),
Rational(numerator, denominator) => Ok(vec![numerator, denominator]),
Expand Down Expand Up @@ -283,6 +284,7 @@ impl Value {
}
Ok(new_vec)
}
Short(val) => Ok(vec![val.into()]),
Unsigned(val) => Ok(vec![val.into()]),
UnsignedBig(val) => Ok(vec![val]),
Rational(numerator, denominator) => Ok(vec![numerator.into(), denominator.into()]),
Expand Down Expand Up @@ -431,7 +433,7 @@ impl Entry {
Type::BYTE => Unsigned(u32::from(self.offset[0])),
Type::SBYTE => Signed(i32::from(self.offset[0] as i8)),
Type::UNDEFINED => Byte(self.offset[0]),
Type::SHORT => Unsigned(u32::from(self.r(bo).read_u16()?)),
Type::SHORT => Short(self.r(bo).read_u16()?),
Type::SSHORT => Signed(i32::from(self.r(bo).read_i16()?)),
Type::LONG => Unsigned(self.r(bo).read_u32()?),
Type::SLONG => Signed(self.r(bo).read_i32()?),
Expand Down

0 comments on commit 36f8ee0

Please sign in to comment.