Skip to content

Commit

Permalink
more fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
musm committed Mar 25, 2018
1 parent 49ff1e5 commit dceb7a3
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 9 deletions.
6 changes: 3 additions & 3 deletions src/HDF5.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1386,9 +1386,9 @@ function read(obj::DatasetOrAttribute, ::Type{Array{S}}) where {S<:String}
readarray(obj, memtype_id, buf)
src = 1
for i = 1:len
slen = findnext(buf, 0x00, src) - src # find null terminator
slen = coalesce(findnext(isequal(0x00), buf, src), 0) - src # find null terminator
sv = StringVector(slen)
copy!(sv, 1, buf, src, slen)
copyto!(sv, 1, buf, src, slen)
ret[i] = String(sv)
src += ilen
end
Expand Down Expand Up @@ -1804,7 +1804,7 @@ d_create_external(parent::Union{HDF5File, HDF5Group}, name::String, filepath::St

function do_write_chunk(dataset::HDF5Dataset, offset, chunk_bytes::Vector{UInt8}, filter_mask=0)
checkvalid(dataset)
offs = collect(Hsize, reverse(offset))-1
offs = collect(Hsize, reverse(offset)) .- 1
h5do_write_chunk(dataset, H5P_DEFAULT, UInt32(filter_mask), offs, length(chunk_bytes), chunk_bytes)
end

Expand Down
2 changes: 1 addition & 1 deletion src/datafile.jl
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ read(f::Base.Callable, parent::DataFile, name::String...) =
# Read every variable in the file
function read(f::DataFile)
vars = names(f)
vals = Vector{Any}(length(vars))
vals = Vector{Any}(undef,length(vars))
for i = 1:length(vars)
vals[i] = read(f, vars[i])
end
Expand Down
11 changes: 6 additions & 5 deletions test/gc.jl
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
using HDF5
using Compat.Test
import Compat.GC

macro gcvalid(args...)
Expr(:block, quote
gc_enable(true)
gc()
gc_enable(false)
GC.enable(true)
GC.gc()
GC.enable(false)
end,
[:(@test HDF5.isvalid($(esc(x)))) for x in args]...)
end
Expand All @@ -23,7 +24,7 @@ end

@testset "gc" begin

gc_enable(false)
GC.enable(false)
fn = tempname()
for i = 1:10
file = h5open(fn, "w")
Expand Down Expand Up @@ -62,7 +63,7 @@ for i = 1:10
@gcvalid dt ds d g a
close(file)
end
gc_enable(true)
GC.enable(true)
rm(fn)

end # testset gc
1 change: 1 addition & 0 deletions test/readremote.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using HDF5
using Compat.Test
using Compat.LinearAlgebra: norm

@testset "readremote" begin

Expand Down

0 comments on commit dceb7a3

Please sign in to comment.