Skip to content

Commit

Permalink
reset position in seekstart
Browse files Browse the repository at this point in the history
  • Loading branch information
nhz2 committed Jun 23, 2024
1 parent 74ac5c8 commit 09bdebe
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/stream.jl
Original file line number Diff line number Diff line change
Expand Up @@ -286,8 +286,8 @@ function Base.seekstart(stream::TranscodingStream)
mode = stream.state.mode
if mode === :read
callstartproc(stream, mode)
emptybuffer!(stream.buffer1)
emptybuffer!(stream.buffer2)
initbuffer!(stream.buffer1)
initbuffer!(stream.buffer2)
elseif mode === :idle
else
throw_invalid_mode(mode)
Expand Down
4 changes: 2 additions & 2 deletions test/codecquadruple.jl
Original file line number Diff line number Diff line change
Expand Up @@ -162,9 +162,9 @@ end
@test read(stream, 5) == b"aaaab"
@test position(stream) == 5
@test seekstart(stream) == stream
@test_broken position(stream) == 0
@test position(stream) == 0
@test read(stream, 5) == b"aaaab"
@test_broken position(stream) == 5
@test position(stream) == 5
end

@testset "seekstart doesn't delete data" begin
Expand Down

0 comments on commit 09bdebe

Please sign in to comment.