diff options
author | Yuri Gorshenin <y@maps.me> | 2017-05-02 18:05:06 +0300 |
---|---|---|
committer | Yuri Gorshenin <y@maps.me> | 2017-05-02 19:24:56 +0300 |
commit | bc31b923405c5814403df99aff983d84b836591a (patch) | |
tree | 33fc977cfc44f7d1c23b3926110cdb7dbae37eea | |
parent | 5c8c7b6260598aa1cc4754d7d6deb05dbd54e9ef (diff) |
Review fixes.
-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); |