Skip to content

Commit

Permalink
revert adding :transcode mode for startproc
Browse files Browse the repository at this point in the history
  • Loading branch information
nhz2 committed May 16, 2024
1 parent c232c50 commit 04cd155
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
7 changes: 3 additions & 4 deletions src/codec.jl
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,9 @@ the stream will become the close mode for safety.
The `startproc(codec::C, mode::Symbol, error::Error)::Symbol` method takes
`codec`, `mode` and `error`, and returns a status code. This is called just
before the stream starts reading or writing data. `mode` is either `:read`,
`:write`, or `:transcode` and then the stream starts reading or
writing, or one of the `transcode` functions is used.
The return code must be `:ok` if `codec` is ready for data. Otherwise,
before the stream starts reading or writing data. `mode` is either `:read` or
`:write` and then the stream starts reading or writing, respectively. The
return code must be `:ok` if `codec` is ready to read or write data. Otherwise,
it must be `:error` and the `error` argument must be set to an exception object.
### `process`
Expand Down
5 changes: 2 additions & 3 deletions src/transcode.jl
Original file line number Diff line number Diff line change
Expand Up @@ -144,8 +144,7 @@ function unsafe_transcode!(
)
error = Error()
# Note: pledged_input_size is currently experimental
# :transcode mode enables some codecs to error if they are used in a TranscodingStream.
code = startproc2(codec, :transcode, error; pledged_input_size=buffersize(input))
code = startproc2(codec, :write, error; pledged_input_size=buffersize(input))
if code === :error
@goto error
end
Expand All @@ -168,7 +167,7 @@ function unsafe_transcode!(
@goto error
elseif code === :end
if buffersize(input) > 0
if startproc2(codec, :transcode, error) === :error
if startproc2(codec, :write, error) === :error
@goto error
end
n = minoutsize(codec, buffermem(input))
Expand Down

0 comments on commit 04cd155

Please sign in to comment.