From 50bce25838f080ccb1e5ff865c8120220a2e98f7 Mon Sep 17 00:00:00 2001 From: Nicolas Werner Date: Sun, 29 Oct 2023 20:38:54 +0100 Subject: [PATCH] Fix a few conversions --- src/Utils.cpp | 3 ++- src/timeline/EventStore.cpp | 1 + src/timeline/EventStore.h | 13 ++++++------- src/timeline/TimelineModel.h | 1 + 4 files changed, 10 insertions(+), 8 deletions(-) diff --git a/src/Utils.cpp b/src/Utils.cpp index ec73c901..bb4df7d3 100644 --- a/src/Utils.cpp +++ b/src/Utils.cpp @@ -632,7 +632,8 @@ rainbowify(cmark_node *node) // get correct color for char index // Use colors as described here: // https://shark.comfsm.fm/~dleeling/cis/hsl_rainbow.html - auto color = QColor::fromHslF((charIdx - 1.0) / textLen * (5. / 6.), 0.9, 0.5); + auto color = QColor::fromHslF( + static_cast((charIdx - 1.0) / textLen * (5. / 6.)), 0.9f, 0.5f); // format color for HTML auto colorString = color.name(QColor::NameFormat::HexRgb); // create HTML element for current char diff --git a/src/timeline/EventStore.cpp b/src/timeline/EventStore.cpp index 3db70f77..c47a3426 100644 --- a/src/timeline/EventStore.cpp +++ b/src/timeline/EventStore.cpp @@ -15,6 +15,7 @@ #include "EventAccessors.h" #include "Logging.h" #include "MatrixClient.h" +#include "Reaction.h" #include "UserSettingsPage.h" #include "Utils.h" diff --git a/src/timeline/EventStore.h b/src/timeline/EventStore.h index ee92a795..5f86d35f 100644 --- a/src/timeline/EventStore.h +++ b/src/timeline/EventStore.h @@ -16,7 +16,6 @@ #include #include -#include "Reaction.h" #include "encryption/Olm.h" class EventStore final : public QObject @@ -29,7 +28,7 @@ public: void refetchOnlineKeyBackupKeys(); // taken from QtPrivate::QHashCombine - static uint hashCombine(uint hash, uint seed) + static size_t hashCombine(uint hash, uint seed) { return seed ^ (hash + 0x9e3779b9 + (seed << 6) + (seed >> 2)); }; @@ -38,9 +37,9 @@ public: std::string room; uint64_t idx; - friend uint qHash(const Index &i, uint seed = 0) noexcept + friend size_t qHash(const Index &i, size_t seed = 0) noexcept { - seed = hashCombine(qHashBits(i.room.data(), (int)i.room.size(), seed), seed); + seed = hashCombine(qHashBits(i.room.data(), i.room.size(), seed), seed); seed = hashCombine(qHash(i.idx, seed), seed); return seed; } @@ -54,10 +53,10 @@ public: { std::string room, id; - friend uint qHash(const IdIndex &i, uint seed = 0) noexcept + friend size_t qHash(const IdIndex &i, size_t seed = 0) noexcept { - seed = hashCombine(qHashBits(i.room.data(), (int)i.room.size(), seed), seed); - seed = hashCombine(qHashBits(i.id.data(), (int)i.id.size(), seed), seed); + seed = hashCombine(qHashBits(i.room.data(), i.room.size(), seed), seed); + seed = hashCombine(qHashBits(i.id.data(), i.id.size(), seed), seed); return seed; } diff --git a/src/timeline/TimelineModel.h b/src/timeline/TimelineModel.h index b9a48327..cb500270 100644 --- a/src/timeline/TimelineModel.h +++ b/src/timeline/TimelineModel.h @@ -19,6 +19,7 @@ #include "EventStore.h" #include "InputBar.h" #include "Permissions.h" +#include "Reaction.h" #include "ReadReceiptsModel.h" #include "ui/RoomSummary.h"