| 242 | } |
| 243 | |
| 244 | inline const Bytef* WritePart(const Bytef* b, const Bytef* e) { |
| 245 | Z()->next_in = const_cast<Bytef*>(b); |
| 246 | Z()->avail_in = MaxPortion(e - b); |
| 247 | |
| 248 | while (Z()->avail_in) { |
| 249 | const int ret = deflate(Z(), Z_NO_FLUSH); |
| 250 | |
| 251 | switch (ret) { |
| 252 | case Z_OK: |
| 253 | continue; |
| 254 | |
| 255 | case Z_BUF_ERROR: |
| 256 | FlushBuffer(); |
| 257 | |
| 258 | break; |
| 259 | |
| 260 | default: |
| 261 | ythrow TZLibCompressorError() << "deflate error(" << GetErrMsg() << ")"; |
| 262 | } |
| 263 | } |
| 264 | |
| 265 | return Z()->next_in; |
| 266 | } |
| 267 | |
| 268 | inline void Flush() { |
| 269 | int ret = deflate(Z(), Z_SYNC_FLUSH); |
no test coverage detected