mirror of
https://github.com/pocoproject/poco.git
synced 2025-07-04 17:40:01 +02:00
fix some warnings
This commit is contained in:
parent
5de43daf38
commit
1101439eb0
@ -398,20 +398,36 @@ protected:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
template <typename F, typename T>
|
template <typename F, typename T>
|
||||||
void POCO_UNUSED checkUpperLimit(const F& from) const
|
void POCO_UNUSED checkUpperLimit(const F& from) const
|
||||||
{
|
|
||||||
if ((sizeof(T) < sizeof(F)) &&
|
|
||||||
(from > static_cast<F>(std::numeric_limits<T>::max())))
|
|
||||||
{
|
{
|
||||||
throw RangeException("Value too large.");
|
// casting to type of smaller size AND
|
||||||
|
// 'from' is greater than 'T' max value
|
||||||
|
if ((sizeof(T) < sizeof(F)) &&
|
||||||
|
(from > static_cast<F>(std::numeric_limits<T>::max())))
|
||||||
|
{
|
||||||
|
throw RangeException("Value too large.");
|
||||||
|
}
|
||||||
|
// casting to type of equal/bigger size AND
|
||||||
|
// 'F' is signed AND
|
||||||
|
// 'T' is unsigned AND
|
||||||
|
// 'from' is negative
|
||||||
|
else if (std::numeric_limits<F>::is_signed &&
|
||||||
|
!std::numeric_limits<T>::is_signed && from < 0)
|
||||||
|
{
|
||||||
|
throw RangeException("Value too small.");
|
||||||
|
}
|
||||||
|
// casting to type of equal/bigger size AND
|
||||||
|
// 'F' is unsigned AND
|
||||||
|
// 'T' is signed AND
|
||||||
|
// 'from' is greater than 'T' max value
|
||||||
|
else if (!std::numeric_limits<F>::is_signed &&
|
||||||
|
std::numeric_limits<T>::is_signed &&
|
||||||
|
static_cast<Poco::UInt64>(from) > std::numeric_limits<T>::max())
|
||||||
|
{
|
||||||
|
throw RangeException("Value too large.");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
|
||||||
if (from > std::numeric_limits<T>::max())
|
|
||||||
{
|
|
||||||
throw RangeException("Value too large.");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
template <typename F, typename T>
|
template <typename F, typename T>
|
||||||
|
@ -79,9 +79,10 @@ namespace
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
NonDefaultConstructible operator=(int val)
|
NonDefaultConstructible& operator=(int val)
|
||||||
{
|
{
|
||||||
_val = val;
|
_val = val;
|
||||||
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool operator == (const NonDefaultConstructible& other) const
|
bool operator == (const NonDefaultConstructible& other) const
|
||||||
|
Loading…
x
Reference in New Issue
Block a user