From a1c48893397b4055f2aad1caf46b1d024c3d52ac Mon Sep 17 00:00:00 2001 From: Nicolas Werner Date: Sun, 19 Feb 2023 23:17:21 +0100 Subject: [PATCH] Remove a few more unused symbols --- CMakeLists.txt | 2 +- cmake/nheko.h | 6 +++--- src/Cache.cpp | 40 ++++++++++++++++++++-------------------- src/ChatPage.cpp | 8 ++++---- src/ChatPage.h | 4 ---- src/Logging.cpp | 16 ++++++++-------- src/UserSettingsPage.h | 4 ---- src/dbus/NhekoDBusApi.h | 2 +- 8 files changed, 37 insertions(+), 45 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 57b6b67a..0512acc3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -597,7 +597,7 @@ if(USE_BUNDLED_MTXCLIENT) FetchContent_Declare( MatrixClient GIT_REPOSITORY https://github.com/Nheko-Reborn/mtxclient.git - GIT_TAG v0.9.0 + GIT_TAG a2ea44e15ea5bdd340e39d4ed32ff082ca972a6d ) set(BUILD_LIB_EXAMPLES OFF CACHE INTERNAL "") set(BUILD_LIB_TESTS OFF CACHE INTERNAL "") diff --git a/cmake/nheko.h b/cmake/nheko.h index ae28aea9..3b68a432 100644 --- a/cmake/nheko.h +++ b/cmake/nheko.h @@ -1,7 +1,7 @@ namespace nheko { -constexpr auto version = "${PROJECT_VERSION}"; -constexpr auto build_os = "${CMAKE_HOST_SYSTEM_NAME}"; -constexpr auto enable_debug_log = ${SPDLOG_DEBUG_ON}; +inline constexpr auto version = "${PROJECT_VERSION}"; +inline constexpr auto build_os = "${CMAKE_HOST_SYSTEM_NAME}"; +inline constexpr auto enable_debug_log = ${SPDLOG_DEBUG_ON}; } # cmakedefine01 HAVE_BACKTRACE_SYMBOLS_FD diff --git a/src/Cache.cpp b/src/Cache.cpp index 53543591..1371619a 100644 --- a/src/Cache.cpp +++ b/src/Cache.cpp @@ -48,15 +48,15 @@ static const std::string_view OLM_ACCOUNT_KEY("olm_account"); static const std::string_view CACHE_FORMAT_VERSION_KEY("cache_format_version"); static const std::string_view CURRENT_ONLINE_BACKUP_VERSION("current_online_backup_version"); -constexpr auto MAX_DBS = 32384UL; -constexpr auto BATCH_SIZE = 100; +static constexpr auto MAX_DBS = 32384UL; +static constexpr auto BATCH_SIZE = 100; #if Q_PROCESSOR_WORDSIZE >= 5 // 40-bit or more, up to 2^(8*WORDSIZE) words addressable. -constexpr auto DB_SIZE = 32ULL * 1024ULL * 1024ULL * 1024ULL; // 32 GB -constexpr size_t MAX_RESTORED_MESSAGES = 30'000; +static constexpr auto DB_SIZE = 32ULL * 1024ULL * 1024ULL * 1024ULL; // 32 GB +static constexpr size_t MAX_RESTORED_MESSAGES = 30'000; #elif Q_PROCESSOR_WORDSIZE == 4 // 32-bit address space limits mmaps -constexpr auto DB_SIZE = 1ULL * 1024ULL * 1024ULL * 1024ULL; // 1 GB -constexpr size_t MAX_RESTORED_MESSAGES = 5'000; +static constexpr auto DB_SIZE = 1ULL * 1024ULL * 1024ULL * 1024ULL; // 1 GB +static constexpr size_t MAX_RESTORED_MESSAGES = 5'000; #else #error Not enough virtual address space for the database on target CPU #endif @@ -65,34 +65,34 @@ constexpr size_t MAX_RESTORED_MESSAGES = 5'000; //! //! Contains UI information for the joined rooms. (i.e name, topic, avatar url etc). //! Format: room_id -> RoomInfo -constexpr auto ROOMS_DB("rooms"); -constexpr auto INVITES_DB("invites"); +static constexpr auto ROOMS_DB("rooms"); +static constexpr auto INVITES_DB("invites"); //! maps each room to its parent space (id->id) -constexpr auto SPACES_PARENTS_DB("space_parents"); +static constexpr auto SPACES_PARENTS_DB("space_parents"); //! maps each space to its current children (id->id) -constexpr auto SPACES_CHILDREN_DB("space_children"); +static constexpr auto SPACES_CHILDREN_DB("space_children"); //! Information that must be kept between sync requests. -constexpr auto SYNC_STATE_DB("sync_state"); +static constexpr auto SYNC_STATE_DB("sync_state"); //! Read receipts per room/event. -constexpr auto READ_RECEIPTS_DB("read_receipts"); -constexpr auto NOTIFICATIONS_DB("sent_notifications"); -constexpr auto PRESENCE_DB("presence"); +static constexpr auto READ_RECEIPTS_DB("read_receipts"); +static constexpr auto NOTIFICATIONS_DB("sent_notifications"); +static constexpr auto PRESENCE_DB("presence"); //! Encryption related databases. //! user_id -> list of devices -constexpr auto DEVICES_DB("devices"); +static constexpr auto DEVICES_DB("devices"); //! device_id -> device keys -constexpr auto DEVICE_KEYS_DB("device_keys"); +static constexpr auto DEVICE_KEYS_DB("device_keys"); //! room_ids that have encryption enabled. -constexpr auto ENCRYPTED_ROOMS_DB("encrypted_rooms"); +static constexpr auto ENCRYPTED_ROOMS_DB("encrypted_rooms"); //! room_id -> pickled OlmInboundGroupSession -constexpr auto INBOUND_MEGOLM_SESSIONS_DB("inbound_megolm_sessions"); +static constexpr auto INBOUND_MEGOLM_SESSIONS_DB("inbound_megolm_sessions"); //! MegolmSessionIndex -> pickled OlmOutboundGroupSession -constexpr auto OUTBOUND_MEGOLM_SESSIONS_DB("outbound_megolm_sessions"); +static constexpr auto OUTBOUND_MEGOLM_SESSIONS_DB("outbound_megolm_sessions"); //! MegolmSessionIndex -> session data about which devices have access to this -constexpr auto MEGOLM_SESSIONS_DATA_DB("megolm_sessions_data_db"); +static constexpr auto MEGOLM_SESSIONS_DATA_DB("megolm_sessions_data_db"); using CachedReceipts = std::multimap>; using Receipts = std::map>; diff --git a/src/ChatPage.cpp b/src/ChatPage.cpp index 2f6d7410..12d83f49 100644 --- a/src/ChatPage.cpp +++ b/src/ChatPage.cpp @@ -34,10 +34,10 @@ #include "blurhash.hpp" -ChatPage *ChatPage::instance_ = nullptr; -constexpr int CHECK_CONNECTIVITY_INTERVAL = 15'000; -constexpr int RETRY_TIMEOUT = 5'000; -constexpr size_t MAX_ONETIME_KEYS = 50; +ChatPage *ChatPage::instance_ = nullptr; +static constexpr int CHECK_CONNECTIVITY_INTERVAL = 15'000; +static constexpr int RETRY_TIMEOUT = 5'000; +static constexpr size_t MAX_ONETIME_KEYS = 50; Q_DECLARE_METATYPE(std::optional) Q_DECLARE_METATYPE(std::optional) diff --git a/src/ChatPage.h b/src/ChatPage.h index 1922b1c3..0e17fccb 100644 --- a/src/ChatPage.h +++ b/src/ChatPage.h @@ -34,10 +34,6 @@ class NotificationsManager; class TimelineModel; class CallManager; -constexpr int CONSENSUS_TIMEOUT = 1000; -constexpr int SHOW_CONTENT_TIMEOUT = 3000; -constexpr int TYPING_REFRESH_TIMEOUT = 10000; - namespace mtx::requests { struct CreateRoom; } diff --git a/src/Logging.cpp b/src/Logging.cpp index 46df8399..60247c0c 100644 --- a/src/Logging.cpp +++ b/src/Logging.cpp @@ -19,14 +19,14 @@ #include namespace { -std::shared_ptr db_logger = nullptr; -std::shared_ptr net_logger = nullptr; -std::shared_ptr crypto_logger = nullptr; -std::shared_ptr ui_logger = nullptr; -std::shared_ptr qml_logger = nullptr; - -constexpr auto MAX_FILE_SIZE = 1024 * 1024 * 6; -constexpr auto MAX_LOG_FILES = 3; +static std::shared_ptr db_logger = nullptr; +static std::shared_ptr net_logger = nullptr; +static std::shared_ptr crypto_logger = nullptr; +static std::shared_ptr ui_logger = nullptr; +static std::shared_ptr qml_logger = nullptr; + +static constexpr auto MAX_FILE_SIZE = 1024 * 1024 * 6; +static constexpr auto MAX_LOG_FILES = 3; void qmlMessageHandler(QtMsgType type, const QMessageLogContext &context, const QString &msg) diff --git a/src/UserSettingsPage.h b/src/UserSettingsPage.h index b98296aa..8c8555cd 100644 --- a/src/UserSettingsPage.h +++ b/src/UserSettingsPage.h @@ -23,10 +23,6 @@ class QSpinBox; class QHBoxLayout; class QVBoxLayout; -constexpr int OptionMargin = 6; -constexpr int LayoutTopMargin = 50; -constexpr int LayoutBottomMargin = LayoutTopMargin; - class UserSettings final : public QObject { Q_OBJECT diff --git a/src/dbus/NhekoDBusApi.h b/src/dbus/NhekoDBusApi.h index 0cd64685..a96f431e 100644 --- a/src/dbus/NhekoDBusApi.h +++ b/src/dbus/NhekoDBusApi.h @@ -19,7 +19,7 @@ init(); //! The nheko D-Bus API version provided by this file. The API version number follows semantic //! versioning as defined by https://semver.org. -const QVersionNumber dbusApiVersion{1, 0, 1}; +inline const QVersionNumber dbusApiVersion{1, 0, 1}; //! Compare the installed Nheko API to the version that your client app targets to see if they //! are compatible.