LCOV - code coverage report
Current view: top level - libs/http/src/detail - zlib_filter_base.hpp (source / functions) Coverage Total Hit
Test: coverage_filtered.info Lines: 0.0 % 10 0
Test Date: 2026-02-02 17:02:49 Functions: 0.0 % 2 0

            Line data    Source code
       1              : //
       2              : // Copyright (c) 2023 Vinnie Falco (vinnie.falco@gmail.com)
       3              : // Copyright (c) 2024 Mohammad Nejati
       4              : //
       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)
       7              : //
       8              : // Official repository: https://github.com/cppalliance/buffers
       9              : //
      10              : 
      11              : #ifndef BOOST_HTTP_DETAIL_ZLIB_FILTER_BASE_HPP
      12              : #define BOOST_HTTP_DETAIL_ZLIB_FILTER_BASE_HPP
      13              : 
      14              : #include "src/detail/filter.hpp"
      15              : 
      16              : #include <boost/http/zlib/stream.hpp>
      17              : #include <boost/http/zlib/flush.hpp>
      18              : 
      19              : namespace boost {
      20              : namespace http {
      21              : namespace detail {
      22              : 
      23              : /** Base class for zlib filters
      24              : */
      25              : class zlib_filter_base : public filter
      26              : {
      27              : public:
      28            0 :     zlib_filter_base()
      29            0 :     {
      30            0 :         strm_.zalloc = nullptr;
      31            0 :         strm_.zfree  = nullptr;
      32            0 :         strm_.opaque = nullptr;
      33            0 :     }
      34              : 
      35              : protected:
      36              :     http::zlib::stream strm_;
      37              : 
      38              :     static
      39              :     unsigned int
      40            0 :     saturate_cast(std::size_t n) noexcept
      41              :     {
      42            0 :         if(n >= std::numeric_limits<unsigned int>::max())
      43            0 :             return std::numeric_limits<unsigned int>::max();
      44            0 :         return static_cast<unsigned int>(n);
      45              :     }
      46              : };
      47              : 
      48              : } // detail
      49              : } // http
      50              : } // boost
      51              : 
      52              : #endif
        

Generated by: LCOV version 2.3