From bd9547ba7704911d4e3cc77c5e5f4dccde2d3606 Mon Sep 17 00:00:00 2001 From: Pekka Enberg Date: Wed, 25 Feb 2015 13:08:16 +0200 Subject: [PATCH] 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 --- types.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types.cc b/types.cc index 3b55bb038d..d037414413 100644 --- a/types.cc +++ b/types.cc @@ -64,7 +64,7 @@ struct int32_type_impl : simple_type_impl { return read_simple_opt(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(b.begin()));