From 5618639f897dd9d38ccefa4a61c1ee5718b30000 Mon Sep 17 00:00:00 2001 From: Kenta Sato Date: Thu, 29 Mar 2018 16:38:32 +0900 Subject: [PATCH] use CodecZlib.jl in place of Libz.jl --- REQUIRE | 2 +- src/JLD2.jl | 2 +- src/dataio.jl | 4 ++-- src/datasets.jl | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/REQUIRE b/REQUIRE index e5787ff6..6f07ea3a 100644 --- a/REQUIRE +++ b/REQUIRE @@ -1,5 +1,5 @@ julia 0.6 DataStructures -Libz +CodecZlib 0.4 FileIO 0.5.0 Compat 0.33 diff --git a/src/JLD2.jl b/src/JLD2.jl index 7ced0937..90bb23fb 100644 --- a/src/JLD2.jl +++ b/src/JLD2.jl @@ -1,7 +1,7 @@ __precompile__() module JLD2 -using DataStructures, Libz, FileIO +using DataStructures, CodecZlib, FileIO import Base.sizeof using Compat if VERSION >= v"0.7.0-DEV.2009" diff --git a/src/dataio.jl b/src/dataio.jl index 4445283a..3ced54bf 100644 --- a/src/dataio.jl +++ b/src/dataio.jl @@ -80,7 +80,7 @@ end data_length::Int) where {T,RR} io = f.io inptr = io.curptr - data = read(ZlibInflateInputStream(unsafe_wrap(Array, Ptr{UInt8}(inptr), data_length); gzip=false)) + data = transcode(ZlibDecompressor, unsafe_wrap(Array, Ptr{UInt8}(inptr), data_length)) @simd for i = 1:length(v) dataptr = Ptr{Void}(pointer(data, odr_sizeof(RR)*(i-1)+1)) if !jlconvert_canbeuninitialized(rr) || jlconvert_isinitialized(rr, dataptr) @@ -202,7 +202,7 @@ end io = f.io data_offset = position(io) n = length(v) - data = read!(ZlibInflateInputStream(io; gzip=false), Vector{UInt8}(odr_sizeof(RR)*n)) + data = read!(ZlibDecompressorStream(io), Vector{UInt8}(odr_sizeof(RR)*n)) @simd for i = 1:n dataptr = Ptr{Void}(pointer(data, odr_sizeof(RR)*(i-1)+1)) if !jlconvert_canbeuninitialized(rr) || jlconvert_isinitialized(rr, dataptr) diff --git a/src/datasets.jl b/src/datasets.jl index 4528cadc..3f2185ad 100644 --- a/src/datasets.jl +++ b/src/datasets.jl @@ -344,7 +344,7 @@ function deflate_data(f::JLDFile, data::Array{T}, odr::S, wsession::JLDWriteSess @inbounds h5convert!(cp, odr, f, data[i], wsession) cp += odr_sizeof(odr) end - read(ZlibDeflateInputStream(buf; gzip=false)) + transcode(ZlibCompressor, buf) end function write_dataset(f::JLDFile, dataspace::WriteDataspace, datatype::H5Datatype, odr::S, data::Array{T}, wsession::JLDWriteSession) where {T,S}