summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorScott Torborg <storborg@gmail.com>2018-05-23 10:19:30 -0700
committerAndrej Rode <mail@andrejro.de>2019-01-26 14:06:12 +0100
commit6535c2d0feaf7ef397e1263acdc870d7b7a55a06 (patch)
tree359d38da711dffe7b5e94c44db55fe2f3ed77388
parent76dd4323a400cd5082290b4738ea1247f1100251 (diff)
pmt: Change explicit numbers to int32 min/max numeric limits in PMT serialization
-rw-r--r--gnuradio-runtime/lib/pmt/pmt_serialize.cc3
1 files changed, 2 insertions, 1 deletions
diff --git a/gnuradio-runtime/lib/pmt/pmt_serialize.cc b/gnuradio-runtime/lib/pmt/pmt_serialize.cc
index 37114139c0..e7d61030af 100644
--- a/gnuradio-runtime/lib/pmt/pmt_serialize.cc
+++ b/gnuradio-runtime/lib/pmt/pmt_serialize.cc
@@ -24,6 +24,7 @@
#endif
#include <vector>
+#include <limits>
#include <pmt/pmt.h>
#include "pmt_int.h"
#include "pmt/pmt_serial_tags.h"
@@ -286,7 +287,7 @@ serialize(pmt_t obj, std::streambuf &sb)
else {
if(is_integer(obj)) {
long i = to_long(obj);
- if((sizeof(long) > 4) && ((i < -2147483647 || i > 2147483647))) {
+ if((sizeof(long) > 4) && ((i < std::numeric_limits<std::int32_t>::min() || i > std::numeric_limits<std::int32_t>::max()))) {
// Serializing as 4 bytes won't work for this value, serialize as 8 bytes
ok = serialize_untagged_u8(PST_INT64, sb);
ok &= serialize_untagged_u64(i, sb);