Overflow detection, span-based signatures, flatten control flow
This commit is contained in:
@@ -4,7 +4,7 @@
|
||||
#include <span>
|
||||
#include "wire.h"
|
||||
|
||||
using handler_fn = size_t (*)(uint32_t message_id, std::span<const uint8_t> payload, span_writer &out);
|
||||
using handler_fn = msgpack::result<size_t> (*)(uint32_t message_id, std::span<const uint8_t> payload, span_writer &out);
|
||||
|
||||
struct handler_entry {
|
||||
int8_t type_id;
|
||||
@@ -12,7 +12,7 @@ struct handler_entry {
|
||||
};
|
||||
|
||||
template <typename Req, auto Fn>
|
||||
size_t typed_handler(uint32_t message_id, std::span<const uint8_t> payload, span_writer &out) {
|
||||
msgpack::result<size_t> typed_handler(uint32_t message_id, std::span<const uint8_t> payload, span_writer &out) {
|
||||
msgpack::parser p(payload.data(), static_cast<int>(payload.size()));
|
||||
Req req;
|
||||
auto tup = req.as_tuple();
|
||||
|
||||
Reference in New Issue
Block a user