| 191 | } |
| 192 | |
| 193 | Result<FlushResult> Flush(int64_t output_len, uint8_t* output) override { |
| 194 | stream_.next_in = nullptr; |
| 195 | stream_.avail_in = 0; |
| 196 | stream_.next_out = reinterpret_cast<char*>(output); |
| 197 | stream_.avail_out = static_cast<unsigned int>(std::min(output_len, kSizeLimit)); |
| 198 | int ret; |
| 199 | |
| 200 | ret = BZ2_bzCompress(&stream_, BZ_FLUSH); |
| 201 | if (ret == BZ_RUN_OK || ret == BZ_FLUSH_OK) { |
| 202 | return FlushResult{output_len - stream_.avail_out, (ret == BZ_FLUSH_OK)}; |
| 203 | } else { |
| 204 | return BZ2Error("bz2 compress failed: ", ret); |
| 205 | } |
| 206 | } |
| 207 | |
| 208 | Result<EndResult> End(int64_t output_len, uint8_t* output) override { |
| 209 | stream_.next_in = nullptr; |
nothing calls this directly
no test coverage detected