Skip to content

Commit

Permalink
clear out deprecation warnings triggered by running the tests
Browse files Browse the repository at this point in the history
We still get one deprecation warning for `Base.Libdl`, but these come from `BinaryProvider`.
  • Loading branch information
mweastwood committed Jul 5, 2018
1 parent 00fb5b0 commit fae7edb
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 14 deletions.
6 changes: 3 additions & 3 deletions src/header.jl
Expand Up @@ -258,9 +258,9 @@ function read_header(hdu::HDU)
nkeys, morekeys = fits_get_hdrspace(hdu.fitsfile)

# Initialize output arrays
keys = Vector{String}(nkeys)
values = Vector{Any}(nkeys)
comments = Vector{String}(nkeys)
keys = Vector{String}(undef, nkeys)
values = Vector{Any}(undef, nkeys)
comments = Vector{String}(undef, nkeys)
for i=1:nkeys
ccall((:ffgkyn,libcfitsio), Cint,
(Ptr{Cvoid},Cint,Ptr{UInt8},Ptr{UInt8},Ptr{UInt8},Ptr{Cint}),
Expand Down
4 changes: 2 additions & 2 deletions src/libcfitsio.jl
Expand Up @@ -410,7 +410,7 @@ end

function fits_read_keys_lng(f::FITSFile, keyname::String,
nstart::Integer, nmax::Integer)
value = Vector{Clong}(nmax - nstart + 1)
value = Vector{Clong}(undef, nmax - nstart + 1)
nfound = Ref{Cint}(0)
status = Ref{Cint}(0)
ccall((:ffgknj, libcfitsio), Cint,
Expand Down Expand Up @@ -1097,7 +1097,7 @@ function fits_read_col(f::FITSFile,
abs(typecode) == 16 || error("not a string column")

# create an array of character buffers of the correct width
buffers = [Vector{UInt8}(width) for i in 1:length(data)]
buffers = [Vector{UInt8}(undef, width) for i in 1:length(data)]

# Call the CFITSIO function
anynull = Ref{Cint}(0)
Expand Down
16 changes: 8 additions & 8 deletions src/table.jl
Expand Up @@ -96,7 +96,7 @@ end
fits_tdim(A::Array) = (ndims(A) == 1) ? [1] : [size(A, i) for i=1:ndims(A)-1]
function fits_tdim(A::Array{String})
n = ndims(A)
tdim = Vector{Int}(n)
tdim = Vector{Int}(undef, n)
tdim[1] = maximum(length, A)
for i=2:n
tdim[n] = size(A, n-1)
Expand Down Expand Up @@ -188,8 +188,8 @@ colnames(hdu::Union{ASCIITableHDU,TableHDU}) = columns_names_tforms(hdu)[1]
function show(io::IO, hdu::TableHDU)
colnames, coltforms, ncols, nrows = columns_names_tforms(hdu)
# get some more information for all the columns
coltypes = Vector{String}(ncols)
colrowsizes = Vector{String}(ncols)
coltypes = Vector{String}(undef, ncols)
colrowsizes = Vector{String}(undef, ncols)
showlegend = false
for i in 1:ncols
T, rowsize, isvariable = fits_get_col_info(hdu.fitsfile, i)
Expand Down Expand Up @@ -219,7 +219,7 @@ end
function show(io::IO, hdu::ASCIITableHDU)
colnames, coltforms, ncols, nrows = columns_names_tforms(hdu)
# Get additional info
coltypes = Vector{String}(ncols)
coltypes = Vector{String}(undef, ncols)
for i in 1:ncols
eqtypecode, repeat, width = fits_get_eqcoltype(hdu.fitsfile, i)
T = CFITSIO_COLTYPE[eqtypecode]
Expand Down Expand Up @@ -418,7 +418,7 @@ function fits_read_var_col(f::FITSFile, colnum::Integer,
nrows = length(data)
for i=1:nrows
repeat, offset = fits_read_descript(f, colnum, i)
data[i] = Vector{T}(repeat)
data[i] = Vector{T}(undef, repeat)
fits_read_col(f, colnum, i, 1, data[i])
end
end
Expand All @@ -440,7 +440,7 @@ function fits_read_var_col(f::FITSFile, colnum::Integer, data::Vector{String})
fits_assert_ok(status[])

# Create string out of the buffer, terminating at null characters
zeropos = search(buffer, 0x00)
zeropos = something(findfirst(isequal(0x00), buffer), 0)
data[i] = (zeropos >= 1) ? String(buffer[1:(zeropos-1)]) :
String(buffer)
end
Expand All @@ -457,7 +457,7 @@ function read(hdu::ASCIITableHDU, colname::String; case_sensitive::Bool=true)
typecode, repcnt, width = fits_get_eqcoltype(hdu.fitsfile, colnum)
T = CFITSIO_COLTYPE[typecode]

result = Vector{T}(nrows)
result = Vector{T}(undef, nrows)
fits_read_col(hdu.fitsfile, colnum, 1, 1, result)

return result
Expand Down Expand Up @@ -487,7 +487,7 @@ function read(hdu::TableHDU, colname::String; case_sensitive::Bool=true)

T, rowsize, isvariable = fits_get_col_info(hdu.fitsfile, colnum)

result = Array{T}(rowsize..., nrows)
result = Array{T}(undef, rowsize..., nrows)

if isvariable
fits_read_var_col(hdu.fitsfile, colnum, result)
Expand Down
2 changes: 1 addition & 1 deletion test/runtests.jl
Expand Up @@ -77,7 +77,7 @@ end
## Binary table
indata = Dict{String, Array}()
for (i, T) in enumerate([UInt8, Int8, UInt16, Int16, UInt32, Int32, Int64,
Float32, Float64, Complex64, Complex128])
Float32, Float64, ComplexF32, ComplexF64])
indata["col$i"] = T[1:20;]
end
i = length(indata) + 1
Expand Down

0 comments on commit fae7edb

Please sign in to comment.