mirror of
https://github.com/msgpack/msgpack-c.git
synced 2025-04-01 09:24:51 +02:00
cpp: fixes some implicit cast warnings
This commit is contained in:
parent
d1264a1289
commit
67ab510b5d
@ -55,7 +55,7 @@ if test "$msgpack_cv_atomic_ops" != "yes"; then
|
|||||||
Note that gcc < 4.1 is not supported.
|
Note that gcc < 4.1 is not supported.
|
||||||
|
|
||||||
If you are using gcc >= 4.1 and the default target CPU architecture is "i386", try to
|
If you are using gcc >= 4.1 and the default target CPU architecture is "i386", try to
|
||||||
add CFLAGS="--march=i686" and CXXFLAGS="-march=i686" options to ./configure as follows:
|
add CFLAGS="-march=i686" and CXXFLAGS="-march=i686" options to ./configure as follows:
|
||||||
|
|
||||||
$ ./configure CFLAGS="-march=i686" CXXFLAGS="-march=i686"
|
$ ./configure CFLAGS="-march=i686" CXXFLAGS="-march=i686"
|
||||||
])
|
])
|
||||||
|
@ -30,7 +30,7 @@ namespace msgpack {
|
|||||||
inline float& operator>> (object o, float& v)
|
inline float& operator>> (object o, float& v)
|
||||||
{
|
{
|
||||||
if(o.type != type::DOUBLE) { throw type_error(); }
|
if(o.type != type::DOUBLE) { throw type_error(); }
|
||||||
v = o.via.dec;
|
v = (float)o.via.dec;
|
||||||
return v;
|
return v;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -60,7 +60,7 @@ inline packer<Stream>& operator<< (packer<Stream>& o, const double& v)
|
|||||||
inline void operator<< (object& o, float v)
|
inline void operator<< (object& o, float v)
|
||||||
{
|
{
|
||||||
o.type = type::DOUBLE;
|
o.type = type::DOUBLE;
|
||||||
o.via.dec = v;
|
o.via.dec = (double)v;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void operator<< (object& o, double v)
|
inline void operator<< (object& o, double v)
|
||||||
|
@ -35,11 +35,11 @@ namespace detail {
|
|||||||
if(o.type == type::POSITIVE_INTEGER) {
|
if(o.type == type::POSITIVE_INTEGER) {
|
||||||
if(o.via.u64 > (uint64_t)std::numeric_limits<T>::max())
|
if(o.via.u64 > (uint64_t)std::numeric_limits<T>::max())
|
||||||
{ throw type_error(); }
|
{ throw type_error(); }
|
||||||
return o.via.u64;
|
return (T)o.via.u64;
|
||||||
} else if(o.type == type::NEGATIVE_INTEGER) {
|
} else if(o.type == type::NEGATIVE_INTEGER) {
|
||||||
if(o.via.i64 < (int64_t)std::numeric_limits<T>::min())
|
if(o.via.i64 < (int64_t)std::numeric_limits<T>::min())
|
||||||
{ throw type_error(); }
|
{ throw type_error(); }
|
||||||
return o.via.i64;
|
return (T)o.via.i64;
|
||||||
}
|
}
|
||||||
throw type_error();
|
throw type_error();
|
||||||
}
|
}
|
||||||
@ -51,7 +51,7 @@ namespace detail {
|
|||||||
if(o.type == type::POSITIVE_INTEGER) {
|
if(o.type == type::POSITIVE_INTEGER) {
|
||||||
if(o.via.u64 > (uint64_t)std::numeric_limits<T>::max())
|
if(o.via.u64 > (uint64_t)std::numeric_limits<T>::max())
|
||||||
{ throw type_error(); }
|
{ throw type_error(); }
|
||||||
return o.via.u64;
|
return (T)o.via.u64;
|
||||||
}
|
}
|
||||||
throw type_error();
|
throw type_error();
|
||||||
}
|
}
|
||||||
|
@ -164,7 +164,7 @@ void msgpack_object_print(FILE* out, msgpack_object o)
|
|||||||
|
|
||||||
default:
|
default:
|
||||||
// FIXME
|
// FIXME
|
||||||
fprintf(out, "#<UNKNOWN %hu %"PRIu64">", o.type, o.via.u64);
|
fprintf(out, "#<UNKNOWN %i %"PRIu64">", o.type, o.via.u64);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user