Revise Utils::Gzip::compress code

Change signature
Add ZLIB_CONST define to make  z_stream.next_in const
Cast to zlib defined type Bytef*
Set memLevel to 9 in deflateInit2() for maximum performance
Revise compression loop
On returning false, free memory correctly by calling deflateEnd()
Reserve space by the estimation of deflateBound()
This commit is contained in:
Chocobo1 2017-04-17 16:52:43 +08:00
parent 94b496354b
commit 302c8ba850
3 changed files with 48 additions and 42 deletions

View file

@ -36,7 +36,7 @@ namespace Utils
{
namespace Gzip
{
bool compress(QByteArray src, QByteArray &dest);
QByteArray compress(const QByteArray &data, int level = 6, bool *ok = nullptr);
bool uncompress(QByteArray src, QByteArray &dest);
}
}