mirror of
https://github.com/cookiengineer/audacity
synced 2025-05-05 14:18:53 +02:00
Use std::numeric_limits<...>::lowest...
... not the negation of max(), which is wrong for unsigned types, and not min(), which gives least normalized positive value for floating point types. lowest() wasn't available before C++11.
This commit is contained in:
parent
e456b53344
commit
7ab97c969c
@ -552,8 +552,7 @@ struct IteratorRange : public std::pair<Iterator, Iterator> {
|
||||
R max( Unary unary_op = {} ) const
|
||||
{
|
||||
return this->accumulate(
|
||||
-std::numeric_limits< R >::max(),
|
||||
// std::numeric_limits< R >::lowest(), // TODO C++11
|
||||
std::numeric_limits< R >::lowest(),
|
||||
(const R&(*)(const R&, const R&)) std::max,
|
||||
unary_op
|
||||
);
|
||||
|
@ -1940,7 +1940,7 @@ void AudacityProject::FixScrollbars()
|
||||
panelHeight = 0;
|
||||
}
|
||||
|
||||
auto LastTime = -std::numeric_limits<double>::max();
|
||||
auto LastTime = std::numeric_limits<double>::lowest();
|
||||
auto &tracks = *GetTracks();
|
||||
for (const Track *track : tracks) {
|
||||
// Iterate over pending changed tracks if present.
|
||||
|
@ -174,7 +174,7 @@ public:
|
||||
void SetMin(ValueType min)
|
||||
{
|
||||
this->DoSetMin(min);
|
||||
BaseValidator::m_minSet = (min != std::numeric_limits<T>::min());
|
||||
BaseValidator::m_minSet = (min != std::numeric_limits<T>::lowest());
|
||||
}
|
||||
|
||||
void SetMax(ValueType max)
|
||||
@ -461,7 +461,7 @@ public:
|
||||
FloatingPointValidator(int precision,
|
||||
ValueType *value = NULL,
|
||||
NumValidatorStyle style = NumValidatorStyle::DEFAULT,
|
||||
ValueType min = -std::numeric_limits<ValueType>::max(),
|
||||
ValueType min = std::numeric_limits<ValueType>::lowest(),
|
||||
ValueType max = std::numeric_limits<ValueType>::max())
|
||||
: Base(value, style)
|
||||
{
|
||||
@ -482,7 +482,7 @@ private:
|
||||
// NB: Do not use min(), it's not the smallest representable value for
|
||||
// the floating point types but rather the smallest representable
|
||||
// positive value.
|
||||
this->DoSetMin(-std::numeric_limits<ValueType>::max());
|
||||
this->DoSetMin( std::numeric_limits<ValueType>::lowest());
|
||||
this->DoSetMax( std::numeric_limits<ValueType>::max());
|
||||
}
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user