mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-02 23:25:53 +08:00
Remove workarounds for fixed bugs
This commit is contained in:
@@ -72,12 +72,7 @@ namespace BlackMisc
|
||||
|
||||
CAtomicFile::~CAtomicFile()
|
||||
{
|
||||
#if __cplusplus >= 201700L
|
||||
const bool ex = std::uncaught_exceptions() > 0;
|
||||
#else
|
||||
const bool ex = std::uncaught_exception();
|
||||
#endif
|
||||
if (ex) { QFile::close(); }
|
||||
if (std::uncaught_exceptions() > 0) { QFile::close(); }
|
||||
}
|
||||
|
||||
void CAtomicFile::close()
|
||||
|
||||
@@ -384,7 +384,6 @@ namespace BlackMisc
|
||||
//! If the value is currently being loaded, wait for it to finish loading, and call the notification slot, if any.
|
||||
void synchronize()
|
||||
{
|
||||
// does not compile on gcc without "this" -> this->m_page
|
||||
auto *queue = this->m_page->template findChild<Private::CDataPageQueue *>();
|
||||
Q_ASSERT(queue);
|
||||
this->admit();
|
||||
|
||||
@@ -16,14 +16,6 @@
|
||||
#include <QSysInfo>
|
||||
#include <QStringBuilder>
|
||||
|
||||
#ifdef Q_OS_WIN
|
||||
#include <qt_windows.h>
|
||||
#endif
|
||||
|
||||
#ifdef Q_OS_MAC
|
||||
#include <sys/sysctl.h>
|
||||
#endif
|
||||
|
||||
//! \private Escape characters not allowed in dbus paths
|
||||
QString toDBusPath(const QString &s)
|
||||
{
|
||||
@@ -69,40 +61,9 @@ enum
|
||||
UuidStringLen = sizeof("00000000-0000-0000-0000-000000000000")
|
||||
};
|
||||
|
||||
QByteArray getMachineUniqueIdImpl()
|
||||
{
|
||||
// TODO RR: Remove the workaround branches as soon as the following two changes are published in 5.12.2 (TBC)
|
||||
// https://codereview.qt-project.org/#/c/249256
|
||||
// https://codereview.qt-project.org/#/c/249399
|
||||
|
||||
QByteArray machineUniqueId;
|
||||
#ifdef Q_OS_MAC
|
||||
char uuid[UuidStringLen];
|
||||
size_t uuidlen = sizeof(uuid);
|
||||
int ret = sysctlbyname("kern.uuid", uuid, &uuidlen, nullptr, 0);
|
||||
if (ret == 0 && uuidlen == sizeof(uuid))
|
||||
{
|
||||
machineUniqueId = QByteArray(uuid, uuidlen - 1);
|
||||
}
|
||||
#elif defined(Q_OS_WIN) && !defined(Q_OS_WINRT)
|
||||
HKEY key = nullptr;
|
||||
if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, L"SOFTWARE\\Microsoft\\Cryptography", 0, KEY_READ | KEY_WOW64_64KEY, &key) == ERROR_SUCCESS)
|
||||
{
|
||||
wchar_t buffer[UuidStringLen];
|
||||
DWORD size = sizeof(buffer);
|
||||
bool ok = (RegQueryValueEx(key, L"MachineGuid", nullptr, nullptr, reinterpret_cast<LPBYTE>(buffer), &size) == ERROR_SUCCESS);
|
||||
RegCloseKey(key);
|
||||
if (ok) { machineUniqueId = QStringView(buffer, (size - 1) / 2).toLatin1(); }
|
||||
}
|
||||
#else
|
||||
machineUniqueId = QSysInfo::machineUniqueId();
|
||||
#endif
|
||||
return machineUniqueId;
|
||||
}
|
||||
|
||||
QByteArray cachedMachineUniqueId()
|
||||
{
|
||||
static const QByteArray machineUniqueId = getMachineUniqueIdImpl();
|
||||
static const QByteArray machineUniqueId = QSysInfo::machineUniqueId();
|
||||
return machineUniqueId;
|
||||
}
|
||||
|
||||
|
||||
@@ -298,8 +298,7 @@ namespace BlackMisc
|
||||
template <size_t I>
|
||||
using index = std::integral_constant<size_t, I>;
|
||||
|
||||
// Trailing return type needed to work around MSVC "function returning auto can not be used before it has been defined" with /permissive-
|
||||
constexpr static auto members() -> decltype(MetaClass::getMemberList()) { return MetaClass::getMemberList(); }
|
||||
constexpr static auto members() { return MetaClass::getMemberList(); }
|
||||
};
|
||||
// *INDENT-ON*
|
||||
|
||||
|
||||
@@ -39,21 +39,6 @@ namespace BlackMisc
|
||||
// Alternative would be to qualify all our invokations of the global qHash as ::qHash.
|
||||
using ::qHash;
|
||||
|
||||
namespace Private
|
||||
{
|
||||
//! \cond PRIVATE
|
||||
// Work around MSVC2015 bug affecting generic lambda
|
||||
template <typename T>
|
||||
struct Hasher
|
||||
{
|
||||
template <typename U>
|
||||
void operator()(const U &member) { m_hash ^= qHash(member.in(m_object)); }
|
||||
const T &m_object;
|
||||
uint &m_hash;
|
||||
};
|
||||
//! \endcond
|
||||
}
|
||||
|
||||
namespace Mixin
|
||||
{
|
||||
/*!
|
||||
@@ -76,7 +61,7 @@ namespace BlackMisc
|
||||
{
|
||||
uint hash = baseHash(static_cast<const TBaseOfT<Derived> *>(&value));
|
||||
constexpr auto meta = introspect<Derived>().without(MetaFlags<DisabledForHashing>());
|
||||
meta.forEachMember(Private::Hasher<Derived> { value, hash });
|
||||
meta.forEachMember([ & ](const auto &member) { hash ^= qHash(member.in(value)); });
|
||||
return hash;
|
||||
}
|
||||
|
||||
|
||||
@@ -226,7 +226,7 @@ namespace BlackMisc
|
||||
ConverterFunction m_fromDefault = nullptr; //!< convert to this unit from default unit
|
||||
};
|
||||
|
||||
//! Workaround to constant-initialize QLatin1String on platforms without constexpr strlen.
|
||||
//! Constant-initialize QLatin1String without using strlen.
|
||||
template <int N>
|
||||
static constexpr QLatin1String constQLatin1(const char (&str)[N])
|
||||
{
|
||||
|
||||
@@ -134,8 +134,7 @@ namespace BlackMisc
|
||||
}
|
||||
|
||||
// set some default values
|
||||
const qint64 defaultValueMs = CFsdSetup::c_interimPositionTimeOffsetMsec; // CLANG cannot use reference in qMax
|
||||
const qint64 os = qMax(defaultValueMs, m_s[2].getTimeOffsetMs());
|
||||
const qint64 os = qMax(CFsdSetup::c_interimPositionTimeOffsetMsec, m_s[2].getTimeOffsetMs());
|
||||
m_s[0].addMsecs(-os); // oldest, Ref T297 default offset time to fill data
|
||||
m_s[2].addMsecs(os); // latest, Ref T297 default offset time to fill data
|
||||
if (m_currentSituations.isEmpty()) { return false; }
|
||||
|
||||
@@ -61,13 +61,6 @@ namespace BlackMisc
|
||||
}
|
||||
}
|
||||
|
||||
// needed because these constants are odr-used (just like traditional C++98 static const)
|
||||
// https://gcc.gnu.org/bugzilla/show_bug.cgi?id=54483
|
||||
const StatusSeverity CStatusMessage::SeverityDebug;
|
||||
const StatusSeverity CStatusMessage::SeverityInfo;
|
||||
const StatusSeverity CStatusMessage::SeverityWarning;
|
||||
const StatusSeverity CStatusMessage::SeverityError;
|
||||
|
||||
CStatusMessage::CStatusMessage(const CLogCategory &category) :
|
||||
CMessageBase(category), ITimestampBased(QDateTime::currentMSecsSinceEpoch())
|
||||
{}
|
||||
|
||||
@@ -72,10 +72,6 @@ namespace BlackMisc
|
||||
// CValueCachePacket
|
||||
////////////////////////////////
|
||||
|
||||
CValueCachePacket::CValueCachePacket(bool saved, bool valuesChanged) :
|
||||
m_saved(saved), m_valuesChanged(valuesChanged)
|
||||
{}
|
||||
|
||||
CValueCachePacket::CValueCachePacket(const CVariantMap &values, qint64 timestamp, bool saved, bool valuesChanged) :
|
||||
m_saved(saved), m_valuesChanged(valuesChanged)
|
||||
{
|
||||
@@ -570,12 +566,7 @@ namespace BlackMisc
|
||||
{
|
||||
if (m_page)
|
||||
{
|
||||
#if __cplusplus >= 201700L
|
||||
const bool ex = std::uncaught_exceptions() > 0;
|
||||
#else
|
||||
const bool ex = std::uncaught_exception();
|
||||
#endif
|
||||
if (ex) { m_page->abandonBatch(); }
|
||||
if (std::uncaught_exceptions() > 0) { m_page->abandonBatch(); }
|
||||
else { m_page->endBatch(); }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -78,8 +78,9 @@ namespace BlackMisc
|
||||
using base_type = CDictionary;
|
||||
|
||||
//! Constructor.
|
||||
//! \fixme Defining this inline causes ICE in Clang on Windows
|
||||
CValueCachePacket(bool saved = false, bool valuesChanged = true);
|
||||
CValueCachePacket(bool saved = false, bool valuesChanged = true) :
|
||||
m_saved(saved), m_valuesChanged(valuesChanged)
|
||||
{}
|
||||
|
||||
//! Construct from CVariantMap and a timestamp.
|
||||
CValueCachePacket(const CVariantMap &values, qint64 timestamp, bool saved = false, bool valuesChanged = true);
|
||||
|
||||
Reference in New Issue
Block a user