aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/libs/zlib/compress.c
diff options
context:
space:
mode:
authororivej <orivej@yandex-team.ru>2022-02-10 16:45:01 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:45:01 +0300
commit2d37894b1b037cf24231090eda8589bbb44fb6fc (patch)
treebe835aa92c6248212e705f25388ebafcf84bc7a1 /contrib/libs/zlib/compress.c
parent718c552901d703c502ccbefdfc3c9028d608b947 (diff)
downloadydb-2d37894b1b037cf24231090eda8589bbb44fb6fc.tar.gz
Restoring authorship annotation for <orivej@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'contrib/libs/zlib/compress.c')
-rw-r--r--contrib/libs/zlib/compress.c48
1 files changed, 24 insertions, 24 deletions
diff --git a/contrib/libs/zlib/compress.c b/contrib/libs/zlib/compress.c
index d8950bbb3b..e2db404abf 100644
--- a/contrib/libs/zlib/compress.c
+++ b/contrib/libs/zlib/compress.c
@@ -1,5 +1,5 @@
/* compress.c -- compress a memory buffer
- * Copyright (C) 1995-2005, 2014, 2016 Jean-loup Gailly, Mark Adler
+ * Copyright (C) 1995-2005, 2014, 2016 Jean-loup Gailly, Mark Adler
* For conditions of distribution and use, see copyright notice in zlib.h
*/
@@ -28,11 +28,11 @@ int ZEXPORT compress2 (dest, destLen, source, sourceLen, level)
{
z_stream stream;
int err;
- const uInt max = (uInt)-1;
- uLong left;
+ const uInt max = (uInt)-1;
+ uLong left;
- left = *destLen;
- *destLen = 0;
+ left = *destLen;
+ *destLen = 0;
stream.zalloc = (alloc_func)0;
stream.zfree = (free_func)0;
@@ -41,26 +41,26 @@ int ZEXPORT compress2 (dest, destLen, source, sourceLen, level)
err = deflateInit(&stream, level);
if (err != Z_OK) return err;
- stream.next_out = dest;
- stream.avail_out = 0;
- stream.next_in = (z_const Bytef *)source;
- stream.avail_in = 0;
-
- do {
- if (stream.avail_out == 0) {
- stream.avail_out = left > (uLong)max ? max : (uInt)left;
- left -= stream.avail_out;
- }
- if (stream.avail_in == 0) {
- stream.avail_in = sourceLen > (uLong)max ? max : (uInt)sourceLen;
- sourceLen -= stream.avail_in;
- }
- err = deflate(&stream, sourceLen ? Z_NO_FLUSH : Z_FINISH);
- } while (err == Z_OK);
-
+ stream.next_out = dest;
+ stream.avail_out = 0;
+ stream.next_in = (z_const Bytef *)source;
+ stream.avail_in = 0;
+
+ do {
+ if (stream.avail_out == 0) {
+ stream.avail_out = left > (uLong)max ? max : (uInt)left;
+ left -= stream.avail_out;
+ }
+ if (stream.avail_in == 0) {
+ stream.avail_in = sourceLen > (uLong)max ? max : (uInt)sourceLen;
+ sourceLen -= stream.avail_in;
+ }
+ err = deflate(&stream, sourceLen ? Z_NO_FLUSH : Z_FINISH);
+ } while (err == Z_OK);
+
*destLen = stream.total_out;
- deflateEnd(&stream);
- return err == Z_STREAM_END ? Z_OK : err;
+ deflateEnd(&stream);
+ return err == Z_STREAM_END ? Z_OK : err;
}
/* ===========================================================================