MCPcopy Create free account
hub / github.com/apache/arrow / Decompress

Method Decompress

cpp/src/arrow/util/compression_bz2.cc:123–141  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

121 }
122
123 Result<DecompressResult> Decompress(int64_t input_len, const uint8_t* input,
124 int64_t output_len, uint8_t* output) override {
125 stream_.next_in = const_cast<char*>(reinterpret_cast<const char*>(input));
126 stream_.avail_in = static_cast<unsigned int>(std::min(input_len, kSizeLimit));
127 stream_.next_out = reinterpret_cast<char*>(output);
128 stream_.avail_out = static_cast<unsigned int>(std::min(output_len, kSizeLimit));
129 int ret;
130
131 ret = BZ2_bzDecompress(&stream_);
132 if (ret == BZ_OK || ret == BZ_STREAM_END) {
133 finished_ = (ret == BZ_STREAM_END);
134 int64_t bytes_read = input_len - stream_.avail_in;
135 int64_t bytes_written = output_len - stream_.avail_out;
136 return DecompressResult{bytes_read, bytes_written,
137 (!finished_ && bytes_read == 0 && bytes_written == 0)};
138 } else {
139 return BZ2Error("bz2 decompress failed: ", ret);
140 }
141 }
142
143 bool IsFinished() override { return finished_; }
144

Callers

nothing calls this directly

Calls 1

BZ2ErrorFunction · 0.85

Tested by

no test coverage detected