Skip to content

Commit

Permalink
make __wrap compatible with 1.11 RC
Browse files Browse the repository at this point in the history
  • Loading branch information
longemen3000 authored Apr 9, 2024
1 parent 963974c commit eafb38b
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/utils.jl
Original file line number Diff line number Diff line change
Expand Up @@ -246,8 +246,13 @@ end
consumeBOM(buf, pos) = (length(buf) >= 3 && buf[pos] == 0xef && buf[pos + 1] == 0xbb && buf[pos + 2] == 0xbf) ? pos + 3 : pos

if isdefined(Base, :Memory)
__wrap(x) = view(x,Base.OneTo(length(x)))
__wrap(x::Array) = x
if isdefined(Base,:wrap)
__wrap(x) = Base.wrap(Array,x,length(x))
__wrap(x::Array) = x

Check warning on line 251 in src/utils.jl

View check run for this annotation

Codecov / codecov/patch

src/utils.jl#L250-L251

Added lines #L250 - L251 were not covered by tests
else
__wrap(x) = view(x,Base.OneTo(length(x)))
__wrap(x::Array) = x

Check warning on line 254 in src/utils.jl

View check run for this annotation

Codecov / codecov/patch

src/utils.jl#L254

Added line #L254 was not covered by tests
end
else
__wrap(x) = x

Check warning on line 257 in src/utils.jl

View check run for this annotation

Codecov / codecov/patch

src/utils.jl#L257

Added line #L257 was not covered by tests
end
Expand All @@ -268,7 +273,7 @@ end
x = x.data
return parent(x), first(x.indices), last(x.indices), tfile
else #support from IOBuffer containing Memory
y = __wrap(x.data) #generates a Vector{UInt8} from Memory{UInt8}
y = __wrap(x.data) #generates a Vector{UInt8} from Memory{UInt8}, if available.
return y, x.ptr, x.size, tfile
end
elseif x isa Cmd || x isa IO
Expand Down

0 comments on commit eafb38b

Please sign in to comment.