| 326 | } |
| 327 | |
| 328 | void Inflator::ProcessInput(bool flush) |
| 329 | { |
| 330 | while (true) |
| 331 | { |
| 332 | switch (m_state) |
| 333 | { |
| 334 | case PRE_STREAM: |
| 335 | if (!flush && m_inQueue.CurrentSize() < MaxPrestreamHeaderSize()) |
| 336 | return; |
| 337 | ProcessPrestreamHeader(); |
| 338 | m_state = WAIT_HEADER; |
| 339 | m_wrappedAround = false; |
| 340 | m_current = 0; |
| 341 | m_lastFlush = 0; |
| 342 | m_window.New(((size_t) 1) << GetLog2WindowSize()); |
| 343 | break; |
| 344 | case WAIT_HEADER: |
| 345 | { |
| 346 | // maximum number of bytes before actual compressed data starts |
| 347 | const size_t MAX_HEADER_SIZE = BitsToBytes(3+5+5+4+19*7+286*15+19*15); |
| 348 | if (m_inQueue.CurrentSize() < (flush ? 1 : MAX_HEADER_SIZE)) |
| 349 | return; |
| 350 | DecodeHeader(); |
| 351 | break; |
| 352 | } |
| 353 | case DECODING_BODY: |
| 354 | if (!DecodeBody()) |
| 355 | return; |
| 356 | break; |
| 357 | case POST_STREAM: |
| 358 | if (!flush && m_inQueue.CurrentSize() < MaxPoststreamTailSize()) |
| 359 | return; |
| 360 | ProcessPoststreamTail(); |
| 361 | m_state = m_repeat ? PRE_STREAM : AFTER_END; |
| 362 | Output(0, NULL, 0, GetAutoSignalPropagation(), true); // TODO: non-blocking |
| 363 | if (m_inQueue.IsEmpty()) |
| 364 | return; |
| 365 | break; |
| 366 | case AFTER_END: |
| 367 | m_inQueue.TransferTo(*AttachedTransformation()); |
| 368 | return; |
| 369 | } |
| 370 | } |
| 371 | } |
| 372 | |
| 373 | void Inflator::DecodeHeader() |
| 374 | { |
nothing calls this directly
no test coverage detected