refactor: Fix readability-use-std-min-max

This commit is contained in:
Lars Toenning
2025-10-25 15:49:22 +02:00
parent 369450107b
commit 8a877e85b7
15 changed files with 23 additions and 23 deletions

View File

@@ -93,7 +93,7 @@ namespace swift::misc::network
for (const CUrlLog &rl : *this)
{
if (rl.isPending()) { continue; }
if (rl.getResponseTimeMs() > max) { max = rl.getResponseTimeMs(); }
max = std::max(rl.getResponseTimeMs(), max);
}
return max;
}
@@ -105,7 +105,7 @@ namespace swift::misc::network
for (const CUrlLog &rl : *this)
{
if (rl.isPending()) { continue; }
if (rl.getResponseTimeMs() < min) { min = rl.getResponseTimeMs(); }
min = std::min(rl.getResponseTimeMs(), min);
}
return min;
}

View File

@@ -63,7 +63,7 @@ namespace swift::misc::simulation::settings
int freqRgb, int privRgb, int servRgb, int statRgb, int supRgb)
{
if (topPx >= 0) { bottomPx = -1; }
if (lines < 3) { lines = 3; }
lines = std::max(lines, 3);
this->setMessageBoxValues(
std::to_string(leftPx) + ";" + std::to_string(topPx) + ";" + std::to_string(rightPx) + ";" +
std::to_string(bottomPx) + ";" + std::to_string(lines) + ";" + std::to_string(durationMs) + ";" +

View File

@@ -105,7 +105,7 @@ namespace swift::misc::simulation
const qint64 deltaMs = now - startedMs;
m_pendingElevationRequests.remove(requestedForCallsign);
m_statsCurrentElevRequestTimeMs = deltaMs;
if (m_statsMaxElevRequestTimeMs < deltaMs) { m_statsMaxElevRequestTimeMs = deltaMs; }
m_statsMaxElevRequestTimeMs = std::max(m_statsMaxElevRequestTimeMs, deltaMs);
}
}
return true;

View File

@@ -187,7 +187,7 @@ namespace swift::misc
if (msg.isEmpty()) { continue; }
newMsgs.append(msg.getMessage());
CStatusMessage::StatusSeverity ms = msg.getSeverity();
if (s < ms) { s = ms; }
s = std::max(s, ms);
cats.push_back(msg.getCategories());
}
const CStatusMessage newMsg(cats, s, newMsgs.join(", "));

View File

@@ -6,6 +6,8 @@
#ifndef SWIFT_MISC_TIMESTAMPOBJECTLIST_H
#define SWIFT_MISC_TIMESTAMPOBJECTLIST_H
#include <algorithm>
#include <QtGlobal>
#include "config/buildconfig.h"
@@ -382,8 +384,8 @@ namespace swift::misc
const ITimestampBased &l = last;
const ITimestampBased &o = object;
const qint64 diff = l.getAbsTimeDifferenceMs(o);
if (diff > mmm.max) { mmm.max = diff; }
if (diff < mmm.min) { mmm.min = diff; }
mmm.max = std::max(diff, mmm.max);
mmm.min = std::min(diff, mmm.min);
mean += diff;
}
c++;
@@ -722,8 +724,8 @@ namespace swift::misc
{
if (!object.hasNonZeroOffsetTime()) { continue; }
const qint64 os = object.getTimeOffsetMs();
if (os > mmm.max) { mmm.max = os; }
if (os < mmm.min) { mmm.min = os; }
mmm.max = std::max(os, mmm.max);
mmm.min = std::min(os, mmm.min);
mean += os;
c++;
}