Skip to content

Commit

Permalink
Improve read inference
Browse files Browse the repository at this point in the history
  • Loading branch information
timholy committed Feb 25, 2021
1 parent 51e18ee commit 49903ee
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/tags.jl
Original file line number Diff line number Diff line change
Expand Up @@ -93,19 +93,19 @@ function _read(io::Stream, tf::TiffFile{O}, ::Type{Tag}) where O <: Unsigned
T = tiff_to_julian[datatype]
end

nbytes = bytes(T) * count
nbytes = bytes(T)::Int * count
if nbytes <= sizeof(O)
if tf.need_bswap
reverse!(view(data, 1:nbytes))
end
if T == String
if T === String
return Tag(tag, String(data))
elseif T == Any
elseif T === Any
return Tag(tag, Array{Any}(data))
elseif count == 1
return Tag(tag, first(reinterpret(T, data)))
else
return Tag(tag, Array(reinterpret(T, data)[1:Int(count)]))
return Tag(tag, reinterpret(T, data)[1:Int(count)])
end
else
(tf.need_bswap) && reverse!(data)
Expand Down

0 comments on commit 49903ee

Please sign in to comment.