From b2b9cccb5e3f28f7863f03ccc3da8af226e6e650 Mon Sep 17 00:00:00 2001 From: Nicolas Werner Date: Sat, 4 Dec 2021 04:39:09 +0100 Subject: [PATCH] Fix a few clang tidy warnings --- src/Cache.cpp | 8 ++------ src/MainWindow.cpp | 4 ++-- src/Utils.cpp | 6 ++---- 3 files changed, 6 insertions(+), 12 deletions(-) diff --git a/src/Cache.cpp b/src/Cache.cpp index 4f96f430..f22afc7f 100644 --- a/src/Cache.cpp +++ b/src/Cache.cpp @@ -1857,16 +1857,12 @@ Cache::getTimelineMessages(lmdb::txn &txn, const std::string &room_id, uint64_t auto cursor = lmdb::cursor::open(txn, orderDb); if (index == std::numeric_limits::max()) { - if (cursor.get(indexVal, event_id, forward ? MDB_FIRST : MDB_LAST)) { - index = lmdb::from_sv(indexVal); - } else { + if (!cursor.get(indexVal, event_id, forward ? MDB_FIRST : MDB_LAST)) { messages.end_of_cache = true; return messages; } } else { - if (cursor.get(indexVal, event_id, MDB_SET)) { - index = lmdb::from_sv(indexVal); - } else { + if (!cursor.get(indexVal, event_id, MDB_SET)) { messages.end_of_cache = true; return messages; } diff --git a/src/MainWindow.cpp b/src/MainWindow.cpp index ae2e4e5d..a08371cb 100644 --- a/src/MainWindow.cpp +++ b/src/MainWindow.cpp @@ -42,7 +42,7 @@ MainWindow::MainWindow(QWidget *parent) { instance_ = this; - setWindowTitle(0); + QMainWindow::setWindowTitle(0); setObjectName("MainWindow"); modal_ = new OverlayModal(this); @@ -353,7 +353,7 @@ MainWindow::showSolidOverlayModal(QWidget *content, QFlags fl bool MainWindow::hasActiveDialogs() const { - return !modal_ && modal_->isVisible(); + return modal_ && modal_->isVisible(); } bool diff --git a/src/Utils.cpp b/src/Utils.cpp index 27f0c42f..aebb1bc6 100644 --- a/src/Utils.cpp +++ b/src/Utils.cpp @@ -476,11 +476,9 @@ utils::markdownToHtml(const QString &text, bool rainbowify) // create iterator over node cmark_iter *iter = cmark_iter_new(node); - cmark_event_type ev_type; - // First loop to get total text length int textLen = 0; - while ((ev_type = cmark_iter_next(iter)) != CMARK_EVENT_DONE) { + while (cmark_iter_next(iter) != CMARK_EVENT_DONE) { cmark_node *cur = cmark_iter_get_node(iter); // only text nodes (no code or semilar) if (cmark_node_get_type(cur) != CMARK_NODE_TEXT) @@ -498,7 +496,7 @@ utils::markdownToHtml(const QString &text, bool rainbowify) // Second loop to rainbowify int charIdx = 0; - while ((ev_type = cmark_iter_next(iter)) != CMARK_EVENT_DONE) { + while (cmark_iter_next(iter) != CMARK_EVENT_DONE) { cmark_node *cur = cmark_iter_get_node(iter); // only text nodes (no code or semilar) if (cmark_node_get_type(cur) != CMARK_NODE_TEXT)