diff options
-rw-r--r-- | coding/coding_tests/zlib_test.cpp | 8 | ||||
-rw-r--r-- | coding/zlib.cpp | 9 |
2 files changed, 10 insertions, 7 deletions
diff --git a/coding/coding_tests/zlib_test.cpp b/coding/coding_tests/zlib_test.cpp index 76dfc91e24..4d434dd962 100644 --- a/coding/coding_tests/zlib_test.cpp +++ b/coding/coding_tests/zlib_test.cpp @@ -49,10 +49,10 @@ UNIT_TEST(ZLib_Smoke) { string s; - TEST(!deflate(nullptr, 0, back_inserter(s)), ()); - TEST(!deflate(nullptr, 4, back_inserter(s)), ()); - TEST(!inflate(nullptr, 0, back_inserter(s)), ()); - TEST(!inflate(nullptr, 4, back_inserter(s)), ()); + TEST(!deflate(nullptr /* data */, 0 /* size */, back_inserter(s) /* out */), ()); + TEST(!deflate(nullptr /* data */, 4 /* size */, back_inserter(s) /* out */), ()); + TEST(!inflate(nullptr /* data */, 0 /* size */, back_inserter(s) /* out */), ()); + TEST(!inflate(nullptr /* data */, 4 /* size */, back_inserter(s) /* out */), ()); } TestDeflateInflate(""); diff --git a/coding/zlib.cpp b/coding/zlib.cpp index 9c6850cfb3..00412b3f7a 100644 --- a/coding/zlib.cpp +++ b/coding/zlib.cpp @@ -6,6 +6,9 @@ namespace coding { namespace { +int constexpr kGzipBits = 16; +int constexpr kBothBits = 32; + int ToInt(ZLib::Deflate::Level level) { using Level = ZLib::Deflate::Level; @@ -59,7 +62,7 @@ ZLib::DeflateProcessor::DeflateProcessor(Deflate::Format format, Deflate::Level switch (format) { case Deflate::Format::ZLib: break; - case Deflate::Format::GZip: bits = bits | 16; break; + case Deflate::Format::GZip: bits = bits | kGzipBits; break; } int const ret = @@ -89,8 +92,8 @@ ZLib::InflateProcessor::InflateProcessor(Inflate::Format format, void const * da switch (format) { case Inflate::Format::ZLib: break; - case Inflate::Format::GZip: bits = bits | 16; break; - case Inflate::Format::Both: bits = bits | 32; break; + case Inflate::Format::GZip: bits = bits | kGzipBits; break; + case Inflate::Format::Both: bits = bits | kBothBits; break; } int const ret = inflateInit2(&m_stream, bits); m_init = (ret == Z_OK); |