Skip to content

Commit

Permalink
Move from Libz to CodecZlib (#130)
Browse files Browse the repository at this point in the history
  • Loading branch information
sciencesam authored and timholy committed Dec 2, 2019
1 parent 7d67154 commit 3c30b3d
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ julia:
- 0.7
- 1.0
- 1.1
- 1.3
- nightly
addons:
# apt:
Expand Down
5 changes: 3 additions & 2 deletions Project.toml
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
name = "MAT"
uuid = "23992714-dd62-5051-b70f-ba57cb901cac"
version = "0.6.0"
version = "0.7.0"

[deps]
BufferedStreams = "e1450e63-4bb3-523b-b2a4-4ffa8c0fd77d"
HDF5 = "f67ccb44-e63f-5c2f-98bd-6dc0ccc4ba2f"
Libz = "2ec943e9-cfe8-584d-b93d-64dcb6d567b7"
SparseArrays = "2f01184e-e22b-5df5-ae63-d93ebab69eaf"
CodecZlib = "944b1d66-785c-5afd-91f1-9de20f533193"

[compat]
BufferedStreams = "≥ 0.2.0"
HDF5 = "≥ 0.11.0"
julia = "0.7, 1"
CodecZlib = "≥ 0.5.0"

[extras]
DataStructures = "864edb3b-99cc-5e75-8d2d-829cb0a9cfe8"
Expand Down
6 changes: 3 additions & 3 deletions src/MAT_v5.jl
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
# http://www.mathworks.com/help/pdf_doc/matlab/matfile_format.pdf

module MAT_v5
using Libz, BufferedStreams, HDF5, SparseArrays
using CodecZlib, BufferedStreams, HDF5, SparseArrays
import Base: read, write, close
import HDF5: names, exists

Expand Down Expand Up @@ -304,7 +304,7 @@ end
function read_matrix(f::IO, swap_bytes::Bool)
(dtype, nbytes) = read_header(f, swap_bytes)
if dtype == miCOMPRESSED
return read_matrix(ZlibInflateInputStream(read!(f, Vector{UInt8}(undef, nbytes))), swap_bytes)
return read_matrix(ZlibDecompressorStream(IOBuffer(read!(f, Vector{UInt8}(undef, nbytes)))), swap_bytes)
elseif dtype != miMATRIX
error("Unexpected data type")
elseif nbytes == 0
Expand Down Expand Up @@ -381,7 +381,7 @@ function getvarnames(matfile::Matlabv5File)
offset = position(matfile.ios)
(dtype, nbytes, hbytes) = read_header(matfile.ios, matfile.swap_bytes)
if dtype == miCOMPRESSED
f = ZlibInflateInputStream(matfile.ios)
f = ZlibDecompressorStream(matfile.ios)
read_header(f, matfile.swap_bytes)
elseif dtype == miMATRIX
f = matfile.ios
Expand Down

0 comments on commit 3c30b3d

Please sign in to comment.