diff options
| author | Christoph Berg <myon@debian.org> | 2026-09-26 23:24:28 +0200 |
|---|---|---|
| committer | Christoph Berg <myon@debian.org> | 2026-09-26 23:24:28 +0200 |
| commit | 69344560ea394c06ca94acac46a2e4c3e8b7b229 (patch) | |
| tree | ebc98370a697a9bbd6b973a14fa5113c475c6db7 /Radio.cpp | |
| parent | 3e9d10a67671d0bd5c7b8c3ca8088f1818322eff (diff) | |
| parent | 059831534c7e884f0a607ed86b582fd00d821731 (diff) | |
Update upstream source from tag 'upstream/3.2.0_rc1+dfsg'
Update to upstream version '3.2.0~rc1+dfsg'
with Debian dir dbff457fd2c3616d5c77b863c7bfb2186ed86047
Diffstat (limited to 'Radio.cpp')
| -rw-r--r-- | Radio.cpp | 21 |
1 files changed, 8 insertions, 13 deletions
@@ -52,19 +52,14 @@ namespace Radio Frequency frequency (double value, int scale, bool * ok) { value *= std::pow (10., scale); - if (ok) + auto const exclusive_frequency_limit = std::ldexp (1., std::numeric_limits<Frequency>::digits); + auto const valid = std::isfinite (value) && value >= 0. && value < exclusive_frequency_limit; + if (ok) *ok = valid; + if (!valid) { - if (value < 0. || value > static_cast<double>(std::numeric_limits<Frequency>::max ())) - { - value = 0.; - *ok = false; - } - else - { - *ok = true; - } + return 0; } - return std::llround (value); + return static_cast<Frequency> (std::round (value)); } FrequencyDelta frequency_delta (QVariant const& v, int scale, bool * ok, QLocale const& locale) @@ -91,8 +86,8 @@ namespace Radio value *= std::pow (10., scale); if (ok) { - if (value < static_cast<double>(std::numeric_limits<Frequency>::min ()) - || value > static_cast<double>(std::numeric_limits<Frequency>::max ())) + if (value < static_cast<double>(std::numeric_limits<FrequencyDelta>::min ()) + || value > static_cast<double>(std::numeric_limits<FrequencyDelta>::max ())) { value = 0.; *ok = false; |
