From 2a7af65f86bef368efcf9723200c124629463e0a Mon Sep 17 00:00:00 2001 From: Nathan Zimmerberg <39104088+nhz2@users.noreply.github.com> Date: Sun, 23 Jun 2024 21:55:33 -0400 Subject: [PATCH] Allow non 1-based arrays in `readbytes!` (#200) --- src/stream.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/stream.jl b/src/stream.jl index 92486a8..d057cf3 100644 --- a/src/stream.jl +++ b/src/stream.jl @@ -431,7 +431,7 @@ function Base.readbytes!(stream::TranscodingStream, b::DenseArray{UInt8}, nb=len resize!(b, min(max(length(b) * 2, 8), nb)) resized = true end - filled += GC.@preserve b unsafe_read(stream, pointer(b, filled+1), min(length(b), nb)-filled) + filled += GC.@preserve b unsafe_read(stream, pointer(b, filled+firstindex(b)), min(length(b), nb)-filled) end if resized resize!(b, filled)