Clang warnings (QtC) static_cast

This commit is contained in:
Klaus Basan
2019-07-23 18:53:52 +02:00
committed by Mat Sutcliffe
parent 6cb5478c5c
commit 9b424d7287
3 changed files with 13 additions and 15 deletions

View File

@@ -47,21 +47,21 @@ namespace BlackSimPlugin
const int s = callsigns.size();
if (s != latitudesDeg.size()) { return false; }
if (s != longitudesDeg.size()) { return false; }
if (s != altitudesFt.size()) { return false; }
if (s != altitudesFt.size()) { return false; }
if (s != pitchesDeg.size()) { return false; }
if (s != rollsDeg.size()) { return false; }
if (s != headingsDeg.size()) { return false; }
return true;
}
QStringList callsigns; //!< List of callsigns
QStringList callsigns; //!< List of callsigns
QList<double> latitudesDeg; //!< List of latitudes
QList<double> longitudesDeg; //!< List of longitudes
QList<double> altitudesFt; //!< List of altitudes
QList<double> altitudesFt; //!< List of altitudes
QList<double> pitchesDeg; //!< List of pitches
QList<double> rollsDeg; //!< List of rolls
QList<double> headingsDeg; //!< List of headings
QList<bool> onGrounds; //!< List of onGrounds
QList<bool> onGrounds; //!< List of onGrounds
};
//! Planes surfaces

View File

@@ -53,11 +53,11 @@ namespace XSwiftBus
{
if (text.empty()) { return; }
static const std::string ellipsis = u8"\u2026";
const int lineLength = static_cast<int>(m_messages.maxLineLength() - ellipsis.size());
const int lineLength = m_messages.maxLineLength() - static_cast<int>(ellipsis.size());
std::vector<std::string> wrappedLines;
for (size_t i = 0; i < text.size(); i += lineLength)
for (size_t i = 0; i < text.size(); i += static_cast<size_t>(lineLength))
{
wrappedLines.push_back(text.substr(i, lineLength) + ellipsis);
wrappedLines.push_back(text.substr(i, static_cast<size_t>(lineLength)) + ellipsis);
}
wrappedLines.back().erase(wrappedLines.back().size() - 3);
if (wrappedLines.back().empty()) { wrappedLines.pop_back(); }
@@ -199,7 +199,7 @@ namespace XSwiftBus
static const char *introspection_service =
DBUS_INTROSPECT_1_0_XML_DOCTYPE_DECL_NODE
#include "org.swift_project.xswiftbus.service.xml"
#include "org.swift_project.xswiftbus.service.xml"
;
DBusHandlerResult CService::dbusMessageHandler(const CDBusMessage &message_)
@@ -715,10 +715,9 @@ namespace XSwiftBus
number = std::min(static_cast<int>(m_airports.size()), number);
auto closestAirports = m_airports;
std::vector<CNavDataReference> closestAirports = m_airports;
std::partial_sort(closestAirports.begin(), closestAirports.begin() + number, closestAirports.end(), compareFunction);
closestAirports.resize(number);
closestAirports.resize(static_cast<std::vector<CNavDataReference>::size_type>(number));
return closestAirports;
}
}

View File

@@ -30,7 +30,6 @@
namespace XSwiftBus
{
/*!
* XSwiftBus service object which is accessible through DBus
*/
@@ -214,9 +213,9 @@ namespace XSwiftBus
std::vector<double> getEngineN1Percentage() const
{
std::vector<double> list;
const auto number = static_cast<unsigned int>(getNumberOfEngines());
list.reserve(number);
for (unsigned int engineNumber = 0; engineNumber < number; ++engineNumber)
const int number = getNumberOfEngines();
list.reserve(static_cast<std::vector<double>::size_type>(number));
for (int engineNumber = 0; engineNumber < number; ++engineNumber)
{
list.push_back(m_enginesN1Percentage.getAt(engineNumber));
}