-
Notifications
You must be signed in to change notification settings - Fork 28
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow unread
of AbstractVector{UInt8}
#212
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We may need to preserve the public API or deprecate that particular method.
You could also consider Base.require_one_based_indexing
if there is any question about the applicability to AbstractVector
.
@@ -213,7 +215,9 @@ function insertdata!(buf::Buffer, data::Ptr{UInt8}, nbytes::Integer) | |||
end | |||
datasize = buf.marginpos - datapos | |||
copyto!(buf.data, datapos + nbytes, buf.data, datapos, datasize) | |||
GC.@preserve buf unsafe_copyto!(bufferptr(buf), data, nbytes) | |||
for i in 0:nbytes-1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you use copyto!
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
copyto!
isn't defined for TranscodingStreams.Memory
, but it does have getindex
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also copyto!
seems like it has special cases for handling aliasing. JuliaLang/julia#50900
This isn't needed here.
Fixes #210