2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-09-05 00:46:08 +00:00

Make all owned MTPD types immutable.

Remove custom refcounting in mtpData, use std::shared_ptr instead.
This commit is contained in:
John Preston
2017-03-09 21:13:55 +03:00
parent 839bf313cf
commit 3b373e236e
9 changed files with 7191 additions and 9237 deletions

View File

@@ -206,13 +206,15 @@ void Session::sendPong(quint64 msgId, quint64 pingId) {
}
void Session::sendMsgsStateInfo(quint64 msgId, QByteArray data) {
MTPMsgsStateInfo req(MTP_msgs_state_info(MTP_long(msgId), MTPstring()));
auto &info = req._msgs_state_info().vinfo._string().v;
info.resize(data.size());
auto info = std::string();
if (!data.isEmpty()) {
memcpy(&info[0], data.constData(), data.size());
info.resize(data.size());
auto src = gsl::as_bytes(gsl::make_span(data));
// auto dst = gsl::as_writeable_bytes(gsl::make_span(info));
auto dst = gsl::as_writeable_bytes(gsl::make_span(&info[0], info.size()));
base::copy_bytes(dst, src);
}
send(req);
send(MTPMsgsStateInfo(MTP_msgs_state_info(MTP_long(msgId), MTP_string(std::move(info)))));
}
void Session::checkRequestsByTimer() {