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