mirror of
https://github.com/Nheko-Reborn/nheko.git
synced 2024-11-25 20:48:52 +03:00
lint
This commit is contained in:
parent
be9df45af9
commit
904cafcd39
6 changed files with 25 additions and 15 deletions
|
@ -31,7 +31,8 @@ BlurhashResponse::run()
|
||||||
return;
|
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();
|
m_image = image.copy();
|
||||||
emit finished();
|
emit finished();
|
||||||
|
|
|
@ -1259,7 +1259,8 @@ Cache::saveState(const mtx::responses::Sync &res)
|
||||||
nhlog::db()->warn(
|
nhlog::db()->warn(
|
||||||
"failed to parse room info: room_id ({}), {}: {}",
|
"failed to parse room info: room_id ({}), {}: {}",
|
||||||
room.first,
|
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) {
|
} catch (const json::exception &e) {
|
||||||
nhlog::db()->warn("failed to parse room info: room_id ({}), {}: {}",
|
nhlog::db()->warn("failed to parse room info: room_id ({}), {}: {}",
|
||||||
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) {
|
} catch (const json::exception &e) {
|
||||||
nhlog::db()->warn("failed to parse room info: room_id ({}), {}: {}",
|
nhlog::db()->warn("failed to parse room info: room_id ({}), {}: {}",
|
||||||
room,
|
room,
|
||||||
std::string(data.data(), data.size()), e.what());
|
std::string(data.data(), data.size()),
|
||||||
|
e.what());
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// Check if the room is an invite.
|
// 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),
|
room_info.emplace(QString::fromStdString(room),
|
||||||
std::move(tmp));
|
std::move(tmp));
|
||||||
} catch (const json::exception &e) {
|
} catch (const json::exception &e) {
|
||||||
nhlog::db()->warn(
|
nhlog::db()->warn("failed to parse room info for invite: "
|
||||||
"failed to parse room info for invite: room_id ({}), {}: {}",
|
"room_id ({}), {}: {}",
|
||||||
room,
|
room,
|
||||||
std::string(data.data(), data.size()), e.what());
|
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);
|
const auto total = membersdb.size(txn);
|
||||||
|
|
||||||
std::size_t ii = 0;
|
std::size_t ii = 0;
|
||||||
|
|
|
@ -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
|
// insert or remove the room from the tag as appropriate
|
||||||
std::string current_tag =
|
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()) {
|
if (std::find(tags.begin(), tags.end(), current_tag) != tags.end()) {
|
||||||
// the room has this tag
|
// the room has this tag
|
||||||
it->second->addRoom(room_id);
|
it->second->addRoom(room_id);
|
||||||
|
|
|
@ -388,8 +388,9 @@ utils::escapeBlacklistedHtml(const QString &rawStr)
|
||||||
switch (data.at(pos)) {
|
switch (data.at(pos)) {
|
||||||
case '<': {
|
case '<': {
|
||||||
bool oneTagMatched = false;
|
bool oneTagMatched = false;
|
||||||
const int endPos = static_cast<int>(std::min(static_cast<size_t>(data.indexOf('>', pos)),
|
const int endPos =
|
||||||
static_cast<size_t>(data.indexOf(' ', pos))));
|
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);
|
auto mid = data.mid(pos + 1, endPos - pos - 1);
|
||||||
for (const auto &tag : allowedTags) {
|
for (const auto &tag : allowedTags) {
|
||||||
|
|
|
@ -150,7 +150,8 @@ SuggestionsPopup::removeLayoutItemsAfter(size_t startingPos)
|
||||||
size_t posToRemove = layout_->count() - 1;
|
size_t posToRemove = layout_->count() - 1;
|
||||||
|
|
||||||
QLayoutItem *item;
|
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->widget();
|
||||||
delete item;
|
delete item;
|
||||||
|
|
||||||
|
|
|
@ -29,7 +29,8 @@ public:
|
||||||
friend uint qHash(const Index &i, uint seed = 0) noexcept
|
friend uint qHash(const Index &i, uint seed = 0) noexcept
|
||||||
{
|
{
|
||||||
QtPrivate::QHashCombine hash;
|
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);
|
seed = hash(seed, i.idx);
|
||||||
return seed;
|
return seed;
|
||||||
}
|
}
|
||||||
|
@ -46,7 +47,8 @@ public:
|
||||||
friend uint qHash(const IdIndex &i, uint seed = 0) noexcept
|
friend uint qHash(const IdIndex &i, uint seed = 0) noexcept
|
||||||
{
|
{
|
||||||
QtPrivate::QHashCombine hash;
|
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()));
|
seed = hash(seed, QByteArray::fromRawData(i.id.data(), (int)i.id.size()));
|
||||||
return seed;
|
return seed;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue