diff --git a/Project.toml b/Project.toml index 98ec71f..86d40ab 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "ZipArchives" uuid = "49080126-0e18-4c2a-b176-c102e4b3760c" authors = ["nhz2 "] -version = "2.1.5" +version = "2.1.6" [deps] ArgCheck = "dce04be8-c92d-5529-be00-80e4d2c0e197" diff --git a/src/reader.jl b/src/reader.jl index 062abf4..bacdbaf 100644 --- a/src/reader.jl +++ b/src/reader.jl @@ -35,12 +35,10 @@ function zip_crc32(data::AbstractVector{UInt8}, crc::UInt32=UInt32(0))::UInt32 zip_crc32(collect(data), crc) end -# Copied from ZipFile.jl -readle(io::IO, ::Type{UInt64}) = htol(read(io, UInt64)) -readle(io::IO, ::Type{UInt32}) = htol(read(io, UInt32)) -readle(io::IO, ::Type{UInt16}) = htol(read(io, UInt16)) -readle(io::IO, ::Type{UInt8}) = read(io, UInt8) - +@inline readle(io::IO, ::Type{UInt64}) = UInt64(readle(io, UInt32)) | UInt64(readle(io, UInt32))<<32 +@inline readle(io::IO, ::Type{UInt32}) = UInt32(readle(io, UInt16)) | UInt32(readle(io, UInt16))<<16 +@inline readle(io::IO, ::Type{UInt16}) = UInt16(read(io, UInt8)) | UInt16(read(io, UInt8))<<8 +@inline readle(io::IO, ::Type{UInt8}) = read(io, UInt8) #= Return the minimum size of a local header for an entry.