From 0e13c103bb2afea624e5943c9cd672773a21d4ed Mon Sep 17 00:00:00 2001 From: nhz2 Date: Sat, 5 Oct 2024 20:39:34 -0400 Subject: [PATCH] remove dead code --- src/compression.jl | 9 ++------- src/libzstd.jl | 6 +++++- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/src/compression.jl b/src/compression.jl index 6a2b7b8..8ce79dd 100644 --- a/src/compression.jl +++ b/src/compression.jl @@ -101,13 +101,8 @@ function TranscodingStreams.startproc(codec::ZstdCompressor, mode::Symbol, error return :error end end - code = reset!(codec.cstream) - if iserror(code) - error[] = ErrorException("zstd error resetting compression context") - :error - else - :ok - end + reset!(codec.cstream) + return :ok end if isdefined(TranscodingStreams, :pledgeinsize) diff --git a/src/libzstd.jl b/src/libzstd.jl index c17f69d..dbbbb4b 100644 --- a/src/libzstd.jl +++ b/src/libzstd.jl @@ -60,7 +60,11 @@ function reset!(cstream::CStream) res = LibZstd.ZSTD_CCtx_reset(cstream, LibZstd.ZSTD_reset_session_only) reset!(cstream.ibuffer) reset!(cstream.obuffer) - return res + if iserror(res) + # According to zstd.h "Resetting session never fails" so this branch should be unreachable. + error("unreachable") + end + return end """