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