Overflow detection, span-based signatures, flatten control flow

This commit is contained in:
Ian Gulliver
2026-04-10 23:02:07 +09:00
parent 8408603390
commit 76c519c17a
7 changed files with 67 additions and 56 deletions

View File

@@ -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();