Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions include/msgpack/adaptor/int.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ namespace detail {

template <typename T>
struct convert_integer_sign<T, true> {
static inline T convert(msgpack::object const& o) {
static T convert(msgpack::object const& o) {
if(o.type == msgpack::type::POSITIVE_INTEGER) {
if(o.via.u64 > static_cast<uint64_t>(std::numeric_limits<T>::max()))
{ throw msgpack::type_error(); }
Expand All @@ -43,7 +43,7 @@ namespace detail {

template <typename T>
struct convert_integer_sign<T, false> {
static inline T convert(msgpack::object const& o) {
static T convert(msgpack::object const& o) {
if(o.type == msgpack::type::POSITIVE_INTEGER) {
if(o.via.u64 > static_cast<uint64_t>(std::numeric_limits<T>::max()))
{ throw msgpack::type_error(); }
Expand All @@ -69,7 +69,9 @@ namespace detail {

template <>
struct object_char_sign<true> {
static inline void make(msgpack::object& o, char v) {
template <typename T>
static typename msgpack::enable_if<msgpack::is_same<T, char>::value>::type
make(msgpack::object& o, T v) {
if (v < 0) {
o.type = msgpack::type::NEGATIVE_INTEGER;
o.via.i64 = v;
Expand All @@ -83,7 +85,7 @@ namespace detail {

template <>
struct object_char_sign<false> {
static inline void make(msgpack::object& o, char v) {
static void make(msgpack::object& o, char v) {
o.type = msgpack::type::POSITIVE_INTEGER, o.via.u64 = v;
}
};
Expand Down