Skip to content

Commit ab97a54

Browse files
committed
1 parent f975f1d commit ab97a54

File tree

2 files changed

+12
-12
lines changed

2 files changed

+12
-12
lines changed

src/JLD.jl

+2-2
Original file line numberDiff line numberDiff line change
@@ -686,7 +686,7 @@ length(dset::JldDataset) = prod(size(dset))
686686
endof(dset::JldDataset) = length(dset)
687687

688688
### Read/write via getindex/setindex! ###
689-
function getindex(dset::JldDataset, indices::Union(Integer, RangeIndex)...)
689+
function getindex(dset::JldDataset, indices::Union(Range{Int},Integer)...)
690690
sz = map(length, indices)
691691
dsel_id = HDF5.hyperslab(dset.plain, indices...)
692692
try
@@ -701,7 +701,7 @@ function getindex(dset::JldDataset, indices::Union(Integer, RangeIndex)...)
701701
end
702702
end
703703

704-
function setindex!{T,N}(dset::JldDataset, X::AbstractArray{T,N}, indices::RangeIndex...)
704+
function setindex!{T,N}(dset::JldDataset, X::AbstractArray{T,N}, indices::Union(Range{Int},Integer)...)
705705
f = file(dset)
706706
sz = map(length, indices)
707707
dsel_id = HDF5.hyperslab(dset.plain, indices...)

src/plain.jl

+10-10
Original file line numberDiff line numberDiff line change
@@ -604,7 +604,7 @@ function h5read(filename, name::ByteString)
604604
dat
605605
end
606606

607-
function h5read(filename, name::ByteString, indices::(Union(RangeIndex,Colon)...))
607+
function h5read(filename, name::ByteString, indices::(Union(Range{Int},Int,Colon)...))
608608
local dat
609609
fid = h5open(filename, "r")
610610
try
@@ -1536,7 +1536,7 @@ write{T<:BitsKindOrByteString}(parent::Union(HDF5File, HDF5Group), name::ByteStr
15361536
write{T<:BitsKindOrByteString}(parent::HDF5Dataset, name::ByteString, data::Union(T, Array{T}), plists...) = a_write(parent, name, data, plists...)
15371537

15381538
# Reading arrays using getindex: data = dset[:,:,10]
1539-
function getindex(dset::HDF5Dataset, indices::RangeIndex...)
1539+
function getindex(dset::HDF5Dataset, indices::Union(Range{Int},Int)...)
15401540
local T
15411541
dtype = datatype(dset)
15421542
try
@@ -1546,7 +1546,7 @@ function getindex(dset::HDF5Dataset, indices::RangeIndex...)
15461546
end
15471547
_getindex(dset,T, indices...)
15481548
end
1549-
function _getindex(dset::HDF5Dataset, T::Type, indices::RangeIndex...)
1549+
function _getindex(dset::HDF5Dataset, T::Type, indices::Union(Range{Int},Int)...)
15501550
if !(T<:HDF5BitsKind)
15511551
error("Dataset indexing (hyperslab) is available only for bits types")
15521552
end
@@ -1565,11 +1565,11 @@ function _getindex(dset::HDF5Dataset, T::Type, indices::RangeIndex...)
15651565
end
15661566

15671567
# Write to a subset of a dataset using array slices: dataset[:,:,10] = array
1568-
function setindex!(dset::HDF5Dataset, X::Array, indices::RangeIndex...)
1568+
function setindex!(dset::HDF5Dataset, X::Array, indices::Union(Range{Int},Int)...)
15691569
T = hdf5_to_julia(dset)
15701570
_setindex!(dset, T, X, indices...)
15711571
end
1572-
function _setindex!(dset::HDF5Dataset,T::Type, X::Array, indices::RangeIndex...)
1572+
function _setindex!(dset::HDF5Dataset,T::Type, X::Array, indices::Union(Range{Int},Int)...)
15731573
if !(T<:Array)
15741574
error("Dataset indexing (hyperslab) is available only for arrays")
15751575
end
@@ -1596,7 +1596,7 @@ function _setindex!(dset::HDF5Dataset,T::Type, X::Array, indices::RangeIndex...)
15961596
end
15971597
X
15981598
end
1599-
function setindex!(dset::HDF5Dataset, X::AbstractArray, indices::RangeIndex...)
1599+
function setindex!(dset::HDF5Dataset, X::AbstractArray, indices::Union(Range{Int},Int)...)
16001600
T = hdf5_to_julia(dset)
16011601
if !(T<:Array)
16021602
error("Hyperslab interface is available only for arrays")
@@ -1605,7 +1605,7 @@ function setindex!(dset::HDF5Dataset, X::AbstractArray, indices::RangeIndex...)
16051605
setindex!(dset, Y, indices...)
16061606
end
16071607

1608-
function setindex!(dset::HDF5Dataset, x::Number, indices::RangeIndex...)
1608+
function setindex!(dset::HDF5Dataset, x::Number, indices::Union(Range{Int},Int)...)
16091609
T = hdf5_to_julia(dset)
16101610
if !(T<:Array)
16111611
error("Hyperslab interface is available only for arrays")
@@ -1614,10 +1614,10 @@ function setindex!(dset::HDF5Dataset, x::Number, indices::RangeIndex...)
16141614
setindex!(dset, X, indices...)
16151615
end
16161616

1617-
getindex(dset::HDF5Dataset, I::Union(RangeIndex, Colon)...) = getindex(dset, ntuple(length(I), i-> isa(I[i], Colon) ? (1:size(dset,i)) : I[i])...)
1618-
setindex!(dset::HDF5Dataset, x, I::Union(RangeIndex, Colon)...) = setindex!(dset, x, ntuple(length(I), i-> isa(I[i], Colon) ? (1:size(dset,i)) : I[i])...)
1617+
getindex(dset::HDF5Dataset, I::Union(Range{Int},Int,Colon)...) = getindex(dset, ntuple(length(I), i-> isa(I[i], Colon) ? (1:size(dset,i)) : I[i])...)
1618+
setindex!(dset::HDF5Dataset, x, I::Union(Range{Int},Int,Colon)...) = setindex!(dset, x, ntuple(length(I), i-> isa(I[i], Colon) ? (1:size(dset,i)) : I[i])...)
16191619

1620-
function hyperslab(dset::HDF5Dataset, indices::RangeIndex...)
1620+
function hyperslab(dset::HDF5Dataset, indices::Union(Range{Int},Int)...)
16211621
local dsel_id
16221622
dspace = dataspace(dset)
16231623
try

0 commit comments

Comments
 (0)