Skip to content

Commit

Permalink
fix deprecations (#44)
Browse files Browse the repository at this point in the history
  • Loading branch information
bicycle1885 committed Mar 23, 2018
1 parent 2f45e5e commit af3fb0f
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion REQUIRE
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
julia 0.6.0
Compat 0.55
Compat 0.62
2 changes: 1 addition & 1 deletion src/buffer.jl
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ mutable struct Buffer
total::Int64

function Buffer(size::Integer)
return new(Vector{UInt8}(uninitialized, size), 0, 1, 1, 0)
return new(Vector{UInt8}(undef, size), 0, 1, 1, 0)
end

function Buffer(data::Vector{UInt8})
Expand Down
4 changes: 2 additions & 2 deletions src/stream.jl
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ end
function Base.readuntil(stream::TranscodingStream, delim::UInt8)
ready_to_read!(stream)
buffer1 = stream.state.buffer1
ret = Vector{UInt8}(uninitialized, 0)
ret = Vector{UInt8}(undef, 0)
filled = 0
while !eof(stream)
p = findbyte(buffer1, delim)
Expand Down Expand Up @@ -347,7 +347,7 @@ end

function Base.readavailable(stream::TranscodingStream)
n = bytesavailable(stream)
data = Vector{UInt8}(uninitialized, n)
data = Vector{UInt8}(undef, n)
unsafe_read(stream, pointer(data), n)
return data
end
Expand Down
8 changes: 4 additions & 4 deletions test/codecnoop.jl
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
@test eof(stream)
@inferred eof(stream)
@test read(stream) == UInt8[]
@test contains(repr(stream), "mode=read")
@test occursin("mode=read", repr(stream))

source = IOBuffer("foo")
stream = TranscodingStream(Noop(), source)
Expand All @@ -21,20 +21,20 @@

stream = TranscodingStream(Noop(), IOBuffer())
@test_throws EOFError read(stream, UInt8)
@test_throws EOFError unsafe_read(stream, pointer(Vector{UInt8}(uninitialized, 3)), 3)
@test_throws EOFError unsafe_read(stream, pointer(Vector{UInt8}(undef, 3)), 3)
close(stream)

stream = TranscodingStream(Noop(), IOBuffer("foobar"), bufsize=1)
@test read(stream, UInt8) === UInt8('f')
data = Vector{UInt8}(uninitialized, 5)
data = Vector{UInt8}(undef, 5)
unsafe_read(stream, pointer(data), 5) === nothing
@test data == b"oobar"
close(stream)

sink = IOBuffer()
stream = TranscodingStream(Noop(), sink)
@test write(stream, "foo") === 3
@test contains(repr(stream), "mode=write")
@test occursin("mode=write", repr(stream))
flush(stream)
@test take!(sink) == b"foo"
close(stream)
Expand Down
2 changes: 1 addition & 1 deletion test/codecquadruple.jl
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,6 @@ end
close(stream2)

stream = TranscodingStream(QuadrupleCodec(), IOBuffer("foo"))
@test_throws EOFError unsafe_read(stream, pointer(Vector{UInt8}(uninitialized, 13)), 13)
@test_throws EOFError unsafe_read(stream, pointer(Vector{UInt8}(undef, 13)), 13)
close(stream)
end

0 comments on commit af3fb0f

Please sign in to comment.