diff options
author | 2018-04-19 23:08:53 -0700 | |
---|---|---|
committer | 2018-04-19 23:11:36 -0700 | |
commit | f7e8fbb28a0fa4e979a94d7b458706abf48f7deb (patch) | |
tree | 67760aaace78304e440f3e21e77fda395a65ea9e /tensorflow/core/lib/io/zlib_inputstream.cc | |
parent | 70b8d21edcc84818835c9e2940a5df288c309d45 (diff) |
Automated g4 rollback of changelist 193602050
PiperOrigin-RevId: 193625346
Diffstat (limited to 'tensorflow/core/lib/io/zlib_inputstream.cc')
-rw-r--r-- | tensorflow/core/lib/io/zlib_inputstream.cc | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/tensorflow/core/lib/io/zlib_inputstream.cc b/tensorflow/core/lib/io/zlib_inputstream.cc index 984fbc2810..47de36bf6c 100644 --- a/tensorflow/core/lib/io/zlib_inputstream.cc +++ b/tensorflow/core/lib/io/zlib_inputstream.cc @@ -25,8 +25,9 @@ ZlibInputStream::ZlibInputStream( InputStreamInterface* input_stream, size_t input_buffer_bytes, // size of z_stream.next_in buffer size_t output_buffer_bytes, // size of z_stream.next_out buffer - const ZlibCompressionOptions& zlib_options) - : input_stream_(input_stream), + const ZlibCompressionOptions& zlib_options, bool owns_input_stream) + : owns_input_stream_(owns_input_stream), + input_stream_(input_stream), input_buffer_capacity_(input_buffer_bytes), output_buffer_capacity_(output_buffer_bytes), z_stream_input_(new Bytef[input_buffer_capacity_]), @@ -37,14 +38,25 @@ ZlibInputStream::ZlibInputStream( InitZlibBuffer(); } +ZlibInputStream::ZlibInputStream(InputStreamInterface* input_stream, + size_t input_buffer_bytes, + size_t output_buffer_bytes, + const ZlibCompressionOptions& zlib_options) + : ZlibInputStream(input_stream, input_buffer_bytes, output_buffer_bytes, + zlib_options, false) {} + ZlibInputStream::~ZlibInputStream() { if (z_stream_) { inflateEnd(z_stream_.get()); } + if (owns_input_stream_) { + delete input_stream_; + } } Status ZlibInputStream::Reset() { TF_RETURN_IF_ERROR(input_stream_->Reset()); + inflateEnd(z_stream_.get()); InitZlibBuffer(); bytes_read_ = 0; return Status::OK(); |