Permalink
Browse files

automatically convert strings to ByteString in ccall. fixes #5673, cl…

…oses #5677
  • Loading branch information...
1 parent c106c80 commit 4c72d0217fbcc281c82f825ead82fcebaeb131f8 @JeffBezanson JeffBezanson committed Feb 18, 2014
Showing with 3 additions and 3 deletions.
  1. +2 −2 base/base.jl
  2. +1 −1 test/strings.jl
View
@@ -18,8 +18,8 @@ ptr_arg_convert(::Type{Ptr{Void}}, x) = x
cconvert(T, x) = convert(T, x)
# use the code in ccall.cpp to safely allocate temporary pointer arrays
cconvert{T}(::Type{Ptr{Ptr{T}}}, a::Array) = a
-# TODO: for some reason this causes a strange type inference problem
-#cconvert(::Type{Ptr{Uint8}}, s::String) = bytestring(s)
+# convert strings to ByteString to pass as pointers
+cconvert{P<:Union(Int8,Uint8)}(::Type{Ptr{P}}, s::String) = bytestring(s)
abstract IO
View
@@ -857,7 +857,7 @@ bin_val = hex2bytes("07bf")
# issue #4586
@test rsplit(RevString("ailuj"),'l') == {"ju","ia"}
-@test_throws float64(RevString("64"))
+@test float64(RevString("64")) === 46.0
for T = (Uint8,Int8,Uint16,Int16,Uint32,Int32,Uint64,Int64,Uint128,Int128,BigInt),
b = 2:62, _ = 1:10

0 comments on commit 4c72d02

Please sign in to comment.