Fix build for GCC.

This commit is contained in:
John Preston 2019-07-27 17:01:25 +02:00
parent f29b331470
commit 2a8b6f05c8
1 changed files with 8 additions and 6 deletions

View File

@ -343,15 +343,17 @@ protected:
};
template <typename TReturn, typename TReceiver>
template <typename TReceiver>
class RPCDoneHandlerBareOwned : public RPCOwnedDoneHandler { // done(from, end)
using CallbackType = TReturn (TReceiver::*)(const mtpPrime *, const mtpPrime *);
using CallbackType = bool (TReceiver::*)(const mtpPrime *, const mtpPrime *);
public:
RPCDoneHandlerBareOwned(TReceiver *receiver, CallbackType onDone) : RPCOwnedDoneHandler(receiver), _onDone(onDone) {
}
bool operator()(mtpRequestId requestId, const mtpPrime *from, const mtpPrime *end) override {
if (_owner) (static_cast<TReceiver*>(_owner)->*_onDone)(from, end);
return _owner
? (static_cast<TReceiver*>(_owner)->*_onDone)(from, end)
: true;
}
private:
@ -713,9 +715,9 @@ private:
class RPCSender {
public:
template <typename TReturn, typename TReceiver> // done(from, end)
RPCDoneHandlerPtr rpcDone(TReturn (TReceiver::*onDone)(const mtpPrime *, const mtpPrime *)) {
return RPCDoneHandlerPtr(new RPCDoneHandlerBareOwned<TReturn, TReceiver>(static_cast<TReceiver*>(this), onDone));
template <typename TReceiver> // done(from, end)
RPCDoneHandlerPtr rpcDone(bool (TReceiver::*onDone)(const mtpPrime *, const mtpPrime *)) {
return RPCDoneHandlerPtr(new RPCDoneHandlerBareOwned<TReceiver>(static_cast<TReceiver*>(this), onDone));
}
template <typename TReceiver> // done(from, end, req_id)