From ba9ef0e557590e98d3bf76fd158ea526b96488cd Mon Sep 17 00:00:00 2001 From: Jerry Ling Date: Thu, 10 Oct 2024 08:25:54 -0400 Subject: [PATCH] remove unsafe call (#110) --- src/all_implementations.jl | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/all_implementations.jl b/src/all_implementations.jl index 8b3f09e..6c159e1 100644 --- a/src/all_implementations.jl +++ b/src/all_implementations.jl @@ -5483,7 +5483,7 @@ function from_buffers( end form_mask = form["mask"] - excess_length = Int64(ceil(length / 8.0)) + excess_length = div(length, 8, RoundUp) mask_buffer = _get_buffer(form_key, "mask", buffer_key, containers) raw_mask = _get_index(form_mask, excess_length, mask_buffer) @@ -5511,11 +5511,8 @@ function from_buffers( end mask = falses(length) - unsafe_copyto!( - reinterpret(Ptr{UInt8}, pointer(mask.chunks)), - pointer(raw_mask), - excess_length, - ) + mask_chunks_bytes = reinterpret(UInt8, mask.chunks) + copyto!(mask_chunks_bytes, firstindex(mask_chunks_bytes), raw_mask, firstindex(raw_mask), excess_length) if !lsb_order mask.len = excess_length * 8