Skip to content

Commit

Permalink
BREAKING: remove generic seekend method (#229)
Browse files Browse the repository at this point in the history
  • Loading branch information
nhz2 authored Jul 1, 2024
1 parent 670ebca commit 1dbf35c
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 23 deletions.
7 changes: 0 additions & 7 deletions src/buffer.jl
Original file line number Diff line number Diff line change
Expand Up @@ -118,13 +118,6 @@ function initbuffer!(buf::Buffer)
return buf
end

# Remove all buffered data.
function emptybuffer!(buf::Buffer)
buf.markpos = 0
buf.bufferpos = buf.marginpos = 1
return buf
end

# Make margin with ≥`minsize` and return the size of it.
# If eager is true, it tries to move data even when the buffer has enough margin.
function makemargin!(buf::Buffer, minsize::Int; eager::Bool = false)
Expand Down
14 changes: 0 additions & 14 deletions src/stream.jl
Original file line number Diff line number Diff line change
Expand Up @@ -289,20 +289,6 @@ function Base.seekstart(stream::TranscodingStream)
return stream
end

function Base.seekend(stream::TranscodingStream)
mode = stream.state.mode
if mode == :read
callstartproc(stream, mode)
emptybuffer!(stream.buffer1)
emptybuffer!(stream.buffer2)
elseif mode === :idle
else
throw_invalid_mode(mode)
end
seekend(stream.stream)
return stream
end


# Read Functions
# --------------
Expand Down
4 changes: 2 additions & 2 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ using TranscodingStreams:
marginptr, marginsize, marginmem,
readbyte!, writebyte!,
#=ismarked,=# mark!, unmark!, reset!,
makemargin!, emptybuffer!
makemargin!, initbuffer!

@testset "Buffer" begin
buf = Buffer(1024)
Expand Down Expand Up @@ -68,7 +68,7 @@ using TranscodingStreams:
writebyte!(buf, 0x99)
margin_size = makemargin!(buf, 20)
@test margin_size >= 20
emptybuffer!(buf)
initbuffer!(buf)
@test makemargin!(buf, 0) === margin_size + 2
end

Expand Down

0 comments on commit 1dbf35c

Please sign in to comment.