8 char const* msg, std::size_t
size, std::size_t offset, std::size_t n) {
9 if (0 < n and offset <
size and offset + n <=
size) {
12 std::ostringstream os;
13 os <<
"invalid offset or field length for buffer in " << msg
14 <<
" size=" <<
size <<
", offset=" << offset <<
", n=" << n;
15 throw std::runtime_error(os.str());
19 std::ostringstream os;
20 os <<
"message or field validation failed in " << where <<
": " << what;
21 throw std::runtime_error(os.str());
void raise_validation_failed(char const *where, char const *what)
Convenience function to raise an exception upon a validation error.
void check_offset< true >(char const *msg, std::size_t size, std::size_t offset, std::size_t n)
A version of jb::itch5::check_offset<> that actually validates.