From 92e92d3ef2306efaccd804cd1ebe2ef460d963f5 Mon Sep 17 00:00:00 2001 From: Alistair Francis Date: Wed, 16 Jun 2021 18:14:04 +1000 Subject: [PATCH] [EGD-6946] Fix build for GCC11 Fix build issues identified when building on Fedora 34 using GCC11. Signed-off-by: Alistair Francis --- module-db/Interface/CalllogRecord.cpp | 4 +-- module-db/Interface/ContactRecord.cpp | 36 +++++++++---------- module-db/Interface/NotificationsRecord.cpp | 2 +- module-db/Interface/SMSRecord.cpp | 4 +-- module-db/Interface/SMSRecord.hpp | 4 +-- module-db/Interface/SMSTemplateRecord.cpp | 4 +-- module-db/Interface/ThreadRecord.cpp | 4 +-- module-db/Interface/ThreadRecord.hpp | 2 +- module-db/Tables/ContactsTable.cpp | 2 +- module-db/Tables/Record.hpp | 5 ++- module-db/tests/CalllogTable_tests.cpp | 2 +- module-db/tests/ContactGroups_tests.cpp | 2 +- .../tests/ContactsAddressTable_tests.cpp | 2 +- module-db/tests/ContactsNameTable_tests.cpp | 2 +- module-db/tests/ContactsNumberTable_tests.cpp | 2 +- module-db/tests/ContactsTable_tests.cpp | 2 +- module-db/tests/NotificationsRecord_tests.cpp | 6 ++-- module-db/tests/NotificationsTable_tests.cpp | 12 +++---- module-db/tests/SMSRecord_tests.cpp | 2 +- module-db/tests/SMSTable_tests.cpp | 4 +-- module-db/tests/SMSTemplateTable_tests.cpp | 2 +- module-db/tests/ThreadsTable_tests.cpp | 2 +- .../service-desktop/endpoints/BaseHelper.hpp | 1 + 23 files changed, 56 insertions(+), 52 deletions(-) diff --git a/module-db/Interface/CalllogRecord.cpp b/module-db/Interface/CalllogRecord.cpp index b9cb5d035d382bda62e2f7f6b3a4536cdfa57440..573f833f10ea1b3e4dad401c045005a9320f0f05 100644 --- a/module-db/Interface/CalllogRecord.cpp +++ b/module-db/Interface/CalllogRecord.cpp @@ -82,7 +82,7 @@ bool CalllogRecordInterface::Add(const CalllogRecord &rec) LOG_DEBUG("Adding private call entry to call log record."); } - return calllogDB->calls.add(CalllogTableRow{{.ID = localRec.ID}, // this is only to remove warning + return calllogDB->calls.add(CalllogTableRow{Record(localRec.ID), // this is only to remove warning .number = localRec.phoneNumber.getEntered(), .e164number = localRec.phoneNumber.getE164(), .presentation = localRec.presentation, @@ -161,7 +161,7 @@ bool CalllogRecordInterface::Update(const CalllogRecord &rec) } } - return calllogDB->calls.update(CalllogTableRow{{.ID = rec.ID}, + return calllogDB->calls.update(CalllogTableRow{Record(rec.ID), .number = rec.phoneNumber.getEntered(), .e164number = rec.phoneNumber.getE164(), .presentation = presentation, diff --git a/module-db/Interface/ContactRecord.cpp b/module-db/Interface/ContactRecord.cpp index 54baac81d1a12078d9cfe677e94c6e8ccae8907c..578688783c3f1eda2452183fd76ae88fff7c7c25 100644 --- a/module-db/Interface/ContactRecord.cpp +++ b/module-db/Interface/ContactRecord.cpp @@ -30,7 +30,7 @@ ContactRecordInterface::ContactRecordInterface(ContactsDB *db) auto ContactRecordInterface::Add(ContactRecord &rec) -> bool { bool ret = contactDB->contacts.add( - ContactsTableRow{{.ID = DB_ID_NONE}, .speedDial = rec.speeddial, .namePrimary = rec.primaryName}); + ContactsTableRow{Record(DB_ID_NONE), .speedDial = rec.speeddial, .namePrimary = rec.primaryName}); if (!ret) { return false; @@ -40,7 +40,7 @@ auto ContactRecordInterface::Add(ContactRecord &rec) -> bool debug_db_data("New contact with ID %" PRIu32 " created", contactID); rec.ID = contactID; - ret = contactDB->name.add(ContactsNameTableRow{{.ID = DB_ID_NONE}, + ret = contactDB->name.add(ContactsNameTableRow{Record(DB_ID_NONE), .contactID = contactID, .namePrimary = rec.primaryName, .nameAlternative = rec.alternativeName}); @@ -54,7 +54,7 @@ auto ContactRecordInterface::Add(ContactRecord &rec) -> bool // build string list of number IDs std::string numbersIDs; for (auto a : rec.numbers) { - ret = contactDB->number.add(ContactsNumberTableRow{{.ID = DB_ID_NONE}, + ret = contactDB->number.add(ContactsNumberTableRow{Record(DB_ID_NONE), .contactID = contactID, .numberUser = a.number.getEntered().c_str(), .numbere164 = a.number.getE164().c_str(), @@ -80,7 +80,7 @@ auto ContactRecordInterface::Add(ContactRecord &rec) -> bool auto contactRingID = contactDB->getLastInsertRowId(); ret = contactDB->address.add(ContactsAddressTableRow{ - {.ID = DB_ID_NONE}, .contactID = contactID, .address = rec.address, .note = rec.note, .mail = rec.mail}); + Record(DB_ID_NONE), .contactID = contactID, .address = rec.address, .note = rec.note, .mail = rec.mail}); if (!ret) { return false; @@ -88,7 +88,7 @@ auto ContactRecordInterface::Add(ContactRecord &rec) -> bool auto contactAddressID = contactDB->getLastInsertRowId(); - ret = contactDB->contacts.update(ContactsTableRow{{.ID = contactID}, + ret = contactDB->contacts.update(ContactsTableRow{Record(contactID), .nameID = contactNameID, .numbersID = numbersIDs, .ringID = contactRingID, @@ -432,7 +432,7 @@ auto ContactRecordInterface::Update(const ContactRecord &rec) -> bool auto numberMatch = numberMatcher.bestMatch(utils::PhoneNumber(number.number), utils::PhoneNumber::Match::POSSIBLE); if (numberMatch == numberMatcher.END) { - if (!contactDB->number.add(ContactsNumberTableRow{{.ID = DB_ID_NONE}, + if (!contactDB->number.add(ContactsNumberTableRow{Record(DB_ID_NONE), .contactID = contact.ID, .numberUser = number.number.getEntered().c_str(), .numbere164 = number.number.getE164().c_str(), @@ -488,7 +488,7 @@ auto ContactRecordInterface::Update(const ContactRecord &rec) -> bool } } - ret = contactDB->contacts.update(ContactsTableRow{{.ID = contact.ID}, + ret = contactDB->contacts.update(ContactsTableRow{Record(contact.ID), .nameID = contact.nameID, .numbersID = joinNumberIDs(outputNumberIDs), .ringID = contact.ringID, @@ -502,7 +502,7 @@ auto ContactRecordInterface::Update(const ContactRecord &rec) -> bool return false; } - ret = contactDB->name.update(ContactsNameTableRow{{.ID = contact.nameID}, + ret = contactDB->name.update(ContactsNameTableRow{Record(contact.nameID), .contactID = contact.ID, .namePrimary = rec.primaryName, .nameAlternative = rec.alternativeName}); @@ -512,7 +512,7 @@ auto ContactRecordInterface::Update(const ContactRecord &rec) -> bool return false; } - ret = contactDB->address.update(ContactsAddressTableRow{{.ID = contact.addressID}, + ret = contactDB->address.update(ContactsAddressTableRow{Record(contact.addressID), .contactID = contact.ID, .address = rec.address, .note = rec.note, @@ -642,7 +642,7 @@ auto ContactRecordInterface::GetLimitOffset(uint32_t offset, uint32_t limit) return records; } - records->push_back(ContactRecord{{.ID = contact.ID}, + records->push_back(ContactRecord{Record(contact.ID), .primaryName = name.namePrimary, .alternativeName = name.nameAlternative, .numbers = nrs, @@ -690,7 +690,7 @@ auto ContactRecordInterface::GetLimitOffsetByField(uint32_t offset, return records; } - records->push_back(ContactRecord{{.ID = record.ID}, + records->push_back(ContactRecord{Record(record.ID), .primaryName = record.namePrimary, .alternativeName = record.nameAlternative, .numbers = nrs, @@ -733,7 +733,7 @@ auto ContactRecordInterface::GetLimitOffsetByField(uint32_t offset, return records; } - records->push_back(ContactRecord{{.ID = record.ID}, + records->push_back(ContactRecord{Record(record.ID), .primaryName = name.namePrimary, .alternativeName = name.nameAlternative, .numbers = nrs, @@ -779,7 +779,7 @@ auto ContactRecordInterface::GetLimitOffsetByField(uint32_t offset, } records->push_back(ContactRecord{ - {.ID = record.ID}, + Record(record.ID), .primaryName = name.namePrimary, .alternativeName = name.nameAlternative, .numbers = nrs, @@ -823,7 +823,7 @@ auto ContactRecordInterface::GetLimitOffsetByField(uint32_t offset, return records; } - records->push_back(ContactRecord{{.ID = contact.ID}, + records->push_back(ContactRecord{Record(contact.ID), .primaryName = name.namePrimary, .alternativeName = name.nameAlternative, .numbers = nrs, @@ -873,7 +873,7 @@ auto ContactRecordInterface::GetByName(UTF8 primaryName, UTF8 alternativeName) return records; } - records->push_back(ContactRecord{{.ID = record.ID}, + records->push_back(ContactRecord{Record(record.ID), .primaryName = record.namePrimary, .alternativeName = record.nameAlternative, .numbers = nrs, @@ -916,7 +916,7 @@ auto ContactRecordInterface::Search(const char *primaryName, const char *alterna return records; } - records->push_back(ContactRecord{{.ID = record.ID}, + records->push_back(ContactRecord{Record(record.ID), .primaryName = record.namePrimary, .alternativeName = record.nameAlternative, .numbers = nrs, @@ -956,7 +956,7 @@ auto ContactRecordInterface::GetByNumber(const utils::PhoneNumber::View &numberV if (createTempContact == CreateTempContact::True) { debug_db_data("Cannot find contact for number %s, creating temporary one", number.c_str()); ContactRecord tmpRecord = { - {.ID = DB_ID_NONE}, + Record(DB_ID_NONE), .numbers = std::vector{ContactRecord::Number(numberView)}, }; if (!Add(tmpRecord)) { @@ -1006,7 +1006,7 @@ auto ContactRecordInterface::MatchByNumber(const utils::PhoneNumber::View &numbe } debug_db_data("Cannot find contact for number %s, creating temporary one", numberView.getEntered().c_str()); - ContactRecord newContact = {{.ID = DB_ID_NONE}, + ContactRecord newContact = {Record(DB_ID_NONE), .numbers = std::vector{ContactRecord::Number(numberView)}, .groups = {contactDB->groups.getById(ContactsDB::temporaryGroupId())}}; diff --git a/module-db/Interface/NotificationsRecord.cpp b/module-db/Interface/NotificationsRecord.cpp index 27b01b3ff362f1a624b52390a8c1fae681bd9672..3c6a89a648e3d92d1d8ea9230ecfab867d1f232e 100644 --- a/module-db/Interface/NotificationsRecord.cpp +++ b/module-db/Interface/NotificationsRecord.cpp @@ -93,7 +93,7 @@ bool NotificationsRecordInterface::Update(const NotificationsRecord &rec) uint32_t contactId = rec.contactRecord.has_value() ? rec.contactRecord.value().ID : DB_ID_NONE; return notificationsDb->notifications.update(NotificationsTableRow{ - {.ID = rec.ID}, .key = static_cast(rec.key), .value = rec.value, .contactID = contactId}); + Record(rec.ID), .key = static_cast(rec.key), .value = rec.value, .contactID = contactId}); } bool NotificationsRecordInterface::RemoveByID(uint32_t id) diff --git a/module-db/Interface/SMSRecord.cpp b/module-db/Interface/SMSRecord.cpp index 564f9bb142dda6f9a183f5af7c9c376418d9cd41..ac990117f241db1ddce2d4f8466e2972a92b760d 100644 --- a/module-db/Interface/SMSRecord.cpp +++ b/module-db/Interface/SMSRecord.cpp @@ -64,7 +64,7 @@ bool SMSRecordInterface::Add(const SMSRecord &rec) auto thread = (*threadRec)[0]; // Create SMS - if (!smsDB->sms.add(SMSTableRow{{.ID = DB_ID_NONE}, // the entry is not yet in the DB + if (!smsDB->sms.add(SMSTableRow{Record(DB_ID_NONE), // the entry is not yet in the DB .threadID = thread.ID, .contactID = contactID, .date = rec.date, @@ -170,7 +170,7 @@ bool SMSRecordInterface::Update(const SMSRecord &recUpdated) return false; } - smsDB->sms.update(SMSTableRow{{.ID = recCurrent.ID}, + smsDB->sms.update(SMSTableRow{Record(recCurrent.ID), .threadID = recCurrent.threadID, .contactID = recCurrent.contactID, .date = recUpdated.date, diff --git a/module-db/Interface/SMSRecord.hpp b/module-db/Interface/SMSRecord.hpp index 60a45df5361289435a8ab364683745b384cb7a09..66ba81b2420f6bdc2eff86989d166bbaba65d329 100644 --- a/module-db/Interface/SMSRecord.hpp +++ b/module-db/Interface/SMSRecord.hpp @@ -32,11 +32,11 @@ struct SMSRecord : public Record SMSRecord() = default; SMSRecord(const SMSTableRow &w) - : Record{.ID = w.ID}, date(w.date), errorCode(w.errorCode), body(w.body), type(w.type), threadID(w.threadID), + : Record(w.ID), date(w.date), errorCode(w.errorCode), body(w.body), type(w.type), threadID(w.threadID), contactID(w.contactID) {} SMSRecord(const SMSTableRow &w, const utils::PhoneNumber::View &num) - : Record{.ID = w.ID}, date(w.date), errorCode(w.errorCode), body(w.body), type(w.type), threadID(w.threadID), + : Record(w.ID), date(w.date), errorCode(w.errorCode), body(w.body), type(w.type), threadID(w.threadID), contactID(w.contactID), number(num) {} }; diff --git a/module-db/Interface/SMSTemplateRecord.cpp b/module-db/Interface/SMSTemplateRecord.cpp index c6e29de264e79889ee9b2ce2ff4faf87fcbbc613..3f901e5b50b49867e17df246e907838228dd1641 100644 --- a/module-db/Interface/SMSTemplateRecord.cpp +++ b/module-db/Interface/SMSTemplateRecord.cpp @@ -27,7 +27,7 @@ SMSTemplateRecordInterface::SMSTemplateRecordInterface(SmsDB *smsDb) : smsDB(sms bool SMSTemplateRecordInterface::Add(const SMSTemplateRecord &rec) { return smsDB->templates.add( - SMSTemplateTableRow{{.ID = rec.ID}, .text = rec.text, .lastUsageTimestamp = rec.lastUsageTimestamp}); + SMSTemplateTableRow{Record(rec.ID), .text = rec.text, .lastUsageTimestamp = rec.lastUsageTimestamp}); } uint32_t SMSTemplateRecordInterface::GetCount() { @@ -57,7 +57,7 @@ bool SMSTemplateRecordInterface::Update(const SMSTemplateRecord &rec) } return smsDB->templates.update( - SMSTemplateTableRow{{.ID = rec.ID}, .text = rec.text, .lastUsageTimestamp = rec.lastUsageTimestamp}); + SMSTemplateTableRow{Record(rec.ID), .text = rec.text, .lastUsageTimestamp = rec.lastUsageTimestamp}); } bool SMSTemplateRecordInterface::RemoveByID(uint32_t id) diff --git a/module-db/Interface/ThreadRecord.cpp b/module-db/Interface/ThreadRecord.cpp index 208ed8cc0dff3ef22b3e6686d3488acddd7eb80c..0e7beaa3dc143daf142001fa1d16c05720b4f77b 100644 --- a/module-db/Interface/ThreadRecord.cpp +++ b/module-db/Interface/ThreadRecord.cpp @@ -23,7 +23,7 @@ ThreadRecordInterface::ThreadRecordInterface(SmsDB *smsDb, ContactsDB *contactsD bool ThreadRecordInterface::Add(const ThreadRecord &rec) { - auto ret = smsDB->threads.add(ThreadsTableRow{{.ID = rec.ID}, + auto ret = smsDB->threads.add(ThreadsTableRow{Record(rec.ID), .date = rec.date, .msgCount = rec.msgCount, .unreadMsgCount = rec.unreadMsgCount, @@ -48,7 +48,7 @@ bool ThreadRecordInterface::RemoveByID(uint32_t id) bool ThreadRecordInterface::Update(const ThreadRecord &rec) { - return smsDB->threads.update(ThreadsTableRow{{.ID = rec.ID}, + return smsDB->threads.update(ThreadsTableRow{Record(rec.ID), .date = rec.date, .msgCount = rec.msgCount, .unreadMsgCount = rec.unreadMsgCount, diff --git a/module-db/Interface/ThreadRecord.hpp b/module-db/Interface/ThreadRecord.hpp index 29b70591a4872e630d1ec46f04158632e26372d1..f0e766aaa2d19cf3dac364a679de2b1312ffe2ff 100644 --- a/module-db/Interface/ThreadRecord.hpp +++ b/module-db/Interface/ThreadRecord.hpp @@ -25,7 +25,7 @@ struct ThreadRecord : Record ThreadRecord() = default; ThreadRecord(const ThreadsTableRow &rec) - : Record{.ID = rec.ID}, date(rec.date), msgCount(rec.msgCount), unreadMsgCount(rec.unreadMsgCount), + : Record(rec.ID), date(rec.date), msgCount(rec.msgCount), unreadMsgCount(rec.unreadMsgCount), snippet(rec.snippet), type(rec.type), contactID(rec.contactID), numberID(rec.numberID) {} diff --git a/module-db/Tables/ContactsTable.cpp b/module-db/Tables/ContactsTable.cpp index 70d29a18bd15304ca16c6164b0ff7b9f9d277f8f..2d3b6549696a7979c930637fb8d541eb0fdf4f63 100644 --- a/module-db/Tables/ContactsTable.cpp +++ b/module-db/Tables/ContactsTable.cpp @@ -96,7 +96,7 @@ ContactsTableRow ContactsTable::getByIdCommon(std::unique_ptr retQu debug_db_data( "got results: %" PRIu32 "; ID: %" PRIu32, retQuery->getRowCount(), (*retQuery)[ColumnName::id].getInt32()); return ContactsTableRow{ - {.ID = (*retQuery)[ColumnName::id].getUInt32()}, + Record((*retQuery)[ColumnName::id].getUInt32()), .nameID = (*retQuery)[ColumnName::name_id].getUInt32(), .numbersID = (*retQuery)[ColumnName::numbers_id].getString(), .ringID = (*retQuery)[ColumnName::ring_id].getUInt32(), diff --git a/module-db/Tables/Record.hpp b/module-db/Tables/Record.hpp index 809390440ca3b092ed8ee9c5946c6d9d583d2db7..3114748018d4fbe153069627f498f6d3e72028b8 100644 --- a/module-db/Tables/Record.hpp +++ b/module-db/Tables/Record.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2020, Mudita Sp. z.o.o. All rights reserved. +// Copyright (c) 2017-2021, Mudita Sp. z.o.o. All rights reserved. // For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md #pragma once @@ -12,6 +12,9 @@ struct Record { uint32_t ID = DB_ID_NONE; + Record() = default; + Record(uint32_t ID) : ID(ID){}; + bool isValid() const { auto result = ID != DB_ID_NONE; diff --git a/module-db/tests/CalllogTable_tests.cpp b/module-db/tests/CalllogTable_tests.cpp index c311d93eb52ebd18a3ea461a2a4dd79f16f50129..d648958b889c1e62406a2bfb94d7b1f98179d5fc 100644 --- a/module-db/tests/CalllogTable_tests.cpp +++ b/module-db/tests/CalllogTable_tests.cpp @@ -42,7 +42,7 @@ TEST_CASE("Calllog Table tests") REQUIRE(testRow.isRead == true); } - CalllogTableRow testRow = {{.ID = DB_ID_NONE}, + CalllogTableRow testRow = {Record(DB_ID_NONE), .number = "600123456", .e164number = "+48600226908", .presentation = PresentationType::PR_ALLOWED, diff --git a/module-db/tests/ContactGroups_tests.cpp b/module-db/tests/ContactGroups_tests.cpp index fef3518682a3c89fad4dbb3fc121da03767b2522..1f7d1d7e0baba165e4087e052f72952966bb6a72 100644 --- a/module-db/tests/ContactGroups_tests.cpp +++ b/module-db/tests/ContactGroups_tests.cpp @@ -171,7 +171,7 @@ TEST_CASE("Contact Groups tests") void addSomeContacts(ContactsDB &contactsDb) { ContactsTableRow testRow1 = { - {.ID = 0}, .nameID = 0, .numbersID = "0 1 2 3 4", .ringID = 0, .addressID = 0, .speedDial = "666" + Record(0), .nameID = 0, .numbersID = "0 1 2 3 4", .ringID = 0, .addressID = 0, .speedDial = "666" }; diff --git a/module-db/tests/ContactsAddressTable_tests.cpp b/module-db/tests/ContactsAddressTable_tests.cpp index 4552697c55aecefba65dbe2e7d53139dfdf10b81..bbd577b479b5a5941bb1325bb3f7c2e12ab1cb23 100644 --- a/module-db/tests/ContactsAddressTable_tests.cpp +++ b/module-db/tests/ContactsAddressTable_tests.cpp @@ -18,7 +18,7 @@ TEST_CASE("Contacts address Table tests") ContactsDB contactsdb{callogPath.c_str()}; REQUIRE(contactsdb.isInitialized()); - ContactsAddressTableRow testRow1 = {{.ID = DB_ID_NONE}, + ContactsAddressTableRow testRow1 = {Record(DB_ID_NONE), .contactID = 0, .address = "6 Czeczota St.\n02600 Warsaw", .note = "Test note", diff --git a/module-db/tests/ContactsNameTable_tests.cpp b/module-db/tests/ContactsNameTable_tests.cpp index a50f70dc0889aca86105f34bca3327b587f094e2..8006654e1c9d3fe4cedce879b2582d8390bc4f33 100644 --- a/module-db/tests/ContactsNameTable_tests.cpp +++ b/module-db/tests/ContactsNameTable_tests.cpp @@ -26,7 +26,7 @@ TEST_CASE("Contacts Name Table tests") REQUIRE(contactsdb.isInitialized()); ContactsNameTableRow testRow1 = { - {.ID = DB_ID_NONE}, .contactID = DB_ID_NONE, .namePrimary = "Mateusz", .nameAlternative = "Pati"}; + Record(DB_ID_NONE), .contactID = DB_ID_NONE, .namePrimary = "Mateusz", .nameAlternative = "Pati"}; const auto contactsCount = contactsdb.name.count() + 1; // clear contacts table diff --git a/module-db/tests/ContactsNumberTable_tests.cpp b/module-db/tests/ContactsNumberTable_tests.cpp index 4b748d6e9660950dc5df00fcf8252f006a5dcc69..1477b2a699f15638bc25fa7752d906ac498dcdaa 100644 --- a/module-db/tests/ContactsNumberTable_tests.cpp +++ b/module-db/tests/ContactsNumberTable_tests.cpp @@ -26,7 +26,7 @@ TEST_CASE("Contacts Number Table tests") REQUIRE(contactsdb.isInitialized()); ContactsNumberTableRow testRow1 = { - {.ID = DB_ID_NONE}, .contactID = DB_ID_NONE, .numberUser = "111222333", .numbere164 = "333222111"}; + Record(DB_ID_NONE), .contactID = DB_ID_NONE, .numberUser = "111222333", .numbere164 = "333222111"}; const auto contactsCount = contactsdb.number.count() + 1; // clear contacts table diff --git a/module-db/tests/ContactsTable_tests.cpp b/module-db/tests/ContactsTable_tests.cpp index b162db9f529114a5f1d1dc897f3a19bea3b220f1..67cff0764138de41735edf3f0f62458e2a606da2 100644 --- a/module-db/tests/ContactsTable_tests.cpp +++ b/module-db/tests/ContactsTable_tests.cpp @@ -19,7 +19,7 @@ TEST_CASE("Contacts Table tests") ContactsDB contactsdb{contactsPath.c_str()}; REQUIRE(contactsdb.isInitialized()); - ContactsTableRow testRow1 = {{.ID = DB_ID_NONE}, + ContactsTableRow testRow1 = {Record(DB_ID_NONE), .nameID = DB_ID_NONE, .numbersID = "0 1 2 3 4", .ringID = DB_ID_NONE, diff --git a/module-db/tests/NotificationsRecord_tests.cpp b/module-db/tests/NotificationsRecord_tests.cpp index f0482d769e351d5460671c029007c93bb3f62653..5eeeca2c83e919011b4a2af46dafe746b5841fbf 100644 --- a/module-db/tests/NotificationsRecord_tests.cpp +++ b/module-db/tests/NotificationsRecord_tests.cpp @@ -38,7 +38,7 @@ TEST_CASE("Notifications Record tests") SECTION("Constructor from NotificationsTableRow") { NotificationsTableRow tableRow{ - {.ID = 10}, .key = static_cast(NotificationsRecord::Key::Calls), .value = 2}; + Record(10), .key = static_cast(NotificationsRecord::Key::Calls), .value = 2}; NotificationsRecord testRec(tableRow); REQUIRE(testRec.isValid()); REQUIRE(testRec.ID == 10); @@ -70,12 +70,12 @@ TEST_CASE("Notifications Record tests") REQUIRE(notificationsRecordInterface.GetCount() == 0); NotificationsTableRow callsRow{ - {.ID = DB_ID_NONE}, .key = static_cast(NotificationsRecord::Key::Calls), .value = 0}; + Record(DB_ID_NONE), .key = static_cast(NotificationsRecord::Key::Calls), .value = 0}; REQUIRE(notificationsDb.notifications.add(callsRow)); NotificationsTableRow smsRow{ - {.ID = DB_ID_NONE}, .key = static_cast(NotificationsRecord::Key::Sms), .value = 0}; + Record(DB_ID_NONE), .key = static_cast(NotificationsRecord::Key::Sms), .value = 0}; REQUIRE(notificationsDb.notifications.add(smsRow)); NotificationsRecord testRec; diff --git a/module-db/tests/NotificationsTable_tests.cpp b/module-db/tests/NotificationsTable_tests.cpp index b73753fc33e74882b18cf9233f6ce041658c0d5d..a6b4999bfefc135e0883cd6c5977c0353efdd2a8 100644 --- a/module-db/tests/NotificationsTable_tests.cpp +++ b/module-db/tests/NotificationsTable_tests.cpp @@ -32,11 +32,11 @@ TEST_CASE("Notifications Table tests") REQUIRE(notificationsTbl.count() == 0); NotificationsTableRow callsRow{ - {.ID = DB_ID_NONE}, .key = static_cast(NotificationsRecord::Key::Calls), .value = 0}; + Record(DB_ID_NONE), .key = static_cast(NotificationsRecord::Key::Calls), .value = 0}; REQUIRE(notificationsTbl.add(callsRow)); NotificationsTableRow smsRow{ - {.ID = DB_ID_NONE}, .key = static_cast(NotificationsRecord::Key::Sms), .value = 0}; + Record(DB_ID_NONE), .key = static_cast(NotificationsRecord::Key::Sms), .value = 0}; REQUIRE(notificationsTbl.add(smsRow)); REQUIRE(notificationsTbl.count() == 2); // it already got some entries Calls(1) and Sms(2) @@ -51,8 +51,8 @@ TEST_CASE("Notifications Table tests") REQUIRE_FALSE(testRow.isValid()); } - REQUIRE(notificationsTbl.add({{.ID = 0}, .key = 3, .value = 8})); - REQUIRE(notificationsTbl.add({{.ID = 0}, .key = 4, .value = 16, .contactID = 100})); + REQUIRE(notificationsTbl.add({Record(0), .key = 3, .value = 8})); + REQUIRE(notificationsTbl.add({Record(0), .key = 4, .value = 16, .contactID = 100})); REQUIRE(notificationsTbl.count() == 4); @@ -93,7 +93,7 @@ TEST_CASE("Notifications Table tests") SECTION("Entry update") { - REQUIRE(notificationsTbl.update({{.ID = 3}, .key = 100, .value = 200, .contactID = 300})); + REQUIRE(notificationsTbl.update({Record(3), .key = 100, .value = 200, .contactID = 300})); auto entry = notificationsTbl.getById(3); REQUIRE(entry.ID == 3); REQUIRE(entry.key == 100); @@ -161,7 +161,7 @@ TEST_CASE("Notifications Table tests") SECTION("Check uniqueness") { - REQUIRE(notificationsTbl.add({{.ID = 0}, .key = 3, .value = 100, .contactID = 200})); + REQUIRE(notificationsTbl.add({Record(0), .key = 3, .value = 100, .contactID = 200})); REQUIRE(notificationsTbl.count() == 4); auto entry = notificationsTbl.getByKey(3); REQUIRE(entry.isValid()); diff --git a/module-db/tests/SMSRecord_tests.cpp b/module-db/tests/SMSRecord_tests.cpp index 14e1f21dbf9c0c458e68fb3ef5f95fb13f558db8..6818e8494ff1865d296cc50e0e2169ce83d60646 100644 --- a/module-db/tests/SMSRecord_tests.cpp +++ b/module-db/tests/SMSRecord_tests.cpp @@ -183,7 +183,7 @@ TEST_CASE("SMS Record tests") } ThreadRecord threadRec = threadRecordInterface.GetByID(1); REQUIRE(threadRec.isValid()); - ThreadsTableRow threadRaw{{.ID = threadRec.ID}, + ThreadsTableRow threadRaw{Record(threadRec.ID), .date = threadRec.date, .msgCount = threadRec.msgCount, .unreadMsgCount = threadRec.unreadMsgCount, diff --git a/module-db/tests/SMSTable_tests.cpp b/module-db/tests/SMSTable_tests.cpp index 3d58c55934a26118803e1938ea8ee1ca6129f423..1adc3696153469d68fbd8c29dfe44660787b68c5 100644 --- a/module-db/tests/SMSTable_tests.cpp +++ b/module-db/tests/SMSTable_tests.cpp @@ -24,7 +24,7 @@ TEST_CASE("SMS Table tests") SmsDB smsdb(smsPath.c_str()); REQUIRE(smsdb.isInitialized()); - SMSTableRow testRow1 = {{.ID = 0}, + SMSTableRow testRow1 = {Record(0), .threadID = 0, .contactID = 0, .date = 0, @@ -34,7 +34,7 @@ TEST_CASE("SMS Table tests") }; - SMSTableRow testRow2 = {{.ID = 0}, + SMSTableRow testRow2 = {Record(0), .threadID = 0, .contactID = 0, .date = 0, diff --git a/module-db/tests/SMSTemplateTable_tests.cpp b/module-db/tests/SMSTemplateTable_tests.cpp index 54506161027ce1e0748f2e9685f4bfac067bddd8..bebce74eb66c53d975d372edde368e5029158dda 100644 --- a/module-db/tests/SMSTemplateTable_tests.cpp +++ b/module-db/tests/SMSTemplateTable_tests.cpp @@ -29,7 +29,7 @@ TEST_CASE("SMS Templates Table tests") auto &templatesTbl = smsDb.templates; - SMSTemplateTableRow testRow = {{.ID = 0}, .text = "Test text", .lastUsageTimestamp = 100}; + SMSTemplateTableRow testRow = {Record(0), .text = "Test text", .lastUsageTimestamp = 100}; const auto templatesCount = templatesTbl.count() + 1; // clear sms table diff --git a/module-db/tests/ThreadsTable_tests.cpp b/module-db/tests/ThreadsTable_tests.cpp index 53305c3d2bdfcd589316efd9501a880efa302a13..274c73ab92f5087e59629c564bd3413a168048f9 100644 --- a/module-db/tests/ThreadsTable_tests.cpp +++ b/module-db/tests/ThreadsTable_tests.cpp @@ -26,7 +26,7 @@ TEST_CASE("Threads Table tests") SmsDB smsdb{smsPath.c_str()}; REQUIRE(smsdb.isInitialized()); - ThreadsTableRow testRow1 = {{.ID = 0}, + ThreadsTableRow testRow1 = {Record(0), .date = 0, .msgCount = 0, .unreadMsgCount = 0, diff --git a/module-services/service-desktop/endpoints/BaseHelper.hpp b/module-services/service-desktop/endpoints/BaseHelper.hpp index 3504f218da238ff9c4e3ea5618aecaa7dcac2368..f8ffc9fea65a8f982104b5870b8415d06ebf2dee 100644 --- a/module-services/service-desktop/endpoints/BaseHelper.hpp +++ b/module-services/service-desktop/endpoints/BaseHelper.hpp @@ -3,6 +3,7 @@ #pragma once +#include #include #include