WIP
This commit is contained in:
parent
cf434bcae3
commit
14620c4487
@ -80,6 +80,7 @@ public:
|
|||||||
long int size = 0;
|
long int size = 0;
|
||||||
std::size_t var_size = 0;
|
std::size_t var_size = 0;
|
||||||
auto id = *curr;
|
auto id = *curr;
|
||||||
|
traits&
|
||||||
format::type token_type;
|
format::type token_type;
|
||||||
++curr;
|
++curr;
|
||||||
switch (id) {
|
switch (id) {
|
||||||
@ -127,27 +128,34 @@ public:
|
|||||||
size = sizeof(format::str32::first_type);
|
size = sizeof(format::str32::first_type);
|
||||||
token_type = format::type::string;
|
token_type = format::type::string;
|
||||||
break;
|
break;
|
||||||
|
case format::bin8::marker:
|
||||||
|
size = sizeof(format::bin8::first_type);
|
||||||
|
token_type = format::type::bytes;
|
||||||
|
break;
|
||||||
|
case format::bin16::marker:
|
||||||
|
size = sizeof(format::bin16::first_type);
|
||||||
|
token_type = format::type::bytes;
|
||||||
|
break;
|
||||||
|
case format::bin32::marker:
|
||||||
|
size = sizeof(format::bin32::first_type);
|
||||||
|
token_type = format::type::bytes;
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
return tl::make_unexpected(error::not_implemented);
|
return tl::make_unexpected(error::not_implemented);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (remaining(curr) < size) {
|
||||||
|
return tl::make_unexpected(error::incomplete_message);
|
||||||
|
}
|
||||||
|
|
||||||
switch (token_type) {
|
switch (token_type) {
|
||||||
case format::type::unsigned_int:
|
case format::type::unsigned_int:
|
||||||
if (remaining(curr) < size) {
|
|
||||||
return tl::make_unexpected(error::out_of_space);
|
|
||||||
}
|
|
||||||
tok = detail::read_value<format::type::unsigned_int>(size, curr);
|
tok = detail::read_value<format::type::unsigned_int>(size, curr);
|
||||||
break;
|
break;
|
||||||
case format::type::signed_int:
|
case format::type::signed_int:
|
||||||
if (remaining(curr) < size) {
|
|
||||||
return tl::make_unexpected(error::out_of_space);
|
|
||||||
}
|
|
||||||
tok = detail::read_value<format::type::signed_int>(size, curr);
|
tok = detail::read_value<format::type::signed_int>(size, curr);
|
||||||
break;
|
break;
|
||||||
case format::type::string:
|
case format::type::string:
|
||||||
if (remaining(curr) < size) {
|
|
||||||
return tl::make_unexpected(error::incomplete_message);
|
|
||||||
}
|
|
||||||
var_size = std::bit_cast<std::size_t>(detail::read(size, curr));
|
var_size = std::bit_cast<std::size_t>(detail::read(size, curr));
|
||||||
if (std::size_t(remaining(curr)) < var_size) {
|
if (std::size_t(remaining(curr)) < var_size) {
|
||||||
return tl::make_unexpected(error::incomplete_message);
|
return tl::make_unexpected(error::incomplete_message);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user