This commit is contained in:
Nicolas Werner 2020-12-25 04:11:47 +01:00
parent be9df45af9
commit 904cafcd39
6 changed files with 25 additions and 15 deletions

View File

@ -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();

View File

@ -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<std::string> &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<std::string> &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;

View File

@ -104,7 +104,8 @@ CommunitiesList::setTagsForRoom(const QString &room_id, const std::vector<std::s
}
// insert or remove the room from the tag as appropriate
std::string current_tag =
it->first.right(static_cast<int>(it->first.size() - strlen("tag:"))).toStdString();
it->first.right(static_cast<int>(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);

View File

@ -388,8 +388,9 @@ utils::escapeBlacklistedHtml(const QString &rawStr)
switch (data.at(pos)) {
case '<': {
bool oneTagMatched = false;
const int endPos = static_cast<int>(std::min(static_cast<size_t>(data.indexOf('>', pos)),
static_cast<size_t>(data.indexOf(' ', pos))));
const int endPos =
static_cast<int>(std::min(static_cast<size_t>(data.indexOf('>', pos)),
static_cast<size_t>(data.indexOf(' ', pos))));
auto mid = data.mid(pos + 1, endPos - pos - 1);
for (const auto &tag : allowedTags) {

View File

@ -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;

View File

@ -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;
}