0.00% Lines (0/10)
0.00% Functions (0/2)
| TLA | Baseline | Branch | ||||||
|---|---|---|---|---|---|---|---|---|
| Line | Hits | Code | Line | Hits | Code | |||
| 1 | // | 1 | // | |||||
| 2 | // Copyright (c) 2023 Vinnie Falco (vinnie.falco@gmail.com) | 2 | // Copyright (c) 2023 Vinnie Falco (vinnie.falco@gmail.com) | |||||
| 3 | // Copyright (c) 2024 Mohammad Nejati | 3 | // Copyright (c) 2024 Mohammad Nejati | |||||
| 4 | // | 4 | // | |||||
| 5 | // Distributed under the Boost Software License, Version 1.0. (See accompanying | 5 | // Distributed under the Boost Software License, Version 1.0. (See accompanying | |||||
| 6 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) | 6 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) | |||||
| 7 | // | 7 | // | |||||
| 8 | // Official repository: https://github.com/cppalliance/buffers | 8 | // Official repository: https://github.com/cppalliance/buffers | |||||
| 9 | // | 9 | // | |||||
| 10 | 10 | |||||||
| 11 | #ifndef BOOST_HTTP_DETAIL_ZLIB_FILTER_BASE_HPP | 11 | #ifndef BOOST_HTTP_DETAIL_ZLIB_FILTER_BASE_HPP | |||||
| 12 | #define BOOST_HTTP_DETAIL_ZLIB_FILTER_BASE_HPP | 12 | #define BOOST_HTTP_DETAIL_ZLIB_FILTER_BASE_HPP | |||||
| 13 | 13 | |||||||
| 14 | #include "src/detail/filter.hpp" | 14 | #include "src/detail/filter.hpp" | |||||
| 15 | 15 | |||||||
| 16 | #include <boost/http/zlib/stream.hpp> | 16 | #include <boost/http/zlib/stream.hpp> | |||||
| 17 | #include <boost/http/zlib/flush.hpp> | 17 | #include <boost/http/zlib/flush.hpp> | |||||
| 18 | 18 | |||||||
| 19 | namespace boost { | 19 | namespace boost { | |||||
| 20 | namespace http { | 20 | namespace http { | |||||
| 21 | namespace detail { | 21 | namespace detail { | |||||
| 22 | 22 | |||||||
| 23 | /** Base class for zlib filters | 23 | /** Base class for zlib filters | |||||
| 24 | */ | 24 | */ | |||||
| 25 | class zlib_filter_base : public filter | 25 | class zlib_filter_base : public filter | |||||
| 26 | { | 26 | { | |||||
| 27 | public: | 27 | public: | |||||
| MISUBC | 28 | ✗ | zlib_filter_base() | 28 | ✗ | zlib_filter_base() | ||
| MISUBC | 29 | ✗ | { | 29 | ✗ | { | ||
| MISUBC | 30 | ✗ | strm_.zalloc = nullptr; | 30 | ✗ | strm_.zalloc = nullptr; | ||
| MISUBC | 31 | ✗ | strm_.zfree = nullptr; | 31 | ✗ | strm_.zfree = nullptr; | ||
| MISUBC | 32 | ✗ | strm_.opaque = nullptr; | 32 | ✗ | strm_.opaque = nullptr; | ||
| MISUBC | 33 | ✗ | } | 33 | ✗ | } | ||
| 34 | 34 | |||||||
| 35 | protected: | 35 | protected: | |||||
| 36 | http::zlib::stream strm_; | 36 | http::zlib::stream strm_; | |||||
| 37 | 37 | |||||||
| 38 | static | 38 | static | |||||
| 39 | unsigned int | 39 | unsigned int | |||||
| MISUBC | 40 | ✗ | saturate_cast(std::size_t n) noexcept | 40 | ✗ | saturate_cast(std::size_t n) noexcept | ||
| 41 | { | 41 | { | |||||
| MISUBC | 42 | ✗ | if(n >= std::numeric_limits<unsigned int>::max()) | 42 | ✗ | if(n >= std::numeric_limits<unsigned int>::max()) | ||
| MISUBC | 43 | ✗ | return std::numeric_limits<unsigned int>::max(); | 43 | ✗ | return std::numeric_limits<unsigned int>::max(); | ||
| MISUBC | 44 | ✗ | return static_cast<unsigned int>(n); | 44 | ✗ | return static_cast<unsigned int>(n); | ||
| 45 | } | 45 | } | |||||
| 46 | }; | 46 | }; | |||||
| 47 | 47 | |||||||
| 48 | } // detail | 48 | } // detail | |||||
| 49 | } // http | 49 | } // http | |||||
| 50 | } // boost | 50 | } // boost | |||||
| 51 | 51 | |||||||
| 52 | #endif | 52 | #endif | |||||