| 146 | } |
| 147 | |
| 148 | Result<EndResult> End(int64_t output_len, uint8_t* output) override { |
| 149 | size_t avail_in = 0; |
| 150 | const uint8_t* next_in = nullptr; |
| 151 | auto avail_out = static_cast<size_t>(output_len); |
| 152 | BROTLI_BOOL ret; |
| 153 | |
| 154 | ret = |
| 155 | BrotliEncoderCompressStream(state_, BROTLI_OPERATION_FINISH, &avail_in, &next_in, |
| 156 | &avail_out, &output, nullptr /* total_out */); |
| 157 | if (!ret) { |
| 158 | return BrotliError("Brotli end failed"); |
| 159 | } |
| 160 | bool should_retry = !!BrotliEncoderHasMoreOutput(state_); |
| 161 | DCHECK_EQ(should_retry, !BrotliEncoderIsFinished(state_)); |
| 162 | return EndResult{static_cast<int64_t>(output_len - avail_out), should_retry}; |
| 163 | } |
| 164 | |
| 165 | protected: |
| 166 | Status BrotliError(const char* msg) { return Status::IOError(msg); } |
nothing calls this directly
no outgoing calls
no test coverage detected