mirror of
https://github.com/telegramdesktop/tdesktop
synced 2025-01-10 08:51:12 +00:00
Update to the latest submodules.
This commit is contained in:
parent
6a0c7f3909
commit
88e0342e02
@ -630,7 +630,7 @@ void StickerSetBox::Inner::paintSticker(
|
||||
auto h = 1;
|
||||
if (element.animated && !document->dimensions.isEmpty()) {
|
||||
const auto request = Lottie::FrameRequest{ boundingBoxSize() * cIntRetinaFactor() };
|
||||
const auto size = request.size(document->dimensions) / cIntRetinaFactor();
|
||||
const auto size = request.size(document->dimensions, true) / cIntRetinaFactor();
|
||||
w = std::max(size.width(), 1);
|
||||
h = std::max(size.height(), 1);
|
||||
} else {
|
||||
|
@ -651,7 +651,7 @@ void FieldAutocompleteInner::paintEvent(QPaintEvent *e) {
|
||||
auto h = 1;
|
||||
if (sticker.animated && !document->dimensions.isEmpty()) {
|
||||
const auto request = Lottie::FrameRequest{ stickerBoundingBox() * cIntRetinaFactor() };
|
||||
const auto size = request.size(document->dimensions) / cIntRetinaFactor();
|
||||
const auto size = request.size(document->dimensions, true) / cIntRetinaFactor();
|
||||
w = std::max(size.width(), 1);
|
||||
h = std::max(size.height(), 1);
|
||||
} else {
|
||||
|
@ -1677,7 +1677,7 @@ void StickersListWidget::paintSticker(Painter &p, Set &set, int y, int section,
|
||||
auto h = 1;
|
||||
if (sticker.animated && !document->dimensions.isEmpty()) {
|
||||
const auto request = Lottie::FrameRequest{ boundingBoxSize() * cIntRetinaFactor() };
|
||||
const auto size = request.size(document->dimensions) / cIntRetinaFactor();
|
||||
const auto size = request.size(document->dimensions, true) / cIntRetinaFactor();
|
||||
w = std::max(size.width(), 1);
|
||||
h = std::max(size.height(), 1);
|
||||
} else {
|
||||
|
@ -21,6 +21,12 @@ void BaseIntegration::enterFromEventLoop(FnMut<void()> &&method) {
|
||||
std::move(method));
|
||||
}
|
||||
|
||||
void BaseIntegration::logMessage(const QString &message) {
|
||||
#ifdef DEBUG_LOG
|
||||
DEBUG_LOG((message));
|
||||
#endif // DEBUG_LOG
|
||||
}
|
||||
|
||||
void BaseIntegration::logAssertionViolation(const QString &info) {
|
||||
#ifdef LOG
|
||||
LOG(("Assertion Failed! ") + info);
|
||||
|
@ -16,6 +16,7 @@ public:
|
||||
BaseIntegration(int argc, char *argv[]);
|
||||
|
||||
void enterFromEventLoop(FnMut<void()> &&method) override;
|
||||
void logMessage(const QString &message) override;
|
||||
void logAssertionViolation(const QString &info) override;
|
||||
|
||||
};
|
||||
|
@ -225,7 +225,7 @@ ModExpFirst CreateModExp(
|
||||
void wrapInvokeAfter(SecureRequest &to, const SecureRequest &from, const RequestMap &haveSent, int32 skipBeforeRequest = 0) {
|
||||
const auto afterId = *(mtpMsgId*)(from->after->data() + 4);
|
||||
const auto i = afterId ? haveSent.constFind(afterId) : haveSent.cend();
|
||||
int32 size = to->size(), lenInInts = (from.innerLength() >> 2), headlen = 4, fulllen = headlen + lenInInts;
|
||||
int32 size = to->size(), lenInInts = (tl::count_length(from) >> 2), headlen = 4, fulllen = headlen + lenInInts;
|
||||
if (i == haveSent.constEnd()) { // no invoke after or such msg was not sent or was completed recently
|
||||
to->resize(size + fulllen + skipBeforeRequest);
|
||||
if (skipBeforeRequest) {
|
||||
@ -882,7 +882,7 @@ void ConnectionPrivate::tryToSend() {
|
||||
MTP_string(cloudLangCode),
|
||||
clientProxyFields,
|
||||
SecureRequest());
|
||||
initSizeInInts = (initWrapper.innerLength() >> 2) + 2;
|
||||
initSizeInInts = (tl::count_length(initWrapper) >> 2) + 2;
|
||||
initSize = initSizeInInts * sizeof(mtpPrime);
|
||||
}
|
||||
|
||||
@ -932,7 +932,7 @@ void ConnectionPrivate::tryToSend() {
|
||||
|
||||
if (needsLayer && !toSendRequest->needsLayer) needsLayer = false;
|
||||
if (toSendRequest->after) {
|
||||
const auto toSendSize = toSendRequest.innerLength() >> 2;
|
||||
const auto toSendSize = tl::count_length(toSendRequest) >> 2;
|
||||
auto wrappedRequest = SecureRequest::Prepare(
|
||||
toSendSize,
|
||||
toSendSize + 3);
|
||||
@ -942,13 +942,13 @@ void ConnectionPrivate::tryToSend() {
|
||||
toSendRequest = std::move(wrappedRequest);
|
||||
}
|
||||
if (needsLayer) {
|
||||
const auto noWrapSize = (toSendRequest.innerLength() >> 2);
|
||||
const auto noWrapSize = (tl::count_length(toSendRequest) >> 2);
|
||||
const auto toSendSize = noWrapSize + initSizeInInts;
|
||||
auto wrappedRequest = SecureRequest::Prepare(toSendSize);
|
||||
memcpy(wrappedRequest->data(), toSendRequest->constData(), 7 * sizeof(mtpPrime)); // all except length
|
||||
wrappedRequest->push_back(mtpc_invokeWithLayer);
|
||||
wrappedRequest->push_back(internal::CurrentLayer);
|
||||
initWrapper.write(*wrappedRequest);
|
||||
initWrapper.write<mtpBuffer>(*wrappedRequest);
|
||||
wrappedRequest->resize(wrappedRequest->size() + noWrapSize);
|
||||
memcpy(wrappedRequest->data() + wrappedRequest->size() - noWrapSize, toSendRequest->constData() + 8, noWrapSize * sizeof(mtpPrime));
|
||||
toSendRequest = std::move(wrappedRequest);
|
||||
@ -980,7 +980,7 @@ void ConnectionPrivate::tryToSend() {
|
||||
initSerialized.reserve(initSizeInInts);
|
||||
initSerialized.push_back(mtpc_invokeWithLayer);
|
||||
initSerialized.push_back(internal::CurrentLayer);
|
||||
initWrapper.write(initSerialized);
|
||||
initWrapper.write<mtpBuffer>(initSerialized);
|
||||
}
|
||||
// prepare container + each in invoke after
|
||||
toSendRequest = SecureRequest::Prepare(
|
||||
@ -1038,7 +1038,7 @@ void ConnectionPrivate::tryToSend() {
|
||||
toSendRequest->resize(reqNeedsLayer + initSizeInInts + req.messageSize());
|
||||
memcpy(toSendRequest->data() + reqNeedsLayer, req->constData() + 4, 4 * sizeof(mtpPrime));
|
||||
memcpy(toSendRequest->data() + reqNeedsLayer + 4, initSerialized.constData(), initSize);
|
||||
memcpy(toSendRequest->data() + reqNeedsLayer + 4 + initSizeInInts, req->constData() + 8, req.innerLength());
|
||||
memcpy(toSendRequest->data() + reqNeedsLayer + 4 + initSizeInInts, req->constData() + 8, tl::count_length(req));
|
||||
*(toSendRequest->data() + reqNeedsLayer + 3) += initSize;
|
||||
added = true;
|
||||
}
|
||||
@ -2701,7 +2701,7 @@ void ConnectionPrivate::pqAnswered() {
|
||||
bytes::vector ConnectionPrivate::encryptPQInnerRSA(
|
||||
const MTPP_Q_inner_data &data,
|
||||
const internal::RSAPublicKey &key) {
|
||||
auto p_q_inner_size = data.innerLength();
|
||||
auto p_q_inner_size = tl::count_length(data);
|
||||
auto encSize = (p_q_inner_size >> 2) + 6;
|
||||
if (encSize >= 65) {
|
||||
auto tmp = mtpBuffer();
|
||||
@ -2760,7 +2760,7 @@ void ConnectionPrivate::dhParamsAnswered() {
|
||||
return restart();
|
||||
}
|
||||
|
||||
uint32 nlen = _authKeyData->new_nonce.innerLength(), slen = _authKeyData->server_nonce.innerLength();
|
||||
uint32 nlen = tl::count_length(_authKeyData->new_nonce), slen = tl::count_length(_authKeyData->server_nonce);
|
||||
uchar tmp_aes[1024], sha1ns[20], sha1sn[20], sha1nn[20];
|
||||
memcpy(tmp_aes, &_authKeyData->new_nonce, nlen);
|
||||
memcpy(tmp_aes + nlen, &_authKeyData->server_nonce, slen);
|
||||
@ -2889,7 +2889,7 @@ void ConnectionPrivate::dhClientParamsSend() {
|
||||
}
|
||||
|
||||
std::string ConnectionPrivate::encryptClientDHInner(const MTPClient_DH_Inner_Data &data) {
|
||||
auto client_dh_inner_size = data.innerLength();
|
||||
auto client_dh_inner_size = tl::count_length(data);
|
||||
auto encSize = (client_dh_inner_size >> 2) + 5;
|
||||
auto encFullSize = encSize;
|
||||
if (encSize & 0x03) {
|
||||
|
@ -145,7 +145,7 @@ template <typename Request>
|
||||
mtpBuffer AbstractConnection::prepareNotSecurePacket(
|
||||
const Request &request,
|
||||
mtpMsgId newId) const {
|
||||
const auto intsSize = request.innerLength() >> 2;
|
||||
const auto intsSize = tl::count_length(request) >> 2;
|
||||
const auto intsPadding = requiresExtendedPadding()
|
||||
? uint32(rand_value<uchar>() & 0x3F)
|
||||
: 0;
|
||||
|
@ -52,25 +52,6 @@ SecureRequest SecureRequest::Prepare(uint32 size, uint32 reserveSize) {
|
||||
return result;
|
||||
}
|
||||
|
||||
uint32 SecureRequest::innerLength() const {
|
||||
if (!_data || _data->size() <= kMessageBodyPosition) {
|
||||
return 0;
|
||||
}
|
||||
return (*_data)[kMessageLengthPosition];
|
||||
}
|
||||
|
||||
void SecureRequest::write(mtpBuffer &to) const {
|
||||
if (!_data || _data->size() <= kMessageBodyPosition) {
|
||||
return;
|
||||
}
|
||||
uint32 was = to.size(), s = innerLength() / sizeof(mtpPrime);
|
||||
to.resize(was + s);
|
||||
memcpy(
|
||||
to.data() + was,
|
||||
_data->constData() + kMessageBodyPosition,
|
||||
s * sizeof(mtpPrime));
|
||||
}
|
||||
|
||||
SecureRequestData *SecureRequest::operator->() const {
|
||||
Expects(_data != nullptr);
|
||||
|
||||
@ -90,7 +71,7 @@ SecureRequest::operator bool() const {
|
||||
void SecureRequest::addPadding(bool extended) {
|
||||
if (_data->size() <= kMessageBodyPosition) return;
|
||||
|
||||
const auto requestSize = (innerLength() >> 2);
|
||||
const auto requestSize = (tl::count_length(*this) >> 2);
|
||||
const auto padding = CountPaddingAmountInInts(requestSize, extended);
|
||||
const auto fullSize = kMessageBodyPosition + requestSize + padding;
|
||||
if (uint32(_data->size()) != fullSize) {
|
||||
@ -107,7 +88,7 @@ uint32 SecureRequest::messageSize() const {
|
||||
if (_data->size() <= kMessageBodyPosition) {
|
||||
return 0;
|
||||
}
|
||||
const auto ints = (innerLength() >> 2);
|
||||
const auto ints = (tl::count_length(*this) >> 2);
|
||||
return kMessageIdInts + kSeqNoInts + kMessageLengthInts + ints;
|
||||
}
|
||||
|
||||
@ -145,64 +126,20 @@ bool SecureRequest::needAck() const {
|
||||
return true;
|
||||
}
|
||||
|
||||
size_t SecureRequest::sizeInBytes() const {
|
||||
return (_data && _data->size() > kMessageBodyPosition)
|
||||
? (*_data)[kMessageLengthPosition]
|
||||
: 0;
|
||||
}
|
||||
|
||||
const void *SecureRequest::dataInBytes() const {
|
||||
return (_data && _data->size() > kMessageBodyPosition)
|
||||
? (_data->constData() + kMessageBodyPosition)
|
||||
: nullptr;
|
||||
}
|
||||
|
||||
} // namespace MTP
|
||||
|
||||
uint32 MTPstring::innerLength() const {
|
||||
uint32 l = v.length();
|
||||
if (l < 254) {
|
||||
l += 1;
|
||||
} else {
|
||||
l += 4;
|
||||
}
|
||||
uint32 d = l & 0x03;
|
||||
if (d) l += (4 - d);
|
||||
return l;
|
||||
}
|
||||
|
||||
bool MTPstring::read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) {
|
||||
if (from + 1 > end || cons != mtpc_string) {
|
||||
return false;
|
||||
}
|
||||
|
||||
uint32 l;
|
||||
const uchar *buf = (const uchar*)from;
|
||||
if (buf[0] == 254) {
|
||||
l = (uint32)buf[1] + ((uint32)buf[2] << 8) + ((uint32)buf[3] << 16);
|
||||
buf += 4;
|
||||
from += ((l + 4) >> 2) + (((l + 4) & 0x03) ? 1 : 0);
|
||||
} else {
|
||||
l = (uint32)buf[0];
|
||||
++buf;
|
||||
from += ((l + 1) >> 2) + (((l + 1) & 0x03) ? 1 : 0);
|
||||
}
|
||||
if (from > end) {
|
||||
return false;
|
||||
}
|
||||
|
||||
v = QByteArray(reinterpret_cast<const char*>(buf), l);
|
||||
return true;
|
||||
}
|
||||
|
||||
void MTPstring::write(mtpBuffer &to) const {
|
||||
uint32 l = v.length(), s = l + ((l < 254) ? 1 : 4), was = to.size();
|
||||
if (s & 0x03) {
|
||||
s += 4;
|
||||
}
|
||||
s >>= 2;
|
||||
to.resize(was + s);
|
||||
char *buf = (char*)&to[was];
|
||||
if (l < 254) {
|
||||
uchar sl = (uchar)l;
|
||||
*(buf++) = *(char*)(&sl);
|
||||
} else {
|
||||
*(buf++) = (char)254;
|
||||
*(buf++) = (char)(l & 0xFF);
|
||||
*(buf++) = (char)((l >> 8) & 0xFF);
|
||||
*(buf++) = (char)((l >> 16) & 0xFF);
|
||||
}
|
||||
memcpy(buf, v.constData(), l);
|
||||
}
|
||||
|
||||
bool mtpTextSerializeCore(MTPStringLogger &to, const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons, uint32 level, mtpPrime vcons) {
|
||||
switch (mtpTypeId(cons)) {
|
||||
case mtpc_int: {
|
||||
|
@ -156,8 +156,12 @@ public:
|
||||
static SecureRequest Serialize(const Request &request);
|
||||
|
||||
// For template MTP requests and MTPBoxed instanciation.
|
||||
uint32 innerLength() const;
|
||||
void write(mtpBuffer &to) const;
|
||||
template <typename Accumulator>
|
||||
void write(Accumulator &to) const {
|
||||
if (const auto size = sizeInBytes()) {
|
||||
tl::Writer<Accumulator>::PutBytes(to, dataInBytes(), size);
|
||||
}
|
||||
}
|
||||
|
||||
SecureRequestData *operator->() const;
|
||||
SecureRequestData &operator*() const;
|
||||
@ -176,6 +180,9 @@ public:
|
||||
private:
|
||||
explicit SecureRequest(const details::SecureRequestCreateTag &);
|
||||
|
||||
[[nodiscard]] size_t sizeInBytes() const;
|
||||
[[nodiscard]] const void *dataInBytes() const;
|
||||
|
||||
std::shared_ptr<SecureRequestData> _data;
|
||||
|
||||
};
|
||||
@ -197,9 +204,9 @@ public:
|
||||
|
||||
template <typename Request, typename>
|
||||
SecureRequest SecureRequest::Serialize(const Request &request) {
|
||||
const auto requestSize = request.innerLength() >> 2;
|
||||
const auto requestSize = tl::count_length(request) >> 2;
|
||||
auto serialized = Prepare(requestSize);
|
||||
request.write(*serialized);
|
||||
request.template write<mtpBuffer>(*serialized);
|
||||
return serialized;
|
||||
}
|
||||
|
||||
@ -394,3 +401,62 @@ inline QString mtpTextSerialize(const mtpPrime *&from, const mtpPrime *end) {
|
||||
[[maybe_unused]] bool result = mtpTextSerializeType(to, from, end, mtpc_core_message);
|
||||
return QString::fromUtf8(to.p, to.size);
|
||||
}
|
||||
|
||||
namespace tl {
|
||||
|
||||
template <typename Accumulator>
|
||||
struct Writer;
|
||||
|
||||
template <typename Prime>
|
||||
struct Reader;
|
||||
|
||||
template <>
|
||||
struct Writer<mtpBuffer> {
|
||||
static void PutBytes(mtpBuffer &to, const void *bytes, uint32 count) {
|
||||
constexpr auto kPrime = sizeof(uint32);
|
||||
const auto primes = (count / kPrime) + (count % kPrime ? 1 : 0);
|
||||
const auto size = to.size();
|
||||
to.resize(size + primes);
|
||||
memcpy(to.data() + size, bytes, count);
|
||||
}
|
||||
static void Put(mtpBuffer &to, uint32 value) {
|
||||
to.push_back(mtpPrime(value));
|
||||
}
|
||||
};
|
||||
|
||||
template <>
|
||||
struct Reader<mtpPrime> final {
|
||||
[[nodiscard]] static bool HasBytes(
|
||||
uint32 count,
|
||||
const mtpPrime *from,
|
||||
const mtpPrime *end) {
|
||||
constexpr auto kPrime = sizeof(uint32);
|
||||
const auto primes = (count / kPrime) + (count % kPrime ? 1 : 0);
|
||||
return (end - from) >= primes;
|
||||
}
|
||||
static void GetBytes(
|
||||
void *bytes,
|
||||
uint32 count,
|
||||
const mtpPrime *&from,
|
||||
const mtpPrime *end) {
|
||||
Expects(HasBytes(count, from, end));
|
||||
|
||||
constexpr auto kPrime = sizeof(uint32);
|
||||
const auto primes = (count / kPrime) + (count % kPrime ? 1 : 0);
|
||||
memcpy(bytes, from, count);
|
||||
from += primes;
|
||||
}
|
||||
[[nodiscard]] static bool Has(
|
||||
uint32 primes,
|
||||
const mtpPrime *from,
|
||||
const mtpPrime *end) {
|
||||
return (end - from) >= primes;
|
||||
}
|
||||
[[nodiscard]] static uint32 Get(const mtpPrime *&from, const mtpPrime *end) {
|
||||
Expects(from < end);
|
||||
|
||||
return uint32(*from++);
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace tl
|
||||
|
@ -1 +1 @@
|
||||
Subproject commit 3a61c3a32c51e652f639ae506201a31db48359f1
|
||||
Subproject commit f1202034e2466475eee86b03d880c8c5d9d56988
|
@ -123,9 +123,9 @@
|
||||
'<!@(<(list_sources_command) <(qt_moc_list_sources_arg) --exclude_for <(build_os))',
|
||||
],
|
||||
'conditions': [
|
||||
[ '"<(official_build_target)" != ""', {
|
||||
[ '"<(special_build_target)" != ""', {
|
||||
'defines': [
|
||||
'TDESKTOP_OFFICIAL_TARGET=<(official_build_target)',
|
||||
'TDESKTOP_OFFICIAL_TARGET=<(special_build_target)',
|
||||
'TDESKTOP_FORCE_GTK_FILE_DIALOG',
|
||||
],
|
||||
'dependencies': [
|
||||
|
@ -85,7 +85,7 @@ gypArguments.append('-Goutput_dir=../out')
|
||||
gypArguments.append('-Dapi_id=' + apiId)
|
||||
gypArguments.append('-Dapi_hash=' + apiHash)
|
||||
gypArguments.append('-Dlottie_use_cache=1')
|
||||
gypArguments.append('-Dofficial_build_target=' + officialTarget)
|
||||
gypArguments.append('-Dspecial_build_target=' + officialTarget)
|
||||
if 'TDESKTOP_BUILD_DEFINES' in os.environ:
|
||||
buildDefines = os.environ['TDESKTOP_BUILD_DEFINES']
|
||||
gypArguments.append('-Dbuild_defines=' + buildDefines)
|
||||
|
@ -1 +1 @@
|
||||
Subproject commit f70c0fda21bfe9d011bb1ff780f476826bb5f8a2
|
||||
Subproject commit be301940b8e5ac46c52f205e40d4f7ad307912af
|
@ -19,7 +19,6 @@
|
||||
'variables': {
|
||||
'src_loc': '../SourceFiles',
|
||||
'res_loc': '../Resources',
|
||||
'official_build_target%': '',
|
||||
'pch_source': '<(src_loc)/export/export_pch.cpp',
|
||||
'pch_header': '<(src_loc)/export/export_pch.h',
|
||||
},
|
||||
|
@ -40,9 +40,9 @@
|
||||
'<(src_loc)/ffmpeg/ffmpeg_utility.cpp',
|
||||
'<(src_loc)/ffmpeg/ffmpeg_utility.h',
|
||||
],
|
||||
'conditions': [[ '"<(official_build_target)" != ""', {
|
||||
'conditions': [[ '"<(special_build_target)" != ""', {
|
||||
'defines': [
|
||||
'TDESKTOP_OFFICIAL_TARGET=<(official_build_target)',
|
||||
'TDESKTOP_OFFICIAL_TARGET=<(special_build_target)',
|
||||
],
|
||||
}], [ 'build_macold', {
|
||||
'xcode_settings': {
|
||||
|
@ -14,7 +14,6 @@
|
||||
'helpers/common/library.gypi',
|
||||
],
|
||||
'variables': {
|
||||
'official_build_target%': '',
|
||||
'lz4_loc': '<(third_party_loc)/lz4/lib',
|
||||
},
|
||||
'defines': [
|
||||
|
@ -1 +1 @@
|
||||
Subproject commit 26f277d633ed23dd87c4a332f1ee2d4ec57ec10b
|
||||
Subproject commit 11a5031d22cd6405525cef93c8d681c485320a77
|
@ -1 +1 @@
|
||||
Subproject commit 378df3676fc578abbae120bcbc5b38c7263ecee3
|
||||
Subproject commit 440d088d5d377fe4bddd20e6f3ef32c4174fb27e
|
@ -1 +1 @@
|
||||
Subproject commit 5c820ee0a0902e2511f7c1c040801c133900496d
|
||||
Subproject commit 94efb93b07ca46a3f0142cf75059093f8dfe6f06
|
@ -1 +1 @@
|
||||
Subproject commit ab4e30d38914142d6abbb64389a00cd6f8ef55d2
|
||||
Subproject commit 89a1e3fed24bc0bfc268fa0352e7d2658ee4ef22
|
Loading…
Reference in New Issue
Block a user