Skip to content

Commit

Permalink
Merge branch 'boostorg:develop' into zig-pkg
Browse files Browse the repository at this point in the history
  • Loading branch information
kassane authored Feb 8, 2024
2 parents 98c439c + e0a9da2 commit 29c1a76
Show file tree
Hide file tree
Showing 15 changed files with 133 additions and 86 deletions.
6 changes: 3 additions & 3 deletions include/boost/beast/core/basic_stream.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -450,7 +450,7 @@ class basic_stream
return impl_->policy();
}

/** Set the timeout for the next logical operation.
/** Set the timeout for subsequent logical operations.
This sets either the read timer, the write timer, or
both timers to expire after the specified amount of time
Expand All @@ -473,7 +473,7 @@ class basic_stream
expires_after(
net::steady_timer::duration expiry_time);

/** Set the timeout for the next logical operation.
/** Set the timeout for subsequent logical operations.
This sets either the read timer, the write timer, or both
timers to expire at the specified time point. If a timer
Expand All @@ -495,7 +495,7 @@ class basic_stream
void
expires_at(net::steady_timer::time_point expiry_time);

/// Disable the timeout for the next logical operation.
/// Disable the timeout for subsequent logical operations.
void
expires_never();

Expand Down
1 change: 1 addition & 0 deletions include/boost/beast/core/impl/buffers_adaptor.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ class buffers_adaptor<MutableBufferSequence>::subrange
net::const_buffer>::type;

struct iterator;
using const_iterator = iterator;

// construct from two iterators plus optionally subrange definition
subrange(
Expand Down
27 changes: 18 additions & 9 deletions include/boost/beast/core/impl/buffers_cat.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,8 @@ class buffers_cat_view<Buffer>

#if defined(_MSC_VER) && ! defined(__clang__)
# define BOOST_BEAST_UNREACHABLE() __assume(false)
# define BOOST_BEAST_UNREACHABLE_RETURN(v) return v
#else
# define BOOST_BEAST_UNREACHABLE() __builtin_unreachable()
# define BOOST_BEAST_UNREACHABLE_RETURN(v) \
do { __builtin_unreachable(); return v; } while(false)
#endif

#ifdef BOOST_BEAST_TESTS
Expand All @@ -67,6 +64,12 @@ class buffers_cat_view<Buffer>
BOOST_BEAST_UNREACHABLE(); \
}

#define BOOST_BEAST_LOGIC_ERROR_RETURN(s, v) \
{ \
BOOST_THROW_EXCEPTION(std::logic_error((s))); \
return v; \
}

#else

#define BOOST_BEAST_LOGIC_ERROR(s) \
Expand All @@ -75,6 +78,12 @@ class buffers_cat_view<Buffer>
BOOST_BEAST_UNREACHABLE(); \
}

#define BOOST_BEAST_LOGIC_ERROR_RETURN(s, v) \
{ \
BOOST_ASSERT_MSG(false, s); \
return v; \
}

#endif

namespace detail {
Expand All @@ -85,11 +94,11 @@ struct buffers_cat_view_iterator_base
{
char unused = 0; // make g++8 happy

BOOST_NORETURN net::mutable_buffer
net::mutable_buffer
operator*() const
{
BOOST_BEAST_LOGIC_ERROR(
"Dereferencing a one-past-the-end iterator");
BOOST_BEAST_LOGIC_ERROR_RETURN(
"Dereferencing a one-past-the-end iterator", {});
}

operator bool() const noexcept
Expand Down Expand Up @@ -173,11 +182,11 @@ class buffers_cat_view<Bn...>::const_iterator
{
const_iterator const& self;

BOOST_NORETURN reference
reference
operator()(mp11::mp_size_t<0>)
{
BOOST_BEAST_LOGIC_ERROR(
"Dereferencing a default-constructed iterator");
BOOST_BEAST_LOGIC_ERROR_RETURN(
"Dereferencing a default-constructed iterator", {});
}

template<class I>
Expand Down
10 changes: 4 additions & 6 deletions include/boost/beast/http/impl/status.ipp
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ int_to_status(unsigned v)
case status::continue_:
case status::switching_protocols:
case status::processing:
case status::early_hints:
BOOST_FALLTHROUGH;

// 2xx
Expand Down Expand Up @@ -75,13 +76,12 @@ int_to_status(unsigned v)
case status::unprocessable_entity:
case status::locked:
case status::failed_dependency:
case status::too_early:
case status::upgrade_required:
case status::precondition_required:
case status::too_many_requests:
case status::request_header_fields_too_large:
case status::connection_closed_without_response:
case status::unavailable_for_legal_reasons:
case status::client_closed_request:
BOOST_FALLTHROUGH;

// 5xx
Expand All @@ -96,7 +96,6 @@ int_to_status(unsigned v)
case status::loop_detected:
case status::not_extended:
case status::network_authentication_required:
case status::network_connect_timeout_error:
return static_cast<status>(v);

default:
Expand Down Expand Up @@ -136,6 +135,7 @@ obsolete_reason(status v)
case status::continue_: return "Continue";
case status::switching_protocols: return "Switching Protocols";
case status::processing: return "Processing";
case status::early_hints: return "Early Hints";

// 2xx
case status::ok: return "OK";
Expand Down Expand Up @@ -182,13 +182,12 @@ obsolete_reason(status v)
case status::unprocessable_entity: return "Unprocessable Entity";
case status::locked: return "Locked";
case status::failed_dependency: return "Failed Dependency";
case status::too_early: return "Too Early";
case status::upgrade_required: return "Upgrade Required";
case status::precondition_required: return "Precondition Required";
case status::too_many_requests: return "Too Many Requests";
case status::request_header_fields_too_large: return "Request Header Fields Too Large";
case status::connection_closed_without_response: return "Connection Closed Without Response";
case status::unavailable_for_legal_reasons: return "Unavailable For Legal Reasons";
case status::client_closed_request: return "Client Closed Request";
// 5xx
case status::internal_server_error: return "Internal Server Error";
case status::not_implemented: return "Not Implemented";
Expand All @@ -201,7 +200,6 @@ obsolete_reason(status v)
case status::loop_detected: return "Loop Detected";
case status::not_extended: return "Not Extended";
case status::network_authentication_required: return "Network Authentication Required";
case status::network_connect_timeout_error: return "Network Connect Timeout Error";

default:
break;
Expand Down
8 changes: 3 additions & 5 deletions include/boost/beast/http/status.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ enum class status : unsigned
code.
*/
switching_protocols = 101,

