code: Small cleanups and fixes to lambda captures (#6191)
Co-authored-by: v1993 <v19930312@gmail.com> Co-authored-by: Morph <39850852+Morph1984@users.noreply.github.com>
This commit is contained in:
@@ -76,10 +76,12 @@ void CSpinBox::stepBy(int steps) {
|
||||
}*/
|
||||
|
||||
// Increment "new_value" by "steps", and perform annoying overflow checks, too.
|
||||
if (steps < 0 && new_value + steps > new_value) {
|
||||
new_value = std::numeric_limits<qint64>::min();
|
||||
} else if (steps > 0 && new_value + steps < new_value) {
|
||||
new_value = std::numeric_limits<qint64>::max();
|
||||
constexpr qint64 qint64_min = std::numeric_limits<qint64>::min();
|
||||
constexpr qint64 qint64_max = std::numeric_limits<qint64>::max();
|
||||
if (steps < 0 && new_value < qint64_min - steps) {
|
||||
new_value = qint64_min;
|
||||
} else if (steps > 0 && new_value > qint64_max - steps) {
|
||||
new_value = qint64_max;
|
||||
} else {
|
||||
new_value += steps;
|
||||
}
|
||||
|
Reference in New Issue
Block a user