mirror of
https://github.com/XRPLF/rippled.git
synced 2025-12-06 17:27:55 +00:00
Fix some warnings
This commit is contained in:
@@ -1313,14 +1313,6 @@ UPTR_T<STObject> STObject::parseJson (const Json::Value& object, SField::ref inN
|
||||
}
|
||||
else if (value.isInt ())
|
||||
{
|
||||
// VFALCO NOTE value.asInt() returns an int, which can never be greater than 7fffffff, but we
|
||||
// are checking to make sure it is not greater than ffffffff, which can never be
|
||||
// less than any 32 bit value (signed or unsigned).
|
||||
//
|
||||
// It seems this line only cares that value.asInt () is not negative, can someone
|
||||
// confirm this?
|
||||
//
|
||||
#pragma message(BEAST_FILEANDLINE_ "Invalid signed/unsigned comparison")
|
||||
data.push_back (new STUInt32 (field, range_check_cast <uint32> (value.asInt (), 0u, 4294967295u)));
|
||||
}
|
||||
else if (value.isUInt ())
|
||||
|
||||
@@ -260,6 +260,26 @@ public:
|
||||
}
|
||||
|
||||
private:
|
||||
/** Returns a value or throws if out of range.
|
||||
|
||||
This will throw if the source value cannot be represented
|
||||
within the destination type.
|
||||
*/
|
||||
// VFALCO NOTE This won't work right
|
||||
/*
|
||||
template <class T, class U>
|
||||
static T getWithRangeCheck (U v)
|
||||
{
|
||||
if (v < std::numeric_limits <T>::min ()) ||
|
||||
v > std::numeric_limits <T>::max ())
|
||||
{
|
||||
throw std::runtime_error ("Value out of range");
|
||||
}
|
||||
|
||||
return static_cast <T> (v);
|
||||
}
|
||||
*/
|
||||
|
||||
// VFALCO TODO these parameters should not be const references.
|
||||
template <typename T, typename U>
|
||||
static T range_check_cast (const U& value, const T& minimum, const T& maximum)
|
||||
|
||||
Reference in New Issue
Block a user