Fix implicit-const-int-float-conversion error (by JG1UAA)

This commit is contained in:
Uwe Risse 2022-02-11 11:00:21 +01:00
parent 2e3cec2201
commit 2545103ba5
3 changed files with 6 additions and 6 deletions

View File

@ -54,7 +54,7 @@ namespace Radio
value *= std::pow (10., scale);
if (ok)
{
if (value < 0. || value > std::numeric_limits<Frequency>::max ())
if (value < 0. || value > static_cast<double>(std::numeric_limits<Frequency>::max ()))
{
value = 0.;
*ok = false;
@ -91,8 +91,8 @@ namespace Radio
value *= std::pow (10., scale);
if (ok)
{
if (value < -std::numeric_limits<Frequency>::max ()
|| value > std::numeric_limits<Frequency>::max ())
if (value < static_cast<double>(std::numeric_limits<Frequency>::min ())
|| value > static_cast<double>(std::numeric_limits<Frequency>::max ()))
{
value = 0.;
*ok = false;

View File

@ -39,8 +39,8 @@ namespace
FrequencyDeltaLineEdit::FrequencyDeltaLineEdit (QWidget * parent)
: QLineEdit (parent)
{
setValidator (new MHzValidator {-std::numeric_limits<FrequencyDelta>::max () / 10.e6,
std::numeric_limits<FrequencyDelta>::max () / 10.e6, this});
setValidator (new MHzValidator {static_cast<double>(std::numeric_limits<FrequencyDelta>::min ()) / 10.e6,
static_cast<double>(std::numeric_limits<FrequencyDelta>::max ()) / 10.e6, this});
}
auto FrequencyDeltaLineEdit::frequency_delta () const -> FrequencyDelta

View File

@ -39,7 +39,7 @@ namespace
FrequencyLineEdit::FrequencyLineEdit (QWidget * parent)
: QLineEdit (parent)
{
setValidator (new MHzValidator {0., std::numeric_limits<Radio::Frequency>::max () / 10.e6, this});
setValidator (new MHzValidator {0., static_cast<double>(std::numeric_limits<Radio::Frequency>::max ()) / 10.e6, this});
}
auto FrequencyLineEdit::frequency () const -> Frequency