| 206 | } |
| 207 | |
| 208 | Result<EndResult> End(int64_t output_len, uint8_t* output) override { |
| 209 | stream_.next_in = nullptr; |
| 210 | stream_.avail_in = 0; |
| 211 | stream_.next_out = reinterpret_cast<char*>(output); |
| 212 | stream_.avail_out = static_cast<unsigned int>(std::min(output_len, kSizeLimit)); |
| 213 | int ret; |
| 214 | |
| 215 | ret = BZ2_bzCompress(&stream_, BZ_FINISH); |
| 216 | if (ret == BZ_STREAM_END || ret == BZ_FINISH_OK) { |
| 217 | return EndResult{output_len - stream_.avail_out, (ret == BZ_FINISH_OK)}; |
| 218 | } else { |
| 219 | return BZ2Error("bz2 compress failed: ", ret); |
| 220 | } |
| 221 | } |
| 222 | |
| 223 | protected: |
| 224 | bz_stream stream_; |
nothing calls this directly
no test coverage detected