Skip to content

Commit

Permalink
fix v0.6 deprecation warnings
Browse files Browse the repository at this point in the history
	modified:   src/cdfs.jl
	modified:   src/readstring.jl
  • Loading branch information
jlapeyre committed May 22, 2017
1 parent 41d65f9 commit 12d0f4d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
10 changes: 6 additions & 4 deletions src/cdfs.jl
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
using Compat

"""
AbstractEmpiricalCDF
Concrete types are `EmpiricalCDF` and `EmpiricalCDFHi`.
"""
abstract AbstractEmpiricalCDF
@compat abstract type AbstractEmpiricalCDF end

immutable EmpiricalCDF{T <: Real} <: AbstractEmpiricalCDF
xdata::Array{T,1} # death times
Expand Down Expand Up @@ -32,7 +34,7 @@ Base.getindex(cdf::AbstractEmpiricalCDF, x::Real) = _val_at_index(cdf, getcdfind

# With several tests, this is about the same speed or faster than the routine borrowed from StatsBase
function Base.getindex{T <: Real}(cdf::AbstractEmpiricalCDF, v::AbstractArray{T})
r = Array(eltype(cdf.xdata), size(v)...)
r = Array{eltype(cdf.xdata)}(size(v)...)
for (i,x) in enumerate(v)
r[i] = cdf[x]
end
Expand Down Expand Up @@ -75,7 +77,7 @@ This can be useful when generating too many points to store.
`getinverse(cdf,x)`, `linprint(io,cdf,n=2000)`, `logprint(io,cdf,n=2000)`,
`getcdfindex(cdf,x)`
"""
EmpiricalCDF() = EmpiricalCDF(Array(Float64,0))
EmpiricalCDF() = EmpiricalCDF(Array{Float64}(0))

"""
EmpiricalCDFHi{T <: Real} <: AbstractEmpiricalCDF
Expand All @@ -89,7 +91,7 @@ immutable EmpiricalCDFHi{T <: Real} <: AbstractEmpiricalCDF
end

function EmpiricalCDFHi(lowreject::Real)
cdf = EmpiricalCDFHi(lowreject, Array(Int,1), Array(typeof(lowreject),0))
cdf = EmpiricalCDFHi(lowreject, Array{Int}(1), Array{typeof(lowreject)}(0))
cdf.rejectcounts[1] = 0
cdf
end
Expand Down
4 changes: 2 additions & 2 deletions src/readstring.jl
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ function readlengthandstring(io::IO)
end

function readstring(io::IO,stringlength::Int32)
buf = Array(UInt8,convert(Int64,stringlength))
buf = Array{UInt8}(convert(Int64,stringlength))
readbytes!(io,buf)
@compat unsafe_string(pointer(buf))
end
Expand All @@ -26,7 +26,7 @@ end
read `stringlength` bytes from `io` and return as a string.
"""
function readstring(io::IO,stringlength::Int64)
buf = Array(UInt8,stringlength)
buf = Array{UInt8}(stringlength)
readbytes!(io,buf)
@compat unsafe_string(pointer(buf))
end
Expand Down

0 comments on commit 12d0f4d

Please sign in to comment.