Skip to content

Commit

Permalink
Fix strings on aarch64
Browse files Browse the repository at this point in the history
  • Loading branch information
barche committed Nov 11, 2024
1 parent 6606c74 commit c9e113c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/CxxWrap.jl
Original file line number Diff line number Diff line change
Expand Up @@ -615,8 +615,8 @@ Base.unsafe_convert(to_type::Type{<:CxxBaseRef{T}}, v::CxxBaseRef) where {T} = t
Base.unsafe_convert(to_type::Type{<:CxxBaseRef}, v::Base.RefValue) = to_type(pointer_from_objref(v))

Base.cconvert(::Type{CxxPtr{CxxPtr{CxxChar}}}, v::Vector{String}) = Base.cconvert(Ptr{Ptr{Cchar}}, v)
Base.unsafe_convert(to_type::Type{CxxPtr{CxxPtr{CxxChar}}}, a::Base.RefArray{Ptr{Int8}, Vector{Ptr{Int8}}, Any}) = to_type(Base.unsafe_convert(Ptr{Ptr{Cchar}}, a))
Base.unsafe_convert(to_type::Type{CxxPtr{CxxPtr{CxxChar}}}, a::Base.RefArray{Ptr{Int8}, Vector{Ptr{Int8}}, Vector{Any}}) = to_type(Base.unsafe_convert(Ptr{Ptr{Cchar}}, a))
Base.unsafe_convert(to_type::Type{CxxPtr{CxxPtr{CxxChar}}}, a::Base.RefArray{Ptr{Cchar}, Vector{Ptr{Cchar}}, Any}) = to_type(Base.unsafe_convert(Ptr{Ptr{Cchar}}, a))
Base.unsafe_convert(to_type::Type{CxxPtr{CxxPtr{CxxChar}}}, a::Base.RefArray{Ptr{Cchar}, Vector{Ptr{Cchar}}, Vector{Any}}) = to_type(Base.unsafe_convert(Ptr{Ptr{Cchar}}, a))

cxxconvert(to_type::Type{<:CxxBaseRef{T}}, x, ::Type{IsNormalType}) where {T} = Ref{T}(convert(T,x))
cxxconvert(to_type::Type{<:CxxBaseRef{T}}, x::Base.RefValue, ::Type{IsNormalType}) where {T} = x
Expand Down
8 changes: 5 additions & 3 deletions src/StdLib/StdString.jl
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,11 @@ julia> StdString(b"visible\\0hidden")
"""
StdString(::Union{Cstring,Base.CodeUnits,Vector{UInt8},Ref{Int8},Array{Int8}})

StdString(x::Cstring) = StdString(convert(Ptr{Int8}, x))
StdString(x::Base.CodeUnits) = StdString(collect(x))
StdString(x::Vector{UInt8}) = StdString(collect(reinterpret(Int8, x)))
StdString(x::Cstring) = StdString(convert(Ptr{Cchar}, x))
StdString(x::Base.CodeUnits) = StdString(collect(reinterpret(Cchar,x)))
@static if Cchar != UInt8
StdString(x::Vector{UInt8}) = StdString(collect(reinterpret(Cchar, x)))
end

"""
StdString(str, n::Integer)
Expand Down

0 comments on commit c9e113c

Please sign in to comment.