Skip to content

Commit

Permalink
fix(VarHolder): limits check
Browse files Browse the repository at this point in the history
  • Loading branch information
aleks-f committed Jun 27, 2022
1 parent 309aff3 commit c377807
Showing 1 changed file with 7 additions and 15 deletions.
22 changes: 7 additions & 15 deletions Foundation/include/Poco/Dynamic/VarHolder.h
Original file line number Diff line number Diff line change
Expand Up @@ -410,16 +410,15 @@ class Foundation_API VarHolder
template <typename F, typename T>
void checkUpperLimit(const F& from) const
{
if ((sizeof(T) < sizeof(F)) &&
(from > static_cast<F>(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>
void checkLowerLimit(const F& from) const
{
if (from < std::numeric_limits<T>::min())
throw RangeException("Value too small.");
}

template <typename F, typename T>
Expand Down Expand Up @@ -453,13 +452,6 @@ class Foundation_API VarHolder
throw RangeException("Value too small.");
}
}

template <typename F, typename T>
void checkLowerLimit(const F& from) const
{
if (from < std::numeric_limits<T>::min())
throw RangeException("Value too small.");
}
};


Expand Down

0 comments on commit c377807

Please sign in to comment.