| 115 | } |
| 116 | |
| 117 | size_t GzipDeflator::Deflate (const uint8_t * in, size_t inLen, uint8_t * out, size_t outLen) |
| 118 | { |
| 119 | if (m_IsDirty) deflateReset (&m_Deflator); |
| 120 | m_IsDirty = true; |
| 121 | m_Deflator.next_in = const_cast<uint8_t *>(in); |
| 122 | m_Deflator.avail_in = inLen; |
| 123 | m_Deflator.next_out = out; |
| 124 | m_Deflator.avail_out = outLen; |
| 125 | int err; |
| 126 | if ((err = deflate (&m_Deflator, Z_FINISH)) == Z_STREAM_END) |
| 127 | { |
| 128 | out[9] = 0xff; // OS is always unknown |
| 129 | return outLen - m_Deflator.avail_out; |
| 130 | } |
| 131 | // else |
| 132 | if (err) |
| 133 | LogPrint (eLogError, "Gzip: Deflate error ", err); |
| 134 | return 0; |
| 135 | } |
| 136 | |
| 137 | size_t GzipDeflator::Deflate (const std::vector<std::pair<const uint8_t *, size_t> >& bufs, uint8_t * out, size_t outLen) |
| 138 | { |
no test coverage detected