mirror of
https://github.com/lubosz/overte.git
synced 2025-04-24 12:43:19 +02:00
code review
This commit is contained in:
parent
45643a3aad
commit
eb87023416
2 changed files with 11 additions and 3 deletions
|
@ -14,6 +14,7 @@
|
|||
|
||||
const int GZIP_WINDOWS_BIT = 31;
|
||||
const int GZIP_CHUNK_SIZE = 4096;
|
||||
const int DEFAULT_MEM_LEVEL = 8;
|
||||
|
||||
bool gunzip(QByteArray source, QByteArray &destination) {
|
||||
destination.clear();
|
||||
|
@ -100,10 +101,10 @@ bool gzip(QByteArray source, QByteArray &destination, int compressionLevel) {
|
|||
strm.avail_in = 0;
|
||||
|
||||
int status = deflateInit2(&strm,
|
||||
qMax(-1, qMin(9, compressionLevel)),
|
||||
qMax(Z_DEFAULT_COMPRESSION, qMin(9, compressionLevel)),
|
||||
Z_DEFLATED,
|
||||
GZIP_WINDOWS_BIT,
|
||||
8,
|
||||
DEFAULT_MEM_LEVEL,
|
||||
Z_DEFAULT_STRATEGY);
|
||||
if (status != Z_OK) {
|
||||
return false;
|
||||
|
|
|
@ -14,7 +14,14 @@
|
|||
|
||||
#include <QByteArray>
|
||||
|
||||
bool gzip(QByteArray source, QByteArray &destination, int compressionLevel = -1);
|
||||
// The compression level must be Z_DEFAULT_COMPRESSION (-1), or between 0 and
|
||||
// 9: 1 gives best speed, 9 gives best compression, 0 gives no
|
||||
// compression at all (the input data is simply copied a block at a
|
||||
// time). Z_DEFAULT_COMPRESSION requests a default compromise between
|
||||
// speed and compression (currently equivalent to level 6).
|
||||
|
||||
bool gzip(QByteArray source, QByteArray &destination, int compressionLevel = -1); // -1 is Z_DEFAULT_COMPRESSION
|
||||
|
||||
bool gunzip(QByteArray source, QByteArray &destination);
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Reference in a new issue