types: Use sizeof(int32_t) instead of hard-coded 4
Switch to sizeof in preparation for converting int32_type_impl into a generic integer_type_impl. Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
This commit is contained in:
2
types.cc
2
types.cc
@@ -64,7 +64,7 @@ struct int32_type_impl : simple_type_impl<int32_t> {
|
||||
return read_simple_opt<int32_t>(v);
|
||||
}
|
||||
int32_t compose_value(const bytes& b) {
|
||||
if (b.size() != 4) {
|
||||
if (b.size() != sizeof(int32_t)) {
|
||||
throw marshal_exception();
|
||||
}
|
||||
return (int32_t)net::ntoh(*reinterpret_cast<const uint32_t*>(b.begin()));
|
||||
|
||||
Reference in New Issue
Block a user