2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-08-31 22:46:10 +00:00

Use 48 bit [User/Chat/Channel]Id, 56 bit PeerId.

This commit is contained in:
John Preston
2021-04-02 01:04:10 +04:00
parent 61d0cc38b0
commit 1342077dcb
83 changed files with 904 additions and 475 deletions

View File

@@ -365,11 +365,14 @@ QByteArray WallPaper::serialize() const {
+ Serialize::stringSize(_slug)
+ sizeof(qint32) // _settings
+ sizeof(quint32) // _backgroundColor
+ sizeof(qint32); // _intensity
+ sizeof(qint32) // _intensity
+ (2 * sizeof(qint32)); // ownerId
auto result = QByteArray();
result.reserve(size);
{
const auto field1 = qint32(uint32(_ownerId.bare & 0xFFFFFFFF));
const auto field2 = qint32(uint32(_ownerId.bare >> 32));
auto stream = QDataStream(&result, QIODevice::WriteOnly);
stream.setVersion(QDataStream::Qt_5_1);
stream
@@ -380,7 +383,8 @@ QByteArray WallPaper::serialize() const {
<< qint32(_settings)
<< SerializeMaybeColor(_backgroundColor)
<< qint32(_intensity)
<< qint32(_ownerId);
<< field1
<< field2;
}
return result;
}
@@ -393,7 +397,7 @@ std::optional<WallPaper> WallPaper::FromSerialized(
auto id = quint64();
auto accessHash = quint64();
auto ownerId = qint32();
auto ownerId = UserId();
auto flags = qint32();
auto slug = QString();
auto settings = qint32();
@@ -411,7 +415,14 @@ std::optional<WallPaper> WallPaper::FromSerialized(
>> backgroundColor
>> intensity;
if (!stream.atEnd()) {
stream >> ownerId;
auto field1 = qint32();
auto field2 = qint32();
stream >> field1;
if (!stream.atEnd()) {
stream >> field2;
}
ownerId = UserId(
BareId(uint32(field1)) | (BareId(uint32(field2)) << 32));
}
if (stream.status() != QDataStream::Ok) {
return std::nullopt;