| 61 | } |
| 62 | |
| 63 | InflateStatus InflateReader::readAtMost(uint8_t* dest, size_t maxLen, size_t* produced) { |
| 64 | if (!ringBuffer) { |
| 65 | // One-shot mode: back-references use absolute offset from dest_start. |
| 66 | // Valid only when readAtMost() is called once with the full output buffer. |
| 67 | decomp.dest_start = dest; |
| 68 | } |
| 69 | decomp.dest = dest; |
| 70 | decomp.dest_limit = dest + maxLen; |
| 71 | |
| 72 | const int res = uzlib_uncompress(&decomp); |
| 73 | *produced = static_cast<size_t>(decomp.dest - dest); |
| 74 | |
| 75 | if (res == TINF_DONE) return InflateStatus::Done; |
| 76 | if (res < 0) return InflateStatus::Error; |
| 77 | return InflateStatus::Ok; |
| 78 | } |
no test coverage detected