mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2025-12-18 14:38:04 -06:00
Improve coding style
This commit is contained in:
@@ -68,10 +68,12 @@ QByteArray Utils::Gzip::compress(const QByteArray &data, const int level, bool *
|
||||
output.reserve(deflateBound(&strm, data.size()));
|
||||
|
||||
// feed to deflate
|
||||
while (strm.avail_in > 0) {
|
||||
while (strm.avail_in > 0)
|
||||
{
|
||||
result = deflate(&strm, Z_NO_FLUSH);
|
||||
|
||||
if (result != Z_OK) {
|
||||
if (result != Z_OK)
|
||||
{
|
||||
deflateEnd(&strm);
|
||||
return {};
|
||||
}
|
||||
@@ -82,7 +84,8 @@ QByteArray Utils::Gzip::compress(const QByteArray &data, const int level, bool *
|
||||
}
|
||||
|
||||
// flush the rest from deflate
|
||||
while (result != Z_STREAM_END) {
|
||||
while (result != Z_STREAM_END)
|
||||
{
|
||||
result = deflate(&strm, Z_FINISH);
|
||||
|
||||
output.append(tmpBuf.data(), (BUFSIZE - strm.avail_out));
|
||||
@@ -126,15 +129,18 @@ QByteArray Utils::Gzip::decompress(const QByteArray &data, bool *ok)
|
||||
output.reserve(data.size() * 3);
|
||||
|
||||
// run inflate
|
||||
while (true) {
|
||||
while (true)
|
||||
{
|
||||
result = inflate(&strm, Z_NO_FLUSH);
|
||||
|
||||
if (result == Z_STREAM_END) {
|
||||
if (result == Z_STREAM_END)
|
||||
{
|
||||
output.append(tmpBuf.data(), (BUFSIZE - strm.avail_out));
|
||||
break;
|
||||
}
|
||||
|
||||
if (result != Z_OK) {
|
||||
if (result != Z_OK)
|
||||
{
|
||||
inflateEnd(&strm);
|
||||
return {};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user