Skip to content

Commit

Permalink
replace write_sub with unsafe_write for julia > 1.6
Browse files Browse the repository at this point in the history
  • Loading branch information
schlurp committed Nov 9, 2022
1 parent f906ac5 commit 11cb605
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/rpc.jl
Original file line number Diff line number Diff line change
Expand Up @@ -858,7 +858,12 @@ end

function write(writer::HDFSBlockWriter, buff::Vector{UInt8})
nbytes = _can_write(writer, length(buff))
(nbytes > 0) && Base.write_sub(writer.buffer, buff, 1, nbytes)
if (nbytes > 0)
if nbytes > length(buff)
throw(BoundsError())
end
GC.@preserve buff Base.unsafe_write(writer.buffer, pointer(buff, 1), UInt(nbytes))
end
check_write_buffer(writer)
nbytes
end
Expand Down

0 comments on commit 11cb605

Please sign in to comment.