|
|
|
@ -675,7 +675,7 @@ Cache::image(lmdb::txn &txn, const std::string &url) const |
|
|
|
|
if (!res) |
|
|
|
|
return QByteArray(); |
|
|
|
|
|
|
|
|
|
return QByteArray(image.data(), image.size()); |
|
|
|
|
return QByteArray(image.data(), (int)image.size()); |
|
|
|
|
} catch (const lmdb::error &e) { |
|
|
|
|
nhlog::db()->critical("image: {}, {}", e.what(), url); |
|
|
|
|
} |
|
|
|
@ -703,7 +703,7 @@ Cache::image(const QString &url) const |
|
|
|
|
if (!res) |
|
|
|
|
return QByteArray(); |
|
|
|
|
|
|
|
|
|
return QByteArray(image.data(), image.size()); |
|
|
|
|
return QByteArray(image.data(), (int)image.size()); |
|
|
|
|
} catch (const lmdb::error &e) { |
|
|
|
|
nhlog::db()->critical("image: {} {}", e.what(), url.toStdString()); |
|
|
|
|
} |
|
|
|
@ -1257,9 +1257,9 @@ Cache::saveState(const mtx::responses::Sync &res) |
|
|
|
|
updatedInfo.tags = tmp.tags; |
|
|
|
|
} catch (const json::exception &e) { |
|
|
|
|
nhlog::db()->warn( |
|
|
|
|
"failed to parse room info: room_id ({}), {}", |
|
|
|
|
"failed to parse room info: room_id ({}), {}: {}", |
|
|
|
|
room.first, |
|
|
|
|
std::string(data.data(), data.size())); |
|
|
|
|
std::string(data.data(), data.size()), e.what()); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
@ -1458,9 +1458,9 @@ Cache::singleRoomInfo(const std::string &room_id) |
|
|
|
|
|
|
|
|
|
return tmp; |
|
|
|
|
} 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, |
|
|
|
|
std::string(data.data(), data.size())); |
|
|
|
|
std::string(data.data(), data.size()), e.what()); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -1492,9 +1492,9 @@ 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: room_id ({}), {}", |
|
|
|
|
nhlog::db()->warn("failed to parse room info: room_id ({}), {}: {}", |
|
|
|
|
room, |
|
|
|
|
std::string(data.data(), data.size())); |
|
|
|
|
std::string(data.data(), data.size()), e.what()); |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
// Check if the room is an invite.
|
|
|
|
@ -1508,9 +1508,9 @@ Cache::getRoomInfo(const std::vector<std::string> &rooms) |
|
|
|
|
std::move(tmp)); |
|
|
|
|
} catch (const json::exception &e) { |
|
|
|
|
nhlog::db()->warn( |
|
|
|
|
"failed to parse room info for invite: room_id ({}), {}", |
|
|
|
|
"failed to parse room info for invite: room_id ({}), {}: {}", |
|
|
|
|
room, |
|
|
|
|
std::string(data.data(), data.size())); |
|
|
|
|
std::string(data.data(), data.size()), e.what()); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
@ -2044,7 +2044,7 @@ Cache::getRoomName(lmdb::txn &txn, lmdb::dbi &statesdb, lmdb::dbi &membersdb) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
auto cursor = lmdb::cursor::open(txn, membersdb); |
|
|
|
|
const int total = membersdb.size(txn); |
|
|
|
|
const auto total = membersdb.size(txn); |
|
|
|
|
|
|
|
|
|
std::size_t ii = 0; |
|
|
|
|
std::string user_id; |
|
|
|
@ -2327,7 +2327,7 @@ Cache::getRoomAvatar(const std::string &room_id) |
|
|
|
|
|
|
|
|
|
txn.commit(); |
|
|
|
|
|
|
|
|
|
return QImage::fromData(QByteArray(response.data(), response.size())); |
|
|
|
|
return QImage::fromData(QByteArray(response.data(), (int)response.size())); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
std::vector<std::string> |
|
|
|
|