Line |
Branch |
Exec |
Source |
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_proto |
8 |
|
|
// |
9 |
|
|
|
10 |
|
|
#include <boost/http_proto/service/zlib_service.hpp> |
11 |
|
|
|
12 |
|
|
namespace boost { |
13 |
|
|
namespace http_proto { |
14 |
|
|
namespace zlib { |
15 |
|
|
namespace detail { |
16 |
|
|
|
17 |
|
|
const char* |
18 |
|
✗ |
error_cat_type:: |
19 |
|
|
name() const noexcept |
20 |
|
|
{ |
21 |
|
✗ |
return "boost.http.proto.zlib"; |
22 |
|
|
} |
23 |
|
|
|
24 |
|
|
bool |
25 |
|
60148 |
error_cat_type:: |
26 |
|
|
failed(int ev) const noexcept |
27 |
|
|
{ |
28 |
|
60148 |
return ev < 0; |
29 |
|
|
} |
30 |
|
|
|
31 |
|
|
std::string |
32 |
|
✗ |
error_cat_type:: |
33 |
|
|
message(int ev) const |
34 |
|
|
{ |
35 |
|
✗ |
return message(ev, nullptr, 0); |
36 |
|
|
} |
37 |
|
|
|
38 |
|
|
char const* |
39 |
|
✗ |
error_cat_type:: |
40 |
|
|
message( |
41 |
|
|
int ev, |
42 |
|
|
char*, |
43 |
|
|
std::size_t) const noexcept |
44 |
|
|
{ |
45 |
|
✗ |
switch(static_cast<error>(ev)) |
46 |
|
|
{ |
47 |
|
✗ |
case error::ok: return "Z_OK"; |
48 |
|
✗ |
case error::stream_end: return "Z_STREAM_END"; |
49 |
|
✗ |
case error::need_dict: return "Z_NEED_DICT"; |
50 |
|
✗ |
case error::errno_: return "Z_ERRNO"; |
51 |
|
✗ |
case error::stream_err: return "Z_STREAM_ERROR"; |
52 |
|
✗ |
case error::data_err: return "Z_DATA_ERROR"; |
53 |
|
✗ |
case error::mem_err: return "Z_MEM_ERROR"; |
54 |
|
✗ |
case error::buf_err: return "Z_BUF_ERROR"; |
55 |
|
✗ |
case error::version_err: return "Z_VERSION_ERROR"; |
56 |
|
✗ |
default: |
57 |
|
✗ |
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_proto |
82 |
|
|
} // boost |
83 |
|
|
|