Fix Q_ASSERTS

This commit is contained in:
Gerhard Hoffmann 2024-02-06 09:55:00 +01:00
parent 5599c56114
commit 352b550190

View File

@ -59,8 +59,10 @@ hwapi::hwapi(QWidget *parent) : QObject(parent)
qCritical() << "Creating/attaching shared memory failed";
}
Q_ASSERT_X(sizeof(SharedMem) != m_sharedMem->size(),
"compare sizes", "sizes different");
Q_ASSERT_X(sizeof(SharedMem) == m_sharedMem->size(), "check shm-sizes",
QString("sizes different %1 != %2")
.arg(sizeof(SharedMem))
.arg(m_sharedMem->size()).toStdString().c_str());
//if (shdMem_firstUse()) // für Master raus
// {
@ -3351,7 +3353,6 @@ void hwapi::sys_restoreDeviceParameter(struct T_devices *deviceSettings) const
*start = buf[nn];
start++;
} while(++nn<LL);
}
bool hwapi::sys_areDCdataValid(void) const
@ -4442,8 +4443,8 @@ bool hwapi::dcDownloadRequest(QString const &dcFileToDownload) const {
bool hwapi::dcDownloadRequested() const {
SharedMem *data = SharedMem::getData();
Q_ASSERT_X(data != nullptr, "check", "pointer invalid");
Q_ASSERT_X((void *)data != m_sharedMem->data(), "compare pointers", "pointers different");
Q_ASSERT_X(sizeof(*data) != m_sharedMem->size(), "compare sizes", "sizes different");
Q_ASSERT_X((void *)data == m_sharedMem->data(), "compare pointers", "pointers different");
Q_ASSERT_X(sizeof(*data) == m_sharedMem->size(), "compare sizes", "sizes different");
// called by download-thread
// 1: true at entry: reset atomically to false