LCOV - code coverage report
Current view: top level - src/zlib - error.cpp (source / functions) Coverage Total Hit Missed
Test: coverage_remapped.info Lines: 10.5 % 19 2 17
Test Date: 2026-06-13 19:44:58 Functions: 25.0 % 4 1 3

           TLA  Line data    Source code
       1                 : //
       2                 : // Copyright (c) 2024 Mohammad Nejati
       3                 : //
       4                 : // Distributed under the Boost Software License, Version 1.0. (See accompanying
       5                 : // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
       6                 : //
       7                 : // Official repository: https://github.com/cppalliance/http
       8                 : //
       9                 : 
      10                 : #include <boost/http/zlib/error.hpp>
      11                 : 
      12                 : namespace boost {
      13                 : namespace http {
      14                 : namespace zlib {
      15                 : namespace detail {
      16                 : 
      17                 : const char*
      18 MIS           0 : error_cat_type::
      19                 : name() const noexcept
      20                 : {
      21               0 :     return "boost.http.zlib";
      22                 : }
      23                 : 
      24                 : bool
      25 HIT           1 : error_cat_type::
      26                 : failed(int ev) const noexcept
      27                 : {
      28               1 :     return ev < 0;
      29                 : }
      30                 : 
      31                 : std::string
      32 MIS           0 : error_cat_type::
      33                 : message(int ev) const
      34                 : {
      35               0 :     return message(ev, nullptr, 0);
      36                 : }
      37                 : 
      38                 : char const*
      39               0 : error_cat_type::
      40                 : message(
      41                 :     int ev,
      42                 :     char*,
      43                 :     std::size_t) const noexcept
      44                 : {
      45               0 :     switch(static_cast<error>(ev))
      46                 :     {
      47               0 :     case error::ok: return "Z_OK";
      48               0 :     case error::stream_end: return "Z_STREAM_END";
      49               0 :     case error::need_dict: return "Z_NEED_DICT";
      50               0 :     case error::errno_: return "Z_ERRNO";
      51               0 :     case error::stream_err: return "Z_STREAM_ERROR";
      52               0 :     case error::data_err: return "Z_DATA_ERROR";
      53               0 :     case error::mem_err: return "Z_MEM_ERROR";
      54               0 :     case error::buf_err: return "Z_BUF_ERROR";
      55               0 :     case error::version_err: return "Z_VERSION_ERROR";
      56               0 :     default:
      57               0 :         return "unknown";
      58                 :     }
      59                 : }
      60                 : 
      61                 : // msvc 14.0 has a bug that warns about inability
      62                 : // to use constexpr construction here, even though
      63                 : // there's no constexpr construction
      64                 : #if defined(_MSC_VER) && _MSC_VER <= 1900
      65                 : # pragma warning( push )
      66                 : # pragma warning( disable : 4592 )
      67                 : #endif
      68                 : 
      69                 : #if defined(__cpp_constinit) && __cpp_constinit >= 201907L
      70                 : constinit error_cat_type error_cat;
      71                 : #else
      72                 : error_cat_type error_cat;
      73                 : #endif
      74                 : 
      75                 : #if defined(_MSC_VER) && _MSC_VER <= 1900
      76                 : # pragma warning( pop )
      77                 : #endif
      78                 : 
      79                 : } // detail
      80                 : } // zlib
      81                 : } // http
      82                 : } // boost
        

Generated by: LCOV version 2.3