Skip to content

Commit

Permalink
silence 0.7 deprecations (#179)
Browse files Browse the repository at this point in the history
* silence 0.7 deprecations

* bump compat to 0.68 to fix cfunction problem
  • Loading branch information
stevengj authored Jun 7, 2018
1 parent 03a8323 commit aea1cde
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 7 deletions.
2 changes: 1 addition & 1 deletion REQUIRE
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
julia 0.6
Compat 0.41.0
Compat 0.68.0
BinaryProvider 0.3.0
14 changes: 9 additions & 5 deletions src/ZMQ.jl
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,20 @@ include(depsjl_path)
import Base:
convert, get,
length, size, stride, similar, getindex, setindex!,
fd, wait, notify, close, connect,
bind, send, recv
fd, wait, notify, close

import Compat.Sockets: connect, bind, send, recv

export
#Types
StateError,Context,Socket,Message,
#functions
set, subscribe, unsubscribe,
#Constants
IO_THREADS,MAX_SOCKETS,PAIR,PUB,SUB,REQ,REP,ROUTER,DEALER,PULL,PUSH,XPUB,XSUB,XREQ,XREP,UPSTREAM,DOWNSTREAM,MORE,POLLIN,POLLOUT,POLLERR,STREAMER,FORWARDER,QUEUE,SNDMORE
IO_THREADS,MAX_SOCKETS,PAIR,PUB,SUB,REQ,REP,ROUTER,DEALER,PULL,PUSH,XPUB,XSUB,XREQ,XREP,UPSTREAM,DOWNSTREAM,MORE,POLLIN,POLLOUT,POLLERR,STREAMER,FORWARDER,QUEUE,SNDMORE,
#Sockets
connect, bind, send, recv

const SNDMORE = true

# A server will report most errors to the client over a Socket, but
Expand Down Expand Up @@ -385,7 +389,7 @@ end
isfreed(m::Message) = haskey(gc_protect, m.handle)

# AbstractArray behaviors:
similar(a::Message, ::Type{T}, dims::Dims) where {T} = Array{T}(dims) # ?
similar(a::Message, ::Type{T}, dims::Dims) where {T} = Array{T}(undef, dims) # ?
# TODO: change `Any` to `Ref{Message}` when 0.6 support is dropped.
length(zmsg::Message) = Int(ccall((:zmq_msg_size, libzmq), Csize_t, (Any,), zmsg))
size(zmsg::Message) = (length(zmsg),)
Expand Down Expand Up @@ -557,7 +561,7 @@ function __init__()
if version < v"3"
error("ZMQ version $version < 3 is not supported")
end
gc_free_fn_c[] = cfunction(gc_free_fn, Cint, Tuple{Ptr{Cvoid}, Ptr{Cvoid}})
gc_free_fn_c[] = @cfunction(gc_free_fn, Cint, (Ptr{Cvoid}, Ptr{Cvoid}))
end

end
2 changes: 1 addition & 1 deletion test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ Compat.@info("Testing with ZMQ version $(ZMQ.version)")
# Note that we have to send this message to work around
# https://github.com/JuliaInterop/ZMQ.jl/issues/166
@test similar(msg, UInt8, 12) isa Vector{UInt8}
@test copy(msg) == Vector{UInt8}("test request")
@test copy(msg) == codeunits("test request")
ZMQ.send(s2, msg)
@test unsafe_string(ZMQ.recv(s1)) == "test request"
ZMQ.send(s1, Message("test response"))
Expand Down

0 comments on commit aea1cde

Please sign in to comment.