From 90a7e2235485c926467172e2083dc604640acb25 Mon Sep 17 00:00:00 2001 From: Yichao Yu Date: Sun, 17 Sep 2017 23:20:31 -0400 Subject: [PATCH] Fix depwarns on 0.7 --- REQUIRE | 2 +- deps/build.jl | 22 ++++++++++++---------- src/ctr_drbg.jl | 2 +- src/entropy.jl | 2 +- src/rsa.jl | 5 +++-- src/ssl.jl | 7 +++---- 6 files changed, 21 insertions(+), 19 deletions(-) diff --git a/REQUIRE b/REQUIRE index c692a21..2488c3d 100644 --- a/REQUIRE +++ b/REQUIRE @@ -1,4 +1,4 @@ julia 0.6 BinDeps @osx Homebrew -Compat 0.9.5 +Compat 0.27.0 diff --git a/deps/build.jl b/deps/build.jl index 079519f..2659210 100644 --- a/deps/build.jl +++ b/deps/build.jl @@ -1,3 +1,5 @@ +using Compat + need_to_build_manually = true function validate_mbed(name, handle) @@ -29,7 +31,7 @@ if Libdl.dlopen_e("libmbedtls") != C_NULL && validate_mbed("", Libdl.dlopen_e("libmbedcrypto")) && get(ENV, "FORCE_BUILD", "") != "true" println("Using system libraries...") - if !isfile("deps.jl") || readstring("deps.jl") != systemlibs + if !isfile("deps.jl") || read("deps.jl", String) != systemlibs open("deps.jl", "w") do f write(f, systemlibs) end @@ -44,7 +46,7 @@ if need_to_build_manually println("Manual build...") # If we somehow already have a deps from system-libraries, but are now manually building # make sure we delete the old deps.jl - isfile("deps.jl") && readstring("deps.jl") == systemlibs && rm("deps.jl") + isfile("deps.jl") && read("deps.jl", String) == systemlibs && rm("deps.jl") mbed = library_dependency("libmbedtls", aliases=["libmbedtls", "libmbedtls.2.1.1"]) mbed_crypto = library_dependency("libmbedcrypto", aliases=["libmbedcrypto", "libmbedcrypto.2.1.1"], validate=validate_mbed) @@ -65,7 +67,7 @@ if need_to_build_manually mbed_all, unpacked_dir="mbedtls-2.1.1", SHA = srcsha) - if is_unix() + if Compat.Sys.isunix() mbed_dir = joinpath(BinDeps.depsdir(mbed), "src", "mbedtls-2.1.1") provides(BuildProcess, (@build_steps begin @@ -81,15 +83,15 @@ if need_to_build_manually end), mbed_all, installed_libpath=joinpath(mbed_dir, "library")) end - if is_apple() + if Compat.Sys.isapple() if Pkg.installed("Homebrew") === nothing - error("Homebrew package not installed, please run Pkg.add(\"Homebrew\")") - end - using Homebrew - provides(Homebrew.HB, "mbedtls", mbed_all) + error("Homebrew package not installed, please run Pkg.add(\"Homebrew\")") + end + using Homebrew + provides(Homebrew.HB, "mbedtls", mbed_all) end - if is_windows() + if Compat.Sys.iswindows() unpacked_dir = Int==Int32 ? "usr/bin32" : "usr/bin64" provides( Binaries, @@ -103,4 +105,4 @@ if need_to_build_manually @BinDeps.install Dict("libmbedtls"=>"MBED_TLS", "libmbedcrypto"=>"MBED_CRYPTO", "libmbedx509"=>"MBED_X509") -end \ No newline at end of file +end diff --git a/src/ctr_drbg.jl b/src/ctr_drbg.jl index c58062f..d2b90a7 100644 --- a/src/ctr_drbg.jl +++ b/src/ctr_drbg.jl @@ -50,5 +50,5 @@ end const c_rng = Ref{Ptr{Void}}(C_NULL) function __ctr_drbg__init__() - c_rng[] = cfunction(f_rng, Cint, (Ptr{Void}, Ptr{UInt8}, Csize_t)) + c_rng[] = cfunction(f_rng, Cint, Tuple{Ptr{Void}, Ptr{UInt8}, Csize_t}) end diff --git a/src/entropy.jl b/src/entropy.jl index add79b9..e1d7b9a 100644 --- a/src/entropy.jl +++ b/src/entropy.jl @@ -38,7 +38,7 @@ end const c_entropy = Ref{Ptr{Void}}(C_NULL) function __entropyinit__() - c_entropy[] = cfunction(jl_entropy, Cint, (Ptr{Void}, Ptr{Void}, Csize_t, Ptr{Void})) + c_entropy[] = cfunction(jl_entropy, Cint, Tuple{Ptr{Void}, Ptr{Void}, Csize_t, Ptr{Void}}) end function gather(ctx::Entropy) diff --git a/src/rsa.jl b/src/rsa.jl index 26acb22..55d0b10 100644 --- a/src/rsa.jl +++ b/src/rsa.jl @@ -39,9 +39,10 @@ function mpi_import!(mpi::Ptr{mbedtls_mpi}, b::BigInt) nbytes = div(size+8-1,8) data = Vector{UInt8}(nbytes) count = Ref{Csize_t}(0) + # TODO Replace `Any` with `Ref{BigInt}` when 0.6 support is dropped. ccall((:__gmpz_export,:libgmp), Ptr{Void}, - (Ptr{Void}, Ptr{Csize_t}, Cint, Csize_t, Cint, Csize_t, Ptr{BigInt}), - data, count, 1, 1, 1, 0, &b) + (Ptr{Void}, Ptr{Csize_t}, Cint, Csize_t, Cint, Csize_t, Any), + data, count, 1, 1, 1, 0, b) @assert count[] == nbytes # Import into mbedtls @err_check ccall((:mbedtls_mpi_read_binary, MBED_CRYPTO), Cint, diff --git a/src/ssl.jl b/src/ssl.jl index 302cffa..7361d95 100644 --- a/src/ssl.jl +++ b/src/ssl.jl @@ -274,8 +274,7 @@ const c_send = Ref{Ptr{Void}}(C_NULL) const c_recv = Ref{Ptr{Void}}(C_NULL) const c_dbg = Ref{Ptr{Void}}(C_NULL) function __sslinit__() - c_send[] = cfunction(f_send, Cint, (Ptr{Void}, Ptr{UInt8}, Csize_t)) - c_recv[] = cfunction(f_recv, Cint, (Ptr{Void}, Ptr{UInt8}, Csize_t)) - c_dbg[] = cfunction(f_dbg, Void, - (Ptr{Void}, Cint, Ptr{UInt8}, Cint, Ptr{UInt8})) + c_send[] = cfunction(f_send, Cint, Tuple{Ptr{Void}, Ptr{UInt8}, Csize_t}) + c_recv[] = cfunction(f_recv, Cint, Tuple{Ptr{Void}, Ptr{UInt8}, Csize_t}) + c_dbg[] = cfunction(f_dbg, Void, Tuple{Ptr{Void}, Cint, Ptr{UInt8}, Cint, Ptr{UInt8}}) end