processing = 102,
early_hints = 103,

ok = 200,
created = 201,
Expand Down Expand Up @@ -84,13 +84,12 @@ enum class status : unsigned
unprocessable_entity = 422,
locked = 423,
failed_dependency = 424,
too_early = 425,
upgrade_required = 426,
precondition_required = 428,
too_many_requests = 429,
request_header_fields_too_large = 431,
connection_closed_without_response = 444,
unavailable_for_legal_reasons = 451,
client_closed_request = 499,

internal_server_error = 500,
not_implemented = 501,
Expand All @@ -102,8 +101,7 @@ enum class status : unsigned
insufficient_storage = 507,
loop_detected = 508,
not_extended = 510,
network_authentication_required = 511,
network_connect_timeout_error = 599
network_authentication_required = 511
};

/** Represents the class of a status-code.
Expand Down
10 changes: 10 additions & 0 deletions include/boost/beast/websocket/ssl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,11 @@ namespace beast {
`net::ssl::stream`, callers are responsible for
providing a suitable overload of this function.
@note
This function serves as a customization point and is not intended
to be called directly.
@param role The role of the local endpoint
@param stream The stream to tear down.
Expand All @@ -50,6 +55,11 @@ teardown(
callers are responsible for providing a suitable overload
of this function.
@note
This function serves as a customization point and is not intended
to be called directly.
@param role The role of the local endpoint
@param stream The stream to tear down.
Expand Down
20 changes: 20 additions & 0 deletions include/boost/beast/websocket/teardown.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,11 @@ namespace websocket {
`net::ssl::stream`, callers are responsible for
providing a suitable overload of this function.
@note
This function serves as a customization point and is not intended
to be called directly.
@param role The role of the local endpoint
@param socket The socket to tear down.
Expand Down Expand Up @@ -65,6 +70,11 @@ teardown(
callers are responsible for providing a suitable overload
of this function.
@note
This function serves as a customization point and is not intended
to be called directly.
@param role The role of the local endpoint
@param socket The socket to tear down.
Expand Down Expand Up @@ -122,6 +132,11 @@ namespace websocket {
`net::ssl::stream`, callers are responsible for
providing a suitable overload of this function.
@note
This function serves as a customization point and is not intended
to be called directly.
@param role The role of the local endpoint
@param socket The socket to tear down.
Expand All @@ -146,6 +161,11 @@ teardown(
callers are responsible for providing a suitable overload
of this function.
@note
This function serves as a customization point and is not intended
to be called directly.
@param role The role of the local endpoint
@param socket The socket to tear down.
Expand Down
2 changes: 1 addition & 1 deletion include/boost/beast/zlib/deflate_stream.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ class deflate_stream
*/
deflate_stream()
{
reset(6, 15, DEF_MEM_LEVEL, Strategy::normal);
reset(6, 15, def_mem_level, Strategy::normal);
}

