Skip to content

Commit

Permalink
Fix a segfault in d
Browse files Browse the repository at this point in the history
  • Loading branch information
helgee committed Mar 30, 2019
1 parent 7cd7126 commit 76fd622
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 14 deletions.
14 changes: 6 additions & 8 deletions src/d.jl
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ export
dafgda,
dafgh,
dafgn,
dafgs!,
dafgs,
dafgsr,
dafopr,
Expand Down Expand Up @@ -348,13 +347,13 @@ function dafgn(lenout=128)
end

"""
dafgs!(sum)
dafgs(lenout=125)
Return (get) the summary for the current array in the current DAF and write it to `sum`.
Return (get) the summary for the current array in the current DAF.
### Arguments ###
- `sum`: An empty `Vector{Float64}` with the expected length
- `lenout`: The maximum length of the summary array
### Output ###
Expand All @@ -364,14 +363,13 @@ Returns the summary for the current array.
- [NAIF Documentation](https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/dafgs_c.html)
"""
function dafgs!(array)
function dafgs(lenout=125)
array = zeros(125)
ccall((:dafgs_c, libcspice), Cvoid, (Ref{SpiceDouble},), array)
handleerror()
array
array[1:lenout]
end

@deprecate dafgs dafgs!

"""
Read a portion of the contents of a summary record in a DAF file.
Expand Down
9 changes: 3 additions & 6 deletions test/d.jl
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,7 @@
dafbfs(handle)
found = daffna()
@test found
out = zeros(2)
dafgs!(out)
out = dafgs(2)
@test out [-9.46511378160646408796e+07, 3.15662463183953464031e+08]
outname = dafgn(100)
@test outname == "DE-405"
Expand Down Expand Up @@ -139,8 +138,7 @@
dafbfs(handle)
found = daffna()
@test found
out = zeros(124)
dafgs!(out)
out = dafgs(124)
dc, ic = dafus(out, 2, 6)
ic[1] = -1999
ic[2] = -2999
Expand All @@ -153,8 +151,7 @@
dafbfs(handle)
found = daffna()
@test found
out = zeros(124)
dafgs!(out)
out = dafgs(124)
dc, ic = dafus(out, 2, 6)
@test ic[1] == -1999
@test ic[2] == -2999
Expand Down

0 comments on commit 76fd622

Please sign in to comment.