From 4fd50cfb70c29e5546f030e116217cdc3e6bb36e Mon Sep 17 00:00:00 2001 From: John Preston Date: Fri, 19 Jul 2019 17:39:36 +0200 Subject: [PATCH] Fix build in Xcode. --- Telegram/SourceFiles/mtproto/connection.cpp | 2 +- Telegram/SourceFiles/mtproto/mtp_instance.cpp | 6 +++-- Telegram/SourceFiles/mtproto/rpc_sender.h | 22 +++++++++---------- Telegram/build/updates.py | 2 +- 4 files changed, 17 insertions(+), 15 deletions(-) diff --git a/Telegram/SourceFiles/mtproto/connection.cpp b/Telegram/SourceFiles/mtproto/connection.cpp index d4541a824..4010db34d 100644 --- a/Telegram/SourceFiles/mtproto/connection.cpp +++ b/Telegram/SourceFiles/mtproto/connection.cpp @@ -1637,7 +1637,7 @@ void ConnectionPrivate::handleReceived() { } ConnectionPrivate::HandleResult ConnectionPrivate::handleOneReceived(const mtpPrime *from, const mtpPrime *end, uint64 msgId, int32 serverTime, uint64 serverSalt, bool badTime) { - const auto cons = *from; + const auto cons = mtpTypeId(*from); switch (cons) { diff --git a/Telegram/SourceFiles/mtproto/mtp_instance.cpp b/Telegram/SourceFiles/mtproto/mtp_instance.cpp index 6564205eb..7a2c7fe15 100644 --- a/Telegram/SourceFiles/mtproto/mtp_instance.cpp +++ b/Telegram/SourceFiles/mtproto/mtp_instance.cpp @@ -1096,9 +1096,11 @@ bool Instance::Private::hasCallbacks(mtpRequestId requestId) { } void Instance::Private::globalCallback(const mtpPrime *from, const mtpPrime *end) { - if (_globalHandler.onDone) { - (*_globalHandler.onDone)(0, from, end); // some updates were received + if (!_globalHandler.onDone) { + return; } + // Handle updates. + [[maybe_unused]] bool result = (*_globalHandler.onDone)(0, from, end); } void Instance::Private::onStateChange(int32 dcWithShift, int32 state) { diff --git a/Telegram/SourceFiles/mtproto/rpc_sender.h b/Telegram/SourceFiles/mtproto/rpc_sender.h index 0e739eb92..b0c83d59a 100644 --- a/Telegram/SourceFiles/mtproto/rpc_sender.h +++ b/Telegram/SourceFiles/mtproto/rpc_sender.h @@ -67,7 +67,7 @@ inline bool isDefaultHandledError(const RPCError &error) { class RPCAbstractDoneHandler { // abstract done public: - virtual [[nodiscard]] bool operator()(mtpRequestId requestId, const mtpPrime *from, const mtpPrime *end) = 0; + [[nodiscard]] virtual bool operator()(mtpRequestId requestId, const mtpPrime *from, const mtpPrime *end) = 0; virtual ~RPCAbstractDoneHandler() { } @@ -476,7 +476,7 @@ private: }; -template +template class RPCBindedDoneHandlerBareOwnedReq : public RPCOwnedDoneHandler { // done(b, from, end, req_id) using CallbackType = bool (TReceiver::*)(T, const mtpPrime *, const mtpPrime *, mtpRequestId); @@ -718,9 +718,9 @@ public: return RPCDoneHandlerPtr(new RPCDoneHandlerBareOwned(static_cast(this), onDone)); } - template // done(from, end, req_id) - RPCDoneHandlerPtr rpcDone(TReturn (TReceiver::*onDone)(const mtpPrime *, const mtpPrime *, mtpRequestId)) { - return RPCDoneHandlerPtr(new RPCDoneHandlerBareOwnedReq(static_cast(this), onDone)); + template // done(from, end, req_id) + RPCDoneHandlerPtr rpcDone(bool (TReceiver::*onDone)(const mtpPrime *, const mtpPrime *, mtpRequestId)) { + return RPCDoneHandlerPtr(new RPCDoneHandlerBareOwnedReq(static_cast(this), onDone)); } template // done(result) @@ -763,14 +763,14 @@ public: return RPCFailHandlerPtr(new RPCFailHandlerOwnedNo(static_cast(this), onFail)); } - template // done(b, from, end) - RPCDoneHandlerPtr rpcDone(TReturn (TReceiver::*onDone)(T, const mtpPrime *, const mtpPrime *), T b) { - return RPCDoneHandlerPtr(new RPCBindedDoneHandlerBareOwned(b, static_cast(this), onDone)); + template // done(b, from, end) + RPCDoneHandlerPtr rpcDone(bool (TReceiver::*onDone)(T, const mtpPrime *, const mtpPrime *), T b) { + return RPCDoneHandlerPtr(new RPCBindedDoneHandlerBareOwned(b, static_cast(this), onDone)); } - template // done(b, from, end, req_id) - RPCDoneHandlerPtr rpcDone(TReturn (TReceiver::*onDone)(T, const mtpPrime *, const mtpPrime *, mtpRequestId), T b) { - return RPCDoneHandlerPtr(new RPCBindedDoneHandlerBareOwnedReq(b, static_cast(this), onDone)); + template // done(b, from, end, req_id) + RPCDoneHandlerPtr rpcDone(bool (TReceiver::*onDone)(T, const mtpPrime *, const mtpPrime *, mtpRequestId), T b) { + return RPCDoneHandlerPtr(new RPCBindedDoneHandlerBareOwnedReq(b, static_cast(this), onDone)); } template // done(b, result) diff --git a/Telegram/build/updates.py b/Telegram/build/updates.py index d497d8b14..69a3f15f5 100644 --- a/Telegram/build/updates.py +++ b/Telegram/build/updates.py @@ -187,7 +187,7 @@ if composing: if not os.path.exists(templatePath): finish(1, 'Template file "' + templatePath + '" not found.') - if not re.match(r'^[a-f0-9]{40}$', lastCommit): + if not re.match(r'^[a-f0-9]{9,40}$', lastCommit): finish(1, 'Wrong last commit: ' + lastCommit) log = subprocess.check_output(['git', 'log', lastCommit+'..HEAD'])