Skip to content

Commit 651c4e5

Browse files
authored
Remove the restriction of nbytes in unsafe_read (#104)
* Remove the restriction of nbytes in unsafe_read The original restriction of `Int` will cause errors in some cases. Replaced with `Integer` instead. I think this also aligns with the signatures in Base. * Remove redundant return signature
1 parent 2f19cab commit 651c4e5

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/io.jl

+2-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@ This function is similar to `Base.unsafe_read` but is different in some points:
1111
- It returns the number of bytes written to `output`.
1212
- It does not block if there are buffered data in `input`.
1313
"""
14-
function unsafe_read(input::IO, output::Ptr{UInt8}, nbytes::Int)::Int
14+
function unsafe_read(input::IO, output::Ptr{UInt8}, nbytes::Integer)
15+
nbytes = convert(UInt, nbytes)
1516
p = output
1617
navail = bytesavailable(input)
1718
if navail == 0 && nbytes > 0 && !eof(input)

0 commit comments

Comments
 (0)