mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-22 14:55:36 +08:00
refs #800 Fixed some implicit conversion warnings.
This commit is contained in:
committed by
Klaus Basan
parent
461474e29d
commit
5791de6860
@@ -38,9 +38,9 @@ namespace BlackSample
|
||||
{
|
||||
// ATC station
|
||||
QDateTime dtFrom = QDateTime::currentDateTimeUtc();
|
||||
QDateTime dtUntil = dtFrom.addSecs(60 * 60.0); // 1 hour
|
||||
QDateTime dtUntil = dtFrom.addSecs(60 * 60); // 1 hour
|
||||
QDateTime dtFrom2 = dtUntil;
|
||||
QDateTime dtUntil2 = dtUntil.addSecs(60 * 60.0);
|
||||
QDateTime dtUntil2 = dtUntil.addSecs(60 * 60);
|
||||
CCoordinateGeodetic geoPos = CCoordinateGeodetic::fromWgs84("48° 21′ 13″ N", "11° 47′ 09″ E", CLength(1487, CLengthUnit::ft()));
|
||||
CAtcStation station1(CCallsign("eddm_twr"), CUser("123456", "Joe Doe"),
|
||||
CFrequency(118.7, CFrequencyUnit::MHz()),
|
||||
|
||||
@@ -42,9 +42,9 @@ namespace BlackSample
|
||||
{
|
||||
// ATC stations
|
||||
QDateTime dtFrom = QDateTime::currentDateTimeUtc();
|
||||
QDateTime dtUntil = dtFrom.addSecs(60 * 60.0); // 1 hour
|
||||
QDateTime dtUntil = dtFrom.addSecs(60 * 60); // 1 hour
|
||||
QDateTime dtFrom2 = dtUntil;
|
||||
QDateTime dtUntil2 = dtUntil.addSecs(60 * 60.0);
|
||||
QDateTime dtUntil2 = dtUntil.addSecs(60 * 60);
|
||||
CFrequency freqEddmTwr(118.7, CFrequencyUnit::MHz());
|
||||
CCallsign callsignEddmTwr("eddm_twr");
|
||||
CCoordinateGeodetic geoPos =
|
||||
|
||||
@@ -62,7 +62,7 @@ namespace BlackSample
|
||||
qDebug() << json << l;
|
||||
qDebug() << "-------";
|
||||
QDateTime dtFrom = QDateTime::currentDateTimeUtc();
|
||||
QDateTime dtUntil = dtFrom.addSecs(60 * 60.0); // 1 hour
|
||||
QDateTime dtUntil = dtFrom.addSecs(60 * 60); // 1 hour
|
||||
CCoordinateGeodetic geoPos = CCoordinateGeodetic::fromWgs84("48° 21′ 13″ N", "11° 47′ 09″ E", CLength(1487, CLengthUnit::ft()));
|
||||
CAtcStation station(CCallsign("eddm_twr"), CUser("123456", "Joe Doe"),
|
||||
CFrequency(118.7, CFrequencyUnit::MHz()), geoPos, CLength(50, CLengthUnit::km()), false, dtFrom, dtUntil);
|
||||
|
||||
@@ -555,7 +555,7 @@ namespace BlackSample
|
||||
timer.restart();
|
||||
CAircraftCfgEntriesList entriesList = testserviceInterface.getAircraftCfgEntriesList(5000);
|
||||
if (entriesList.size() != 5000) qDebug() << "wrong list size" << entriesList.size();
|
||||
int t5000 = timer.nsecsElapsed() / 1000000; // ms
|
||||
qint64 t5000 = timer.nsecsElapsed() / 1000000; // ms
|
||||
qDebug() << "Reading aircraft cfg entries in ms:" << t5000;
|
||||
|
||||
// object paths
|
||||
|
||||
@@ -70,9 +70,9 @@ namespace BlackSample
|
||||
out << callsign1 << " " << callsign2 << " " << (callsign1 == callsign2) << endl;
|
||||
|
||||
QDateTime dtFrom = QDateTime::currentDateTimeUtc();
|
||||
QDateTime dtUntil = dtFrom.addSecs(60 * 60.0); // 1 hour
|
||||
QDateTime dtUntil = dtFrom.addSecs(60 * 60); // 1 hour
|
||||
QDateTime dtFrom2 = dtUntil;
|
||||
QDateTime dtUntil2 = dtUntil.addSecs(60 * 60.0);
|
||||
QDateTime dtUntil2 = dtUntil.addSecs(60 * 60);
|
||||
CCoordinateGeodetic geoPos =
|
||||
CCoordinateGeodetic::fromWgs84("48° 21′ 13″ N", "11° 47′ 09″ E", CLength(1487, CLengthUnit::ft()));
|
||||
CAtcStation station1(CCallsign("eddm_twr"), CUser("123456", "Joe Doe"),
|
||||
|
||||
@@ -155,7 +155,7 @@ namespace BlackCore
|
||||
qint64 currentTimeMsEpoch = QDateTime::currentMSecsSinceEpoch();
|
||||
|
||||
qint64 callDiffMs = currentTimeMsEpoch - m_lastWatchdogCallMsSinceEpoch;
|
||||
qint64 callThresholdMs = m_timer.interval() * 1.5;
|
||||
qint64 callThresholdMs = static_cast<int>(m_timer.interval() * 1.5);
|
||||
m_lastWatchdogCallMsSinceEpoch = currentTimeMsEpoch;
|
||||
|
||||
// this is a trick to not remove everything while debugging
|
||||
|
||||
@@ -66,7 +66,7 @@ namespace BlackGui
|
||||
|
||||
void CSettingsGuiComponent::setGuiOpacity(double value)
|
||||
{
|
||||
ui->hs_SettingsGuiOpacity->setValue(value);
|
||||
ui->hs_SettingsGuiOpacity->setValue(static_cast<int>(value));
|
||||
}
|
||||
|
||||
void CSettingsGuiComponent::ps_fontChanged()
|
||||
|
||||
@@ -40,7 +40,7 @@ namespace BlackMisc
|
||||
template <typename ForwardIt, typename OutputIt, typename Generator>
|
||||
void copyRandomElements(ForwardIt in, ForwardIt end, OutputIt out, int n, Generator &&rng)
|
||||
{
|
||||
for (auto size = std::distance(in, end); in != end && n > 0; ++in, --size)
|
||||
for (auto size = static_cast<int>(std::distance(in, end)); in != end && n > 0; ++in, --size)
|
||||
{
|
||||
if (std::uniform_int_distribution<>(0, size - 1)(rng) < n)
|
||||
{
|
||||
|
||||
@@ -74,7 +74,7 @@ namespace BlackMisc
|
||||
|
||||
void CIcon::setRotation(const PhysicalQuantities::CAngle &rotate)
|
||||
{
|
||||
this->m_rotateDegrees = rotate.valueRounded(PhysicalQuantities::CAngleUnit::deg(), 0);
|
||||
this->m_rotateDegrees = static_cast<int>(rotate.valueRounded(PhysicalQuantities::CAngleUnit::deg(), 0));
|
||||
}
|
||||
|
||||
QString CIcon::convertToQString(bool i18n) const
|
||||
|
||||
@@ -55,7 +55,7 @@ namespace BlackMisc
|
||||
|
||||
if (isModifier()) { return keyStrings.value(m_keyCode); }
|
||||
|
||||
QChar key = QChar::fromLatin1(m_keyCode);
|
||||
QChar key = QChar::fromLatin1(static_cast<char>(m_keyCode));
|
||||
return key;
|
||||
}
|
||||
|
||||
|
||||
@@ -24,9 +24,9 @@ namespace BlackMisc
|
||||
quint32 CBcdConversions::comFrequencyToBcdHz(const BlackMisc::PhysicalQuantities::CFrequency &comFrequency)
|
||||
{
|
||||
// FSX documentation is wrong, we need to use kHz + 2 digits, not Hz
|
||||
quint32 f = comFrequency.valueRounded(CFrequencyUnit::kHz(), 0) / 10;
|
||||
f = dec2Bcd(f);
|
||||
return f;
|
||||
double f = comFrequency.valueRounded(CFrequencyUnit::kHz(), 0) / 10;
|
||||
quint32 fInt = dec2Bcd(static_cast<quint32>(f));
|
||||
return fInt;
|
||||
}
|
||||
|
||||
quint32 CBcdConversions::transponderCodeToBcd(const BlackMisc::Aviation::CTransponder &transponder)
|
||||
|
||||
@@ -52,7 +52,7 @@ namespace BlackMisc
|
||||
{
|
||||
auto it = std::find_if(s.begin(), s.end(), predicate);
|
||||
if (it == s.end()) { return -1; }
|
||||
return std::distance(s.begin(), it);
|
||||
return static_cast<int>(std::distance(s.begin(), it));
|
||||
}
|
||||
|
||||
//! Split a string into multiple strings, using a predicate function to identify the split points.
|
||||
|
||||
@@ -56,7 +56,7 @@ namespace BlackMisc
|
||||
double f = 118.0 + (index % 30) * 0.25;
|
||||
|
||||
const QDateTime dtFrom = QDateTime::currentDateTimeUtc();
|
||||
const QDateTime dtUntil = dtFrom.addSecs(60 * 60.0); // 1 hour
|
||||
const QDateTime dtUntil = dtFrom.addSecs(60 * 60); // 1 hour
|
||||
const CUser user(id, usr);
|
||||
|
||||
CAtcStation station;
|
||||
|
||||
@@ -285,7 +285,7 @@ namespace BlackSound
|
||||
if (!success) return false;
|
||||
|
||||
CombinedHeader header;
|
||||
qint64 headerLength = sizeof(CombinedHeader);
|
||||
constexpr auto headerLength = sizeof(CombinedHeader);
|
||||
memset(&header, 0, headerLength);
|
||||
|
||||
// RIFF header
|
||||
|
||||
@@ -50,7 +50,7 @@ namespace XBus
|
||||
class ArrayDataRefImpl
|
||||
{
|
||||
public:
|
||||
ArrayDataRefImpl(char const* name, size_t size) : m_ref(XPLMFindDataRef(name)), m_size(size)
|
||||
ArrayDataRefImpl(char const* name, int size) : m_ref(XPLMFindDataRef(name)), m_size(size)
|
||||
{
|
||||
if (! m_ref)
|
||||
{
|
||||
@@ -66,14 +66,14 @@ namespace XBus
|
||||
std::vector<T> implGetAll() const;
|
||||
|
||||
template <typename T>
|
||||
void implSetAt(size_t index, T);
|
||||
void implSetAt(int index, T);
|
||||
|
||||
template <typename T>
|
||||
T implGetAt(size_t index) const;
|
||||
T implGetAt(int index) const;
|
||||
|
||||
private:
|
||||
XPLMDataRef m_ref;
|
||||
size_t const m_size;
|
||||
int const m_size;
|
||||
};
|
||||
|
||||
/*!
|
||||
@@ -126,10 +126,10 @@ namespace XBus
|
||||
std::vector<DataRefType> getAll() const { return ArrayDataRefImpl::implGetAll<DataRefType>(); }
|
||||
|
||||
//! Set the value of a single element (if it is writable)
|
||||
void setAt(size_t index, DataRefType d) { ArrayDataRefImpl::implSetAt(index, d); }
|
||||
void setAt(int index, DataRefType d) { ArrayDataRefImpl::implSetAt(index, d); }
|
||||
|
||||
//! Get the value of a single element
|
||||
DataRefType getAt(size_t index) const { return ArrayDataRefImpl::implGetAt<DataRefType>(index); }
|
||||
DataRefType getAt(int index) const { return ArrayDataRefImpl::implGetAt<DataRefType>(index); }
|
||||
};
|
||||
|
||||
/*!
|
||||
@@ -183,22 +183,22 @@ namespace XBus
|
||||
inline double DataRefImpl::implGet<double>() const { return XPLMGetDatad(m_ref); }
|
||||
|
||||
template <>
|
||||
inline void ArrayDataRefImpl::implSetAll<int>(std::vector<int> const& v) { assert(v.size() <= m_size); XPLMSetDatavi(m_ref, const_cast<int*>(&v[0]), 0, (int)v.size()); }
|
||||
inline void ArrayDataRefImpl::implSetAll<int>(std::vector<int> const& v) { assert((int)v.size() <= m_size); XPLMSetDatavi(m_ref, const_cast<int*>(&v[0]), 0, (int)v.size()); }
|
||||
template <>
|
||||
inline void ArrayDataRefImpl::implSetAll<float>(std::vector<float> const& v) { assert(v.size() <= m_size); XPLMSetDatavf(m_ref, const_cast<float*>(&v[0]), 0, (int)v.size()); }
|
||||
inline void ArrayDataRefImpl::implSetAll<float>(std::vector<float> const& v) { assert((int)v.size() <= m_size); XPLMSetDatavf(m_ref, const_cast<float*>(&v[0]), 0, (int)v.size()); }
|
||||
template <>
|
||||
inline std::vector<int> ArrayDataRefImpl::implGetAll<int>() const { std::vector<int> v (m_size); XPLMGetDatavi(m_ref, &v[0], 0, (int)m_size); return v; }
|
||||
inline std::vector<int> ArrayDataRefImpl::implGetAll<int>() const { std::vector<int> v (m_size); XPLMGetDatavi(m_ref, &v[0], 0, m_size); return v; }
|
||||
template <>
|
||||
inline std::vector<float> ArrayDataRefImpl::implGetAll<float>() const { std::vector<float> v (m_size); XPLMGetDatavf(m_ref, &v[0], 0, (int)m_size); return v; }
|
||||
inline std::vector<float> ArrayDataRefImpl::implGetAll<float>() const { std::vector<float> v (m_size); XPLMGetDatavf(m_ref, &v[0], 0, m_size); return v; }
|
||||
|
||||
template <>
|
||||
inline void ArrayDataRefImpl::implSetAt<int>(size_t i, int d) { assert(i <= m_size); XPLMSetDatavi(m_ref, &d, (int)i, 1); }
|
||||
inline void ArrayDataRefImpl::implSetAt<int>(int i, int d) { assert(i <= m_size); XPLMSetDatavi(m_ref, &d, i, 1); }
|
||||
template <>
|
||||
inline void ArrayDataRefImpl::implSetAt<float>(size_t i, float d) { assert(i <= m_size); XPLMSetDatavf(m_ref, &d, (int)i, 1); }
|
||||
inline void ArrayDataRefImpl::implSetAt<float>(int i, float d) { assert(i <= m_size); XPLMSetDatavf(m_ref, &d, i, 1); }
|
||||
template <>
|
||||
inline int ArrayDataRefImpl::implGetAt<int>(size_t i) const { assert(i <= m_size); int d; XPLMGetDatavi(m_ref, &d, (int)i, 1); return d; }
|
||||
inline int ArrayDataRefImpl::implGetAt<int>(int i) const { assert(i <= m_size); int d; XPLMGetDatavi(m_ref, &d, i, 1); return d; }
|
||||
template <>
|
||||
inline float ArrayDataRefImpl::implGetAt<float>(size_t i) const { assert(i <= m_size); float d; XPLMGetDatavf(m_ref, &d, (int)i, 1); return d; }
|
||||
inline float ArrayDataRefImpl::implGetAt<float>(int i) const { assert(i <= m_size); float d; XPLMGetDatavf(m_ref, &d, i, 1); return d; }
|
||||
|
||||
} // namespace
|
||||
|
||||
|
||||
@@ -45,9 +45,9 @@ namespace BlackMiscTest
|
||||
{
|
||||
// ATC station
|
||||
QDateTime dtFrom = QDateTime::currentDateTimeUtc();
|
||||
QDateTime dtUntil = dtFrom.addSecs(60 * 60.0); // 1 hour
|
||||
QDateTime dtUntil = dtFrom.addSecs(60 * 60); // 1 hour
|
||||
QDateTime dtFrom2 = dtUntil;
|
||||
QDateTime dtUntil2 = dtUntil.addSecs(60 * 60.0);
|
||||
QDateTime dtUntil2 = dtUntil.addSecs(60 * 60);
|
||||
CCoordinateGeodetic geoPos =
|
||||
CCoordinateGeodetic::fromWgs84("48° 21′ 13″ N", "11° 47′ 09″ E", CLength(1487, CLengthUnit::ft()));
|
||||
CAtcStation station1(CCallsign("eddm_twr"), CUser("123456", "Joe Doe"),
|
||||
@@ -96,7 +96,7 @@ namespace BlackMiscTest
|
||||
{
|
||||
// ATC station
|
||||
QDateTime dtFrom = QDateTime::currentDateTimeUtc();
|
||||
QDateTime dtUntil = dtFrom.addSecs(60 * 60.0); // 1 hour
|
||||
QDateTime dtUntil = dtFrom.addSecs(60 * 60); // 1 hour
|
||||
CCoordinateGeodetic geoPos =
|
||||
CCoordinateGeodetic::fromWgs84("48° 21′ 13″ N", "11° 47′ 09″ E", CLength(1487, CLengthUnit::ft()));
|
||||
CAtcStation station1(CCallsign("eddm_twr"), CUser("123456", "Joe Doe"),
|
||||
|
||||
Reference in New Issue
Block a user