From 23fafdf575a9224fa0b0241b9434e01e35da99af Mon Sep 17 00:00:00 2001 From: Daniil Gentili Date: Sun, 29 Mar 2020 16:55:33 +0200 Subject: [PATCH] Mark more methods as override, fixes for android --- Android.mk | 3 +- Makefile.am | 2 +- Makefile.in | 7 +- TgVoip.cpp | 6 +- VoIPController.h | 6 -- audio/AudioIO.h | 2 +- controller/audio/AudioPacketSender.h | 5 ++ controller/audio/EchoCanceller.h | 76 ++++++++--------- controller/audio/OpusDecoder.cpp | 5 ++ controller/audio/OpusDecoder.h | 102 +++++++++++------------ controller/audio/OpusEncoder.cpp | 2 +- controller/media/MediaStreamItf.h | 98 +++++++++++----------- controller/net/NetworkSocket.h | 34 ++++---- controller/protocol/protocol/Extra.h | 22 ++--- controller/protocol/protocol/Interface.h | 16 ++-- libtgvoip.gyp | 2 +- os/posix/NetworkSocketPosix.h | 2 +- 17 files changed, 197 insertions(+), 193 deletions(-) diff --git a/Android.mk b/Android.mk index bb0d2b5..1325503 100644 --- a/Android.mk +++ b/Android.mk @@ -1,7 +1,7 @@ LOCAL_PATH := $(call my-dir) LOCAL_MODULE := voip -LOCAL_CPPFLAGS := -Wall -std=c++11 -DANDROID -finline-functions -ffast-math -Os -fno-strict-aliasing -O3 -frtti -D__STDC_LIMIT_MACROS -Wno-unknown-pragmas +LOCAL_CPPFLAGS := -Wall -std=c++17 -DANDROID -finline-functions -ffast-math -Os -fno-strict-aliasing -O3 -frtti -D__STDC_LIMIT_MACROS -Wno-unknown-pragmas LOCAL_CFLAGS := -O3 -DUSE_KISS_FFT -fexceptions -DWEBRTC_APM_DEBUG_DUMP=0 -DWEBRTC_POSIX -DWEBRTC_ANDROID -D__STDC_LIMIT_MACROS -DFIXED_POINT -DWEBRTC_NS_FLOAT LOCAL_EXPORT_LDLIBS := -llog -lOpenSLES @@ -23,7 +23,6 @@ LOCAL_CFLAGS += $(TGVOIP_ADDITIONAL_CFLAGS) LOCAL_SRC_FILES := \ ./tools/logging.cpp \ ./VoIPController.cpp \ -./VoIPGroupController.cpp \ ./tools/Buffers.cpp \ ./tools/BlockingQueue.cpp \ ./audio/AudioInput.cpp \ diff --git a/Makefile.am b/Makefile.am index 7fd878f..4cb54cb 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,6 +1,6 @@ AUTOMAKE_OPTIONS = foreign -CFLAGS = -Wall -DHAVE_CONFIG_H -Wno-unknown-pragmas -g +CFLAGS = -Wall -DHAVE_CONFIG_H -Wno-unknown-pragmas -g -Wsuggest-override lib_LTLIBRARIES = libtgvoip.la diff --git a/Makefile.in b/Makefile.in index 537ff29..15ab89c 100644 --- a/Makefile.in +++ b/Makefile.in @@ -2274,9 +2274,10 @@ CCAS = @CCAS@ CCASDEPMODE = @CCASDEPMODE@ CCASFLAGS = @CCASFLAGS@ $(am__append_9) $(am__append_20) CCDEPMODE = @CCDEPMODE@ -CFLAGS = -Wall -DHAVE_CONFIG_H -Wno-unknown-pragmas -g $(am__append_8) \ - $(am__append_11) $(am__append_13) $(am__append_15) \ - $(am__append_19) $(am__append_24) +CFLAGS = -Wall -DHAVE_CONFIG_H -Wno-unknown-pragmas -g \ + -Wsuggest-override $(am__append_8) $(am__append_11) \ + $(am__append_13) $(am__append_15) $(am__append_19) \ + $(am__append_24) CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ diff --git a/TgVoip.cpp b/TgVoip.cpp index a6bd11a..98eb279 100755 --- a/TgVoip.cpp +++ b/TgVoip.cpp @@ -10,10 +10,10 @@ #ifndef TGVOIP_USE_CUSTOM_CRYPTO extern "C" { -#include #include #include #include +#include } void tgvoip_openssl_aes_ige_encrypt(uint8_t *in, uint8_t *out, size_t length, uint8_t *key, uint8_t *iv) @@ -198,13 +198,13 @@ public: { } - void setOnStateUpdated(std::function onStateUpdated) + void setOnStateUpdated(std::function onStateUpdated) override { std::lock_guard lock(m_onStateUpdated); onStateUpdated_ = onStateUpdated; } - void setOnSignalBarsUpdated(std::function onSignalBarsUpdated) + void setOnSignalBarsUpdated(std::function onSignalBarsUpdated) override { std::lock_guard lock(m_onSignalBarsUpdated); onSignalBarsUpdated_ = onSignalBarsUpdated; diff --git a/VoIPController.h b/VoIPController.h index 72de04e..7d61286 100755 --- a/VoIPController.h +++ b/VoIPController.h @@ -13,12 +13,6 @@ #include "controller/protocol/VersionInfo.h" #include "controller/protocol/protocol/Index.h" -#if defined HAVE_CONFIG_H || defined TGVOIP_USE_INSTALLED_OPUS -#include -#else -#include -#endif - #ifdef __ANDROID__ #include "controller/net/NetworkSocket.h" #include "os/android/AudioInputAndroid.h" diff --git a/audio/AudioIO.h b/audio/AudioIO.h index f34bbcc..b6f0e73 100644 --- a/audio/AudioIO.h +++ b/audio/AudioIO.h @@ -55,7 +55,7 @@ public: return input; } - virtual std::shared_ptr *GetOutput() + virtual std::shared_ptr GetOutput() { return output; } diff --git a/controller/audio/AudioPacketSender.h b/controller/audio/AudioPacketSender.h index 4ff2857..405580a 100644 --- a/controller/audio/AudioPacketSender.h +++ b/controller/audio/AudioPacketSender.h @@ -4,6 +4,11 @@ #include "../protocol/packets/PacketSender.h" #include #include +#if defined HAVE_CONFIG_H || defined TGVOIP_USE_INSTALLED_OPUS +#include +#else +#include "opus.h" +#endif namespace tgvoip { diff --git a/controller/audio/EchoCanceller.h b/controller/audio/EchoCanceller.h index 7265036..2891b8d 100755 --- a/controller/audio/EchoCanceller.h +++ b/controller/audio/EchoCanceller.h @@ -7,10 +7,10 @@ #ifndef LIBTGVOIP_ECHOCANCELLER_H #define LIBTGVOIP_ECHOCANCELLER_H -#include "tools/threading.h" -#include "tools/Buffers.h" -#include "tools/BlockingQueue.h" #include "controller/media/MediaStreamItf.h" +#include "tools/BlockingQueue.h" +#include "tools/Buffers.h" +#include "tools/threading.h" #include "tools/utils.h" namespace webrtc @@ -25,32 +25,32 @@ class EchoCanceller { public: - TGVOIP_DISALLOW_COPY_AND_ASSIGN(EchoCanceller); - EchoCanceller(bool enableAEC, bool enableNS, bool enableAGC); - virtual ~EchoCanceller(); - virtual void Start(); - virtual void Stop(); - void SpeakerOutCallback(unsigned char *data, size_t len); - void Enable(bool enabled); - void ProcessInput(int16_t *inOut, size_t numSamples, bool &hasVoice); - void SetAECStrength(int strength); - void SetVoiceDetectionEnabled(bool enabled); + TGVOIP_DISALLOW_COPY_AND_ASSIGN(EchoCanceller); + EchoCanceller(bool enableAEC, bool enableNS, bool enableAGC); + virtual ~EchoCanceller(); + virtual void Start(); + virtual void Stop(); + void SpeakerOutCallback(unsigned char *data, size_t len); + void Enable(bool enabled); + void ProcessInput(int16_t *inOut, size_t numSamples, bool &hasVoice); + void SetAECStrength(int strength); + void SetVoiceDetectionEnabled(bool enabled); private: - bool enableAEC; - bool enableAGC; - bool enableNS; - bool enableVAD = false; - bool isOn; + bool enableAEC; + bool enableAGC; + bool enableNS; + bool enableVAD = false; + bool isOn; #ifndef TGVOIP_NO_DSP - webrtc::AudioProcessing *apm = NULL; - webrtc::AudioFrame *audioFrame = NULL; - void RunBufferFarendThread(); - bool didBufferFarend; - Thread *bufferFarendThread; - BlockingQueue *farendQueue; - BufferPool<960 * 2, 10> farendBufferPool; - bool running; + webrtc::AudioProcessing *apm = NULL; + webrtc::AudioFrame *audioFrame = NULL; + void RunBufferFarendThread(); + bool didBufferFarend; + Thread *bufferFarendThread; + BlockingQueue *farendQueue; + BufferPool<960 * 2, 10> farendBufferPool; + bool running; #endif }; @@ -60,29 +60,29 @@ namespace effects class AudioEffect { public: - virtual ~AudioEffect() = 0; - virtual void Process(int16_t *inOut, size_t numSamples) = 0; - virtual void SetPassThrough(bool passThrough); + virtual ~AudioEffect() = 0; + virtual void Process(int16_t *inOut, size_t numSamples) = 0; + virtual void SetPassThrough(bool passThrough); protected: - bool passThrough = false; + bool passThrough = false; }; class Volume : public AudioEffect { public: - Volume(); - virtual ~Volume(); - virtual void Process(int16_t *inOut, size_t numSamples); - /** + Volume(); + virtual ~Volume(); + virtual void Process(int16_t *inOut, size_t numSamples) override; + /** * Level is (0.0, 2.0] */ - void SetLevel(float level); - float GetLevel(); + void SetLevel(float level); + float GetLevel(); private: - float level = 1.0f; - float multiplier = 1.0f; + float level = 1.0f; + float multiplier = 1.0f; }; } // namespace effects diff --git a/controller/audio/OpusDecoder.cpp b/controller/audio/OpusDecoder.cpp index d8fc38c..7155025 100755 --- a/controller/audio/OpusDecoder.cpp +++ b/controller/audio/OpusDecoder.cpp @@ -11,6 +11,11 @@ #include #include +#if defined HAVE_CONFIG_H || defined TGVOIP_USE_INSTALLED_OPUS +#include +#else +#include "opus.h" +#endif #include "VoIPController.h" #define PACKET_SIZE (960 * 2) diff --git a/controller/audio/OpusDecoder.h b/controller/audio/OpusDecoder.h index 1d43662..73b8a01 100755 --- a/controller/audio/OpusDecoder.h +++ b/controller/audio/OpusDecoder.h @@ -7,17 +7,17 @@ #ifndef LIBTGVOIP_OPUSDECODER_H #define LIBTGVOIP_OPUSDECODER_H +#include "controller/audio/EchoCanceller.h" #include "controller/media/MediaStreamItf.h" -#include "tools/threading.h" +#include "controller/net/JitterBuffer.h" #include "tools/BlockingQueue.h" #include "tools/Buffers.h" -#include "controller/audio/EchoCanceller.h" -#include "controller/net/JitterBuffer.h" +#include "tools/threading.h" #include "tools/utils.h" +#include +#include #include #include -#include -#include struct OpusDecoder; @@ -27,56 +27,56 @@ namespace tgvoip class OpusDecoder { public: - TGVOIP_DISALLOW_COPY_AND_ASSIGN(OpusDecoder); - virtual void Start(); + TGVOIP_DISALLOW_COPY_AND_ASSIGN(OpusDecoder); + virtual void Start(); - virtual void Stop(); + virtual void Stop(); - OpusDecoder(const std::shared_ptr &dst, bool isAsync, bool needEC); - OpusDecoder(const std::unique_ptr &dst, bool isAsync, bool needEC); - virtual ~OpusDecoder(); - size_t HandleCallback(unsigned char *data, size_t len); - void SetEchoCanceller(const std::shared_ptr &canceller); - void SetFrameDuration(uint32_t duration); - void SetJitterBuffer(const std::shared_ptr &jitterBuffer); - void SetDTX(bool enable); - void SetLevelMeter(const std::shared_ptr &levelMeter); - void AddAudioEffect(const std::shared_ptr &effect); - void RemoveAudioEffect(const std::shared_ptr &effect); + OpusDecoder(const std::shared_ptr &dst, bool isAsync, bool needEC); + OpusDecoder(const std::unique_ptr &dst, bool isAsync, bool needEC); + virtual ~OpusDecoder(); + size_t HandleCallback(unsigned char *data, size_t len); + void SetEchoCanceller(const std::shared_ptr &canceller); + void SetFrameDuration(uint32_t duration); + void SetJitterBuffer(const std::shared_ptr &jitterBuffer); + void SetDTX(bool enable); + void SetLevelMeter(const std::shared_ptr &levelMeter); + void AddAudioEffect(const std::shared_ptr &effect); + void RemoveAudioEffect(const std::shared_ptr &effect); private: - void Initialize(bool isAsync, bool needEC); - static size_t Callback(unsigned char *data, size_t len, void *param); - void RunThread(); - int DecodeNextFrame(); - ::OpusDecoder *dec; - ::OpusDecoder *ecDec; - BlockingQueue *decodedQueue; - BufferPool<960 * 2, 32> bufferPool; - unsigned char *buffer; - unsigned char *lastDecoded; - unsigned char *processedBuffer; - size_t outputBufferSize; - std::atomic running; - Thread *thread; - Semaphore *semaphore; - uint32_t frameDuration; - std::shared_ptr echoCanceller; - std::shared_ptr jitterBuffer; - std::shared_ptr levelMeter; - int consecutiveLostPackets; - bool enableDTX; - size_t silentPacketCount; - std::vector> postProcEffects; - //bool async; - std::atomic async; - alignas(2) unsigned char nextBuffer[8192]; - alignas(2) unsigned char decodeBuffer[8192]; - size_t nextLen; - unsigned int packetsPerFrame; - ptrdiff_t remainingDataLen; - bool prevWasEC; - int16_t prevLastSample; + void Initialize(bool isAsync, bool needEC); + static size_t Callback(unsigned char *data, size_t len, void *param); + void RunThread(); + int DecodeNextFrame(); + ::OpusDecoder *dec; + ::OpusDecoder *ecDec; + BlockingQueue *decodedQueue; + BufferPool<960 * 2, 32> bufferPool; + unsigned char *buffer; + unsigned char *lastDecoded; + unsigned char *processedBuffer; + size_t outputBufferSize; + std::atomic running; + Thread *thread; + Semaphore *semaphore; + uint32_t frameDuration; + std::shared_ptr echoCanceller; + std::shared_ptr jitterBuffer; + std::shared_ptr levelMeter; + int consecutiveLostPackets; + bool enableDTX; + size_t silentPacketCount; + std::vector> postProcEffects; + //bool async; + std::atomic async; + alignas(2) unsigned char nextBuffer[8192]; + alignas(2) unsigned char decodeBuffer[8192]; + size_t nextLen; + unsigned int packetsPerFrame; + ptrdiff_t remainingDataLen; + bool prevWasEC; + int16_t prevLastSample; }; } // namespace tgvoip diff --git a/controller/audio/OpusEncoder.cpp b/controller/audio/OpusEncoder.cpp index 0e2b5a4..cd5655d 100755 --- a/controller/audio/OpusEncoder.cpp +++ b/controller/audio/OpusEncoder.cpp @@ -12,7 +12,7 @@ #if defined HAVE_CONFIG_H || defined TGVOIP_USE_INSTALLED_OPUS #include #else -#include +#include "opus.h" #endif namespace diff --git a/controller/media/MediaStreamItf.h b/controller/media/MediaStreamItf.h index d16f7d7..f266836 100644 --- a/controller/media/MediaStreamItf.h +++ b/controller/media/MediaStreamItf.h @@ -7,13 +7,13 @@ #ifndef LIBTGVOIP_MEDIASTREAMINPUT_H #define LIBTGVOIP_MEDIASTREAMINPUT_H -#include -#include -#include -#include -#include "tools/threading.h" #include "tools/BlockingQueue.h" #include "tools/Buffers.h" +#include "tools/threading.h" +#include +#include +#include +#include namespace tgvoip { @@ -23,72 +23,72 @@ class EchoCanceller; class MediaStreamItf { public: - virtual void Start() = 0; - virtual void Stop() = 0; - void SetCallback(size_t (*f)(unsigned char *, size_t, void *), void *param); + virtual void Start() = 0; + virtual void Stop() = 0; + void SetCallback(size_t (*f)(unsigned char *, size_t, void *), void *param); - //protected: - size_t InvokeCallback(unsigned char *data, size_t length); + //protected: + size_t InvokeCallback(unsigned char *data, size_t length); private: - size_t (*callback)(unsigned char *, size_t, void *) = NULL; - void *callbackParam; - Mutex callbackMutex; + size_t (*callback)(unsigned char *, size_t, void *) = NULL; + void *callbackParam; + Mutex callbackMutex; }; class AudioMixer : public MediaStreamItf { public: - AudioMixer(); - virtual ~AudioMixer(); - void SetOutput(MediaStreamItf *output); - virtual void Start(); - virtual void Stop(); - void AddInput(std::shared_ptr input); - void RemoveInput(std::shared_ptr input); - void SetInputVolume(std::shared_ptr input, float volumeDB); - void SetEchoCanceller(EchoCanceller *aec); + AudioMixer(); + virtual ~AudioMixer(); + void SetOutput(MediaStreamItf *output); + virtual void Start() override; + virtual void Stop() override; + void AddInput(std::shared_ptr input); + void RemoveInput(std::shared_ptr input); + void SetInputVolume(std::shared_ptr input, float volumeDB); + void SetEchoCanceller(EchoCanceller *aec); private: - void RunThread(); - struct MixerInput - { - std::shared_ptr source; - float multiplier; - }; - Mutex inputsMutex; - void DoCallback(unsigned char *data, size_t length); - static size_t OutputCallback(unsigned char *data, size_t length, void *arg); - std::vector inputs; - Thread *thread; - BufferPool<960 * 2, 16> bufferPool; - BlockingQueue processedQueue; - Semaphore semaphore; - EchoCanceller *echoCanceller; - bool running; + void RunThread(); + struct MixerInput + { + std::shared_ptr source; + float multiplier; + }; + Mutex inputsMutex; + void DoCallback(unsigned char *data, size_t length); + static size_t OutputCallback(unsigned char *data, size_t length, void *arg); + std::vector inputs; + Thread *thread; + BufferPool<960 * 2, 16> bufferPool; + BlockingQueue processedQueue; + Semaphore semaphore; + EchoCanceller *echoCanceller; + bool running; }; class CallbackWrapper : public MediaStreamItf { public: - CallbackWrapper(){}; - virtual ~CallbackWrapper(){}; - virtual void Start(){}; - virtual void Stop(){}; + CallbackWrapper(){}; + virtual ~CallbackWrapper(){}; + virtual void Start() override{}; + virtual void Stop() override{}; }; class AudioLevelMeter { public: - AudioLevelMeter(); - float GetLevel(); - void Update(int16_t *samples, size_t count); + AudioLevelMeter(); + float GetLevel(); + void Update(int16_t *samples, size_t count); private: - int16_t absMax; - int16_t count; - int8_t currentLevel; - int16_t currentLevelFullRange; + int16_t absMax; + int16_t count; + int8_t currentLevel; + int16_t currentLevelFullRange; }; }; // namespace tgvoip diff --git a/controller/net/NetworkSocket.h b/controller/net/NetworkSocket.h index ccb4a97..ec745d5 100644 --- a/controller/net/NetworkSocket.h +++ b/controller/net/NetworkSocket.h @@ -169,17 +169,17 @@ class NetworkSocketTCPObfuscated : public NetworkSocketWrapper public: NetworkSocketTCPObfuscated(const std::shared_ptr &wrapped); virtual ~NetworkSocketTCPObfuscated(); - virtual std::shared_ptr GetWrapped(); - virtual void InitConnection(); + virtual std::shared_ptr GetWrapped() override; + virtual void InitConnection() override; virtual void Send(NetworkPacket &&packet) override; virtual NetworkPacket Receive(size_t maxLen) override; - virtual void Open(); - virtual void Close(); - virtual void Connect(const NetworkAddress address, uint16_t port); - virtual bool OnReadyToSend(); + virtual void Open() override; + virtual void Close() override; + virtual void Connect(const NetworkAddress address, uint16_t port) override; + virtual bool OnReadyToSend() override; - virtual bool IsFailed(); - virtual bool IsReadyToSend() + virtual bool IsFailed() override; + virtual bool IsReadyToSend() override { return readyToSend && wrapped->IsReadyToSend(); }; @@ -199,15 +199,15 @@ public: virtual void Send(NetworkPacket &&packet) override; virtual NetworkPacket Receive(size_t maxLen) override; virtual void Open() override; - virtual void Close(); - virtual void Connect(const NetworkAddress address, uint16_t port); - virtual std::shared_ptr GetWrapped(); - virtual void InitConnection(); - virtual bool IsFailed(); - virtual NetworkAddress GetConnectedAddress(); - virtual uint16_t GetConnectedPort(); - virtual bool OnReadyToSend(); - virtual bool OnReadyToReceive(); + virtual void Close() override; + virtual void Connect(const NetworkAddress address, uint16_t port) override; + virtual std::shared_ptr GetWrapped() override; + virtual void InitConnection() override; + virtual bool IsFailed() override; + virtual NetworkAddress GetConnectedAddress() override; + virtual uint16_t GetConnectedPort() override; + virtual bool OnReadyToSend() override; + virtual bool OnReadyToReceive() override; bool NeedSelectForSending(); diff --git a/controller/protocol/protocol/Extra.h b/controller/protocol/protocol/Extra.h index 2d127b8..163ed25 100644 --- a/controller/protocol/protocol/Extra.h +++ b/controller/protocol/protocol/Extra.h @@ -120,7 +120,7 @@ public: uint8_t streamId; uint8_t flags = 0; - uint8_t getID() const + uint8_t getID() const override { return ID; } @@ -150,7 +150,7 @@ public: Array> data; - uint8_t getID() const + uint8_t getID() const override { return ID; } @@ -175,7 +175,7 @@ struct ExtraNetworkChanged : public Extra uint8_t flags = 0; - uint8_t getID() const + uint8_t getID() const override { return ID; } @@ -197,7 +197,7 @@ public: NetworkAddress address; uint16_t port = 0; - uint8_t getID() const + uint8_t getID() const override { return ID; } @@ -218,7 +218,7 @@ struct ExtraIpv6Endpoint : public Extra NetworkAddress address; uint16_t port = 0; - uint8_t getID() const + uint8_t getID() const override { return ID; } @@ -240,7 +240,7 @@ struct ExtraGroupCallKey : public Extra Buffer key; - uint8_t getID() const + uint8_t getID() const override { return ID; } @@ -258,7 +258,7 @@ struct ExtraGroupCallUpgrade : public Extra bool parse(const BufferInputStream &in, const VersionInfo &ver) override { return true; }; void serialize(BufferOutputStream &out, const VersionInfo &ver) const override{}; - uint8_t getID() const + uint8_t getID() const override { return ID; } @@ -293,7 +293,7 @@ struct ExtraInit : public Extra Array decoders; uint8_t maxResolution; - uint8_t getID() const + uint8_t getID() const override { return ID; } @@ -320,7 +320,7 @@ struct ExtraInitAck : public Extra Array streams; - uint8_t getID() const + uint8_t getID() const override { return ID; } @@ -344,7 +344,7 @@ struct ExtraPing : public Extra bool parse(const BufferInputStream &in, const VersionInfo &ver) override { return true; }; void serialize(BufferOutputStream &out, const VersionInfo &ver) const override{}; - uint8_t getID() const + uint8_t getID() const override { return ID; } @@ -363,7 +363,7 @@ struct ExtraPong : public Extra uint32_t seq = 0; - uint8_t getID() const + uint8_t getID() const override { return ID; } diff --git a/controller/protocol/protocol/Interface.h b/controller/protocol/protocol/Interface.h index 6b37e6d..ad34f13 100644 --- a/controller/protocol/protocol/Interface.h +++ b/controller/protocol/protocol/Interface.h @@ -335,7 +335,7 @@ struct Bytes : public Serializable, virtual ~Bytes() = default; Bytes() = default; - bool parse(const BufferInputStream &in, const VersionInfo &ver) + bool parse(const BufferInputStream &in, const VersionInfo &ver) override { setData(std::make_unique(in.GetLength())); return in.TryRead(*getData()); @@ -368,16 +368,16 @@ struct OutputBytes : public Bytes OutputBytes() = default; OutputBytes(Buffer &&_data) : data(std::make_unique(std::move(_data))){}; - virtual Buffer *getData() + virtual Buffer *getData() override { return data.get(); } - virtual const Buffer *getData() const + virtual const Buffer *getData() const override { return data.get(); } - virtual void setData(std::unique_ptr &&buf) + virtual void setData(std::unique_ptr &&buf) override { data = std::move(buf); } @@ -390,15 +390,15 @@ struct InputBytes : public Bytes InputBytes() = default; InputBytes(std::shared_ptr _data) : data(_data){}; - virtual Buffer *getData() + virtual Buffer *getData() override { return data.get(); } - virtual const Buffer *getData() const + virtual const Buffer *getData() const override { return data.get(); } - virtual void setData(std::unique_ptr &&buf) + virtual void setData(std::unique_ptr &&buf) override { data = std::move(buf); } @@ -416,7 +416,7 @@ struct UInt32 : public Serializable, { return data; } - bool parse(const BufferInputStream &in, const VersionInfo &ver) + bool parse(const BufferInputStream &in, const VersionInfo &ver) override { return in.TryRead(data); } diff --git a/libtgvoip.gyp b/libtgvoip.gyp index cf75651..84d4087 100644 --- a/libtgvoip.gyp +++ b/libtgvoip.gyp @@ -756,7 +756,7 @@ [ '"<(OS)" == "mac"', { 'xcode_settings': { - 'CLANG_CXX_LANGUAGE_STANDARD': 'c++11', + 'CLANG_CXX_LANGUAGE_STANDARD': 'c++17', 'ALWAYS_SEARCH_USER_PATHS': 'NO', }, 'defines': [ diff --git a/os/posix/NetworkSocketPosix.h b/os/posix/NetworkSocketPosix.h index b248609..259d2c6 100644 --- a/os/posix/NetworkSocketPosix.h +++ b/os/posix/NetworkSocketPosix.h @@ -24,7 +24,7 @@ class SocketSelectCancellerPosix : public SocketSelectCanceller public: SocketSelectCancellerPosix(); virtual ~SocketSelectCancellerPosix(); - virtual void CancelSelect(); + virtual void CancelSelect() override; private: int pipeRead;