/** Reset the stream and compression settings.
Expand Down
32 changes: 16 additions & 16 deletions include/boost/beast/zlib/detail/deflate_stream.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -90,35 +90,35 @@ class deflate_stream
BOOST_STATIC_ASSERT(minMatch == 3);

// end of block literal code
static std::uint16_t constexpr END_BLOCK = 256;
static std::uint16_t constexpr end_block = 256;

// repeat previous bit length 3-6 times (2 bits of repeat count)
static std::uint8_t constexpr REP_3_6 = 16;
static std::uint8_t constexpr rep_3_6 = 16;

// repeat a zero length 3-10 times (3 bits of repeat count)
static std::uint8_t constexpr REPZ_3_10 = 17;
static std::uint8_t constexpr repz_3_10 = 17;

// repeat a zero length 11-138 times (7 bits of repeat count)
static std::uint8_t constexpr REPZ_11_138 = 18;
static std::uint8_t constexpr repz_11_138 = 18;

// The three kinds of block type
static std::uint8_t constexpr STORED_BLOCK = 0;
static std::uint8_t constexpr STATIC_TREES = 1;
static std::uint8_t constexpr DYN_TREES = 2;
static std::uint8_t constexpr stored_block = 0;
static std::uint8_t constexpr static_trees = 1;
static std::uint8_t constexpr dyn_trees = 2;

// Maximum value for memLevel in deflateInit2
static std::uint8_t constexpr max_mem_level = 9;

// Default memLevel
static std::uint8_t constexpr DEF_MEM_LEVEL = max_mem_level;
static std::uint8_t constexpr def_mem_level = max_mem_level;

/* Note: the deflate() code requires max_lazy >= minMatch and max_chain >= 4
For deflate_fast() (levels <= 3) good is ignored and lazy has a different
meaning.
*/

// maximum heap size
static std::uint16_t constexpr HEAP_SIZE = 2 * lCodes + 1;
static std::uint16_t constexpr heap_size = 2 * lCodes + 1;

// size of bit buffer in bi_buf
static std::uint8_t constexpr Buf_size = 16;
Expand Down Expand Up @@ -229,12 +229,12 @@ class deflate_stream
// VFALCO This might not be needed, e.g. for zip/gzip
enum StreamStatus
{
EXTRA_STATE = 69,
NAME_STATE = 73,
COMMENT_STATE = 91,
HCRC_STATE = 103,
BUSY_STATE = 113,
FINISH_STATE = 666
extra_state = 69,
name_state = 73,
comment_state = 91,
hcrc_state = 103,
busy_state = 113,
finish_state = 666
};

/* A std::uint16_t is an index in the character window. We use short instead of int to
Expand Down Expand Up @@ -343,7 +343,7 @@ class deflate_stream
int nice_match_; // Stop searching when current match exceeds this

ct_data dyn_ltree_[
HEAP_SIZE]; // literal and length tree
heap_size]; // literal and length tree
ct_data dyn_dtree_[
2*dCodes+1]; // distance tree
ct_data bl_tree_[
Expand Down
Loading

0 comments on commit 29c1a76

Please sign in to comment.