mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-31 12:55:33 +08:00
refactor: Fix readability-simplify-boolean-expr
This commit is contained in:
@@ -280,8 +280,7 @@ namespace swift::misc::aviation
|
||||
// allow 2 chars for special codes like "VV"
|
||||
if (airline.length() < 2 || airline.length() > 5) { return false; }
|
||||
const auto chars = makeRange(airline.begin(), airline.end());
|
||||
if (chars.containsBy([](QChar c) { return !c.isUpper() && !c.isDigit(); })) { return false; }
|
||||
return true;
|
||||
return !chars.containsBy([](QChar c) { return !c.isUpper() && !c.isDigit(); });
|
||||
}
|
||||
|
||||
bool CAirlineIcaoCode::isValidIataCode(const QString &iataCode)
|
||||
|
||||
@@ -294,7 +294,7 @@ namespace swift::misc::aviation
|
||||
if (msgs) { msgs->push_back(CStatusMessage(this).validationError(u"Altitude NULL value")); }
|
||||
return false;
|
||||
}
|
||||
if (!(this->getReferenceDatum() == FlightLevel || this->getReferenceDatum() == MeanSeaLevel))
|
||||
if (this->getReferenceDatum() != FlightLevel && this->getReferenceDatum() != MeanSeaLevel)
|
||||
{
|
||||
if (msgs) { msgs->push_back(CStatusMessage(this).validationError(u"Altitude, must be FL or MSL")); }
|
||||
return false;
|
||||
|
||||
@@ -265,8 +265,7 @@ namespace swift::misc::network
|
||||
bool CNetworkUtils::looksLikePhpErrorMessage(const QString &errorMessage)
|
||||
{
|
||||
if (errorMessage.length() < 50) { return false; }
|
||||
if (errorMessage.contains("xdebug", Qt::CaseInsensitive)) { return true; }
|
||||
return false;
|
||||
return errorMessage.contains("xdebug", Qt::CaseInsensitive);
|
||||
}
|
||||
|
||||
const QString &CNetworkUtils::networkOperationToString(QNetworkAccessManager::Operation operation)
|
||||
|
||||
@@ -113,13 +113,11 @@ namespace swift::misc::network
|
||||
if (this->getSenderCallsign() != textMessage.getSenderCallsign()) { return false; }
|
||||
if (this->isRadioMessage() && textMessage.isRadioMessage())
|
||||
{
|
||||
if (this->getFrequency() != textMessage.getFrequency()) { return false; }
|
||||
return true;
|
||||
return this->getFrequency() == textMessage.getFrequency();
|
||||
}
|
||||
else if (this->isPrivateMessage() && textMessage.isPrivateMessage())
|
||||
{
|
||||
if (this->getRecipientCallsign() != textMessage.getRecipientCallsign()) { return false; }
|
||||
return true;
|
||||
return this->getRecipientCallsign() == textMessage.getRecipientCallsign();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -32,10 +32,7 @@ namespace swift::misc::simulation::fscommon
|
||||
quint32 remainder = 0, quotient = 0, result = 0;
|
||||
remainder = num % divider;
|
||||
quotient = num / divider;
|
||||
if (!(quotient == 0 && remainder == 0))
|
||||
{
|
||||
result += hornerScheme(quotient, divider, factor) * factor + remainder;
|
||||
}
|
||||
if (quotient != 0 || remainder != 0) { result += hornerScheme(quotient, divider, factor) * factor + remainder; }
|
||||
return result;
|
||||
}
|
||||
} // namespace swift::misc::simulation::fscommon
|
||||
|
||||
@@ -390,7 +390,7 @@ namespace swift::misc
|
||||
auto object = json.object();
|
||||
json.setObject(it->mergeToMemoizedJson(object));
|
||||
|
||||
if (!(file.seek(0) && file.resize(0) && file.write(json.toJson()) > 0 && file.checkedClose()))
|
||||
if (!file.seek(0) || !file.resize(0) || file.write(json.toJson()) <= 0 || !file.checkedClose())
|
||||
{
|
||||
return CStatusMessage(this).error(u"Failed to write to %1: %2")
|
||||
<< file.fileName() << file.errorString();
|
||||
|
||||
Reference in New Issue
Block a user