hopefully removed some warnings

This commit is contained in:
Niels committed 2016-04-30 16:22:27 +02:00
1 parent 62f81a60d7
commit 9073b2ca39
2 files changed
+6 -6

No files matched your search

+3 -3
View File
@@ -757,7 +757,7 @@ class basic_json
/// assignment /// assignment
type_data_t& operator=(value_t rhs) type_data_t& operator=(value_t rhs)
{ {
bits.type = static_cast<uint16_t>(rhs); bits.type = static_cast<uint16_t>(rhs) & 15; // avoid overflow
return *this; return *this;
} }
@@ -765,7 +765,7 @@ class basic_json
type_data_t(value_t t) noexcept type_data_t(value_t t) noexcept
{ {
*reinterpret_cast<uint16_t*>(this) = 0; *reinterpret_cast<uint16_t*>(this) = 0;
bits.type = static_cast<uint16_t>(t); bits.type = static_cast<uint16_t>(t) & 15; // avoid overflow
} }
/// default constructor /// default constructor
@@ -6082,7 +6082,7 @@ class basic_json
{ {
return (v < 10) return (v < 10)
? ('0' + static_cast<char>(v)) ? ('0' + static_cast<char>(v))
: ('a' + static_cast<char>(v - 10)); : ('a' + static_cast<char>((v - 10) & 0xff));
}; };
// print character c as \uxxxx // print character c as \uxxxx
+3 -3
View File
@@ -757,7 +757,7 @@ class basic_json
/// assignment /// assignment
type_data_t& operator=(value_t rhs) type_data_t& operator=(value_t rhs)
{ {
bits.type = static_cast<uint16_t>(rhs); bits.type = static_cast<uint16_t>(rhs) & 15; // avoid overflow
return *this; return *this;
} }
@@ -765,7 +765,7 @@ class basic_json
type_data_t(value_t t) noexcept type_data_t(value_t t) noexcept
{ {
*reinterpret_cast<uint16_t*>(this) = 0; *reinterpret_cast<uint16_t*>(this) = 0;
bits.type = static_cast<uint16_t>(t); bits.type = static_cast<uint16_t>(t) & 15; // avoid overflow
} }
/// default constructor /// default constructor
@@ -6082,7 +6082,7 @@ class basic_json
{ {
return (v < 10) return (v < 10)
? ('0' + static_cast<char>(v)) ? ('0' + static_cast<char>(v))
: ('a' + static_cast<char>(v - 10)); : ('a' + static_cast<char>((v - 10) & 0xff));
}; };
// print character c as \uxxxx // print character c as \uxxxx