Fix a few clang tidy warnings

This commit is contained in:
Nicolas Werner 2021-12-04 04:39:09 +01:00
parent f36b3836a6
commit b2b9cccb5e
No known key found for this signature in database
GPG Key ID: C8D75E610773F2D9
3 changed files with 6 additions and 12 deletions

View File

@ -1857,16 +1857,12 @@ Cache::getTimelineMessages(lmdb::txn &txn, const std::string &room_id, uint64_t
auto cursor = lmdb::cursor::open(txn, orderDb); auto cursor = lmdb::cursor::open(txn, orderDb);
if (index == std::numeric_limits<uint64_t>::max()) { if (index == std::numeric_limits<uint64_t>::max()) {
if (cursor.get(indexVal, event_id, forward ? MDB_FIRST : MDB_LAST)) { if (!cursor.get(indexVal, event_id, forward ? MDB_FIRST : MDB_LAST)) {
index = lmdb::from_sv<uint64_t>(indexVal);
} else {
messages.end_of_cache = true; messages.end_of_cache = true;
return messages; return messages;
} }
} else { } else {
if (cursor.get(indexVal, event_id, MDB_SET)) { if (!cursor.get(indexVal, event_id, MDB_SET)) {
index = lmdb::from_sv<uint64_t>(indexVal);
} else {
messages.end_of_cache = true; messages.end_of_cache = true;
return messages; return messages;
} }

View File

@ -42,7 +42,7 @@ MainWindow::MainWindow(QWidget *parent)
{ {
instance_ = this; instance_ = this;
setWindowTitle(0); QMainWindow::setWindowTitle(0);
setObjectName("MainWindow"); setObjectName("MainWindow");
modal_ = new OverlayModal(this); modal_ = new OverlayModal(this);
@ -353,7 +353,7 @@ MainWindow::showSolidOverlayModal(QWidget *content, QFlags<Qt::AlignmentFlag> fl
bool bool
MainWindow::hasActiveDialogs() const MainWindow::hasActiveDialogs() const
{ {
return !modal_ && modal_->isVisible(); return modal_ && modal_->isVisible();
} }
bool bool

View File

@ -476,11 +476,9 @@ utils::markdownToHtml(const QString &text, bool rainbowify)
// create iterator over node // create iterator over node
cmark_iter *iter = cmark_iter_new(node); cmark_iter *iter = cmark_iter_new(node);
cmark_event_type ev_type;
// First loop to get total text length // First loop to get total text length
int textLen = 0; 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); cmark_node *cur = cmark_iter_get_node(iter);
// only text nodes (no code or semilar) // only text nodes (no code or semilar)
if (cmark_node_get_type(cur) != CMARK_NODE_TEXT) if (cmark_node_get_type(cur) != CMARK_NODE_TEXT)
@ -498,7 +496,7 @@ utils::markdownToHtml(const QString &text, bool rainbowify)
// Second loop to rainbowify // Second loop to rainbowify
int charIdx = 0; 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); cmark_node *cur = cmark_iter_get_node(iter);
// only text nodes (no code or semilar) // only text nodes (no code or semilar)
if (cmark_node_get_type(cur) != CMARK_NODE_TEXT) if (cmark_node_get_type(cur) != CMARK_NODE_TEXT)