MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / Init

Method Init

tensorflow/core/lib/io/zlib_outputbuffer.cc:44–69  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

42}
43
44Status ZlibOutputBuffer::Init() {
45 // Output buffer size should be greater than 1 because deflation needs atleast
46 // one byte for book keeping etc.
47 if (output_buffer_capacity_ <= 1) {
48 return errors::InvalidArgument(
49 "output_buffer_bytes should be greater than "
50 "1");
51 }
52 memset(z_stream_.get(), 0, sizeof(z_stream));
53 z_stream_->zalloc = Z_NULL;
54 z_stream_->zfree = Z_NULL;
55 z_stream_->opaque = Z_NULL;
56 int status =
57 deflateInit2(z_stream_.get(), zlib_options_.compression_level,
58 zlib_options_.compression_method, zlib_options_.window_bits,
59 zlib_options_.mem_level, zlib_options_.compression_strategy);
60 if (status != Z_OK) {
61 z_stream_.reset(nullptr);
62 return errors::InvalidArgument("deflateInit failed with status", status);
63 }
64 z_stream_->next_in = z_stream_input_.get();
65 z_stream_->next_out = z_stream_output_.get();
66 z_stream_->avail_in = 0;
67 z_stream_->avail_out = output_buffer_capacity_;
68 return Status::OK();
69}
70
71int32 ZlibOutputBuffer::AvailableInputSpace() const {
72 return input_buffer_capacity_ - z_stream_->avail_in;

Callers 5

TestAllCombinationsFunction · 0.45
TestMultipleWritesFunction · 0.45
TESTFunction · 0.45
WriteCompressedFileFunction · 0.45
RecordWriterMethod · 0.45

Calls 3

InvalidArgumentFunction · 0.85
getMethod · 0.45
resetMethod · 0.45

Tested by 4

TestAllCombinationsFunction · 0.36
TestMultipleWritesFunction · 0.36
TESTFunction · 0.36
WriteCompressedFileFunction · 0.36