Browse Source

fix some MSVC warnings

JSON-23
Roker 5 years ago
parent
commit
52019569e2
2 changed files with 16 additions and 4 deletions
  1. +14
    -2
      server/function_map.cc
  2. +2
    -2
      server/registry.cc

+ 14
- 2
server/function_map.cc View File

@ -88,7 +88,13 @@ bool from_json<bool>(const js::Value& v)
template<> \
TYPE from_json<TYPE>(const js::Value& v) \
{ \
return v.get_uint64(); \
const auto u = v.get_uint64(); \
if(u>std::numeric_limits<TYPE>::max()) \
{ \
throw std::runtime_error("Cannot convert " + std::to_string(u) + " into type " + typeid(TYPE).name() ); \
} \
\
return static_cast<TYPE>(u); \
} \
\
template<> \
@ -106,7 +112,13 @@ FROM_TO_JSON_UINT64( unsigned long long )
template<> \
TYPE from_json<TYPE>(const js::Value& v) \
{ \
return v.get_int64(); \
const auto u = v.get_int64(); \
if( u > std::numeric_limits<TYPE>::max() || u < std::numeric_limits<TYP>::min() ) \
{ \
throw std::runtime_error("Cannot convert " + std::to_string(u) + " into type " + typeid(TYPE).name() ); \
} \
\
return static_cast<TYPE>(u); \
} \
\
template<> \


+ 2
- 2
server/registry.cc View File

@ -101,8 +101,8 @@ unsigned test_joggle()
uint64_t counter = 0;
for(uint64_t realm = 100; realm < 0xAAAA000011117777; realm = realm*1.123)
for(uint64_t u = 0; u < 0x9999ffff00009999; u*=1.171)
for(uint64_t realm = 100; realm < 0xAAAA000011117777; realm = uint64_t(realm*1.123))
for(uint64_t u = 0; u < 0x9999ffff00009999; u = uint64_t(u*1.171+1))
{
++counter;
const uint64_t j = joggle( realm, u );


Loading…
Cancel
Save