From 904cafcd392c498f6f2ee2e7da061b98524857bc Mon Sep 17 00:00:00 2001 From: Nicolas Werner Date: Fri, 25 Dec 2020 04:11:47 +0100 Subject: [PATCH] lint --- src/BlurhashProvider.cpp | 3 ++- src/Cache.cpp | 20 ++++++++++++-------- src/CommunitiesList.cpp | 3 ++- src/Utils.cpp | 5 +++-- src/popups/SuggestionsPopup.cpp | 3 ++- src/timeline/EventStore.h | 6 ++++-- 6 files changed, 25 insertions(+), 15 deletions(-) diff --git a/src/BlurhashProvider.cpp b/src/BlurhashProvider.cpp index cc7d5a73..acaef400 100644 --- a/src/BlurhashProvider.cpp +++ b/src/BlurhashProvider.cpp @@ -31,7 +31,8 @@ BlurhashResponse::run() return; } - QImage image(decoded.image.data(), (int)decoded.width, (int)decoded.height, QImage::Format_RGB32); + QImage image( + decoded.image.data(), (int)decoded.width, (int)decoded.height, QImage::Format_RGB32); m_image = image.copy(); emit finished(); diff --git a/src/Cache.cpp b/src/Cache.cpp index 3099b0c9..3f8d5d96 100644 --- a/src/Cache.cpp +++ b/src/Cache.cpp @@ -1259,7 +1259,8 @@ Cache::saveState(const mtx::responses::Sync &res) nhlog::db()->warn( "failed to parse room info: room_id ({}), {}: {}", room.first, - std::string(data.data(), data.size()), e.what()); + std::string(data.data(), data.size()), + e.what()); } } } @@ -1460,7 +1461,8 @@ Cache::singleRoomInfo(const std::string &room_id) } catch (const json::exception &e) { nhlog::db()->warn("failed to parse room info: room_id ({}), {}: {}", room_id, - std::string(data.data(), data.size()), e.what()); + std::string(data.data(), data.size()), + e.what()); } } @@ -1494,7 +1496,8 @@ Cache::getRoomInfo(const std::vector &rooms) } catch (const json::exception &e) { nhlog::db()->warn("failed to parse room info: room_id ({}), {}: {}", room, - std::string(data.data(), data.size()), e.what()); + std::string(data.data(), data.size()), + e.what()); } } else { // Check if the room is an invite. @@ -1507,10 +1510,11 @@ Cache::getRoomInfo(const std::vector &rooms) room_info.emplace(QString::fromStdString(room), std::move(tmp)); } catch (const json::exception &e) { - nhlog::db()->warn( - "failed to parse room info for invite: room_id ({}), {}: {}", - room, - std::string(data.data(), data.size()), e.what()); + nhlog::db()->warn("failed to parse room info for invite: " + "room_id ({}), {}: {}", + room, + std::string(data.data(), data.size()), + e.what()); } } } @@ -2043,7 +2047,7 @@ Cache::getRoomName(lmdb::txn &txn, lmdb::dbi &statesdb, lmdb::dbi &membersdb) } } - auto cursor = lmdb::cursor::open(txn, membersdb); + auto cursor = lmdb::cursor::open(txn, membersdb); const auto total = membersdb.size(txn); std::size_t ii = 0; diff --git a/src/CommunitiesList.cpp b/src/CommunitiesList.cpp index 010200c8..f3af9932 100644 --- a/src/CommunitiesList.cpp +++ b/src/CommunitiesList.cpp @@ -104,7 +104,8 @@ CommunitiesList::setTagsForRoom(const QString &room_id, const std::vectorfirst.right(static_cast(it->first.size() - strlen("tag:"))).toStdString(); + it->first.right(static_cast(it->first.size() - strlen("tag:"))) + .toStdString(); if (std::find(tags.begin(), tags.end(), current_tag) != tags.end()) { // the room has this tag it->second->addRoom(room_id); diff --git a/src/Utils.cpp b/src/Utils.cpp index 7228faf4..3bb090df 100644 --- a/src/Utils.cpp +++ b/src/Utils.cpp @@ -388,8 +388,9 @@ utils::escapeBlacklistedHtml(const QString &rawStr) switch (data.at(pos)) { case '<': { bool oneTagMatched = false; - const int endPos = static_cast(std::min(static_cast(data.indexOf('>', pos)), - static_cast(data.indexOf(' ', pos)))); + const int endPos = + static_cast(std::min(static_cast(data.indexOf('>', pos)), + static_cast(data.indexOf(' ', pos)))); auto mid = data.mid(pos + 1, endPos - pos - 1); for (const auto &tag : allowedTags) { diff --git a/src/popups/SuggestionsPopup.cpp b/src/popups/SuggestionsPopup.cpp index 42efe6ce..8add4313 100644 --- a/src/popups/SuggestionsPopup.cpp +++ b/src/popups/SuggestionsPopup.cpp @@ -150,7 +150,8 @@ SuggestionsPopup::removeLayoutItemsAfter(size_t startingPos) size_t posToRemove = layout_->count() - 1; QLayoutItem *item; - while (startingPos <= posToRemove && (item = layout_->takeAt((int)posToRemove)) != nullptr) { + while (startingPos <= posToRemove && + (item = layout_->takeAt((int)posToRemove)) != nullptr) { delete item->widget(); delete item; diff --git a/src/timeline/EventStore.h b/src/timeline/EventStore.h index a71e95d5..c6b39742 100644 --- a/src/timeline/EventStore.h +++ b/src/timeline/EventStore.h @@ -29,7 +29,8 @@ public: friend uint qHash(const Index &i, uint seed = 0) noexcept { QtPrivate::QHashCombine hash; - seed = hash(seed, QByteArray::fromRawData(i.room.data(), (int)i.room.size())); + seed = + hash(seed, QByteArray::fromRawData(i.room.data(), (int)i.room.size())); seed = hash(seed, i.idx); return seed; } @@ -46,7 +47,8 @@ public: friend uint qHash(const IdIndex &i, uint seed = 0) noexcept { QtPrivate::QHashCombine hash; - seed = hash(seed, QByteArray::fromRawData(i.room.data(), (int)i.room.size())); + seed = + hash(seed, QByteArray::fromRawData(i.room.data(), (int)i.room.size())); seed = hash(seed, QByteArray::fromRawData(i.id.data(), (int)i.id.size())); return seed; }