From 0748b67bf3cba9db59754e0f02037bebeeed1891 Mon Sep 17 00:00:00 2001
From: philippegorley <philippe.gorley@savoirfairelinux.com>
Date: Tue, 12 Jun 2018 13:47:08 -0400
Subject: [PATCH] misc: fix warnings

Change-Id: Ifc84b3f16a57e4d1aa23ef5453d5c2065fb27784
---
 src/manager.h                                              | 2 +-
 src/media/audio/audiorecorder.cpp                          | 2 +-
 src/media/audio/opensl/opensllayer.cpp                     | 2 +-
 src/media/audio/resampler.h                                | 2 +-
 src/media/libav_utils.cpp                                  | 2 +-
 src/media/video/androidvideo/video_device_impl.cpp         | 5 ++---
 src/media/video/androidvideo/video_device_monitor_impl.cpp | 5 +----
 src/media/video/video_input.cpp                            | 2 +-
 src/ringdht/p2p.cpp                                        | 2 +-
 src/ringdht/ringaccount.cpp                                | 6 +++---
 src/ringdht/ringaccount.h                                  | 2 +-
 src/sip/sipaccountbase.h                                   | 2 +-
 src/sip/sipcall.h                                          | 2 +-
 src/smartools.cpp                                          | 2 +-
 src/upnp/upnp_context.cpp                                  | 2 +-
 15 files changed, 18 insertions(+), 22 deletions(-)

diff --git a/src/manager.h b/src/manager.h
index 23df1ac6f2..c32b43507e 100644
--- a/src/manager.h
+++ b/src/manager.h
@@ -48,7 +48,7 @@ namespace video {
 class SinkClient;
 }
 class RingBufferPool;
-class VideoManager;
+struct VideoManager;
 class Conference;
 class AudioLoop;
 class IceTransportFactory;
diff --git a/src/media/audio/audiorecorder.cpp b/src/media/audio/audiorecorder.cpp
index 4001c44892..80012b85d6 100644
--- a/src/media/audio/audiorecorder.cpp
+++ b/src/media/audio/audiorecorder.cpp
@@ -40,7 +40,7 @@ AudioRecorder::AudioRecorder(AudioRecord* arec, RingBufferPool& rbp)
     , buffer_(new AudioBuffer(BUFFER_LENGTH, AudioFormat::NONE()))
     , arecord_(arec)
     , thread_(
-        [this] { return true; },
+        [] { return true; },
         [this] { process(); },
         [] {})
 {
diff --git a/src/media/audio/opensl/opensllayer.cpp b/src/media/audio/opensl/opensllayer.cpp
index a00a3d8d75..c60ac20abb 100644
--- a/src/media/audio/opensl/opensllayer.cpp
+++ b/src/media/audio/opensl/opensllayer.cpp
@@ -241,7 +241,7 @@ OpenSLLayer::engineServiceRing(bool waiting) {
 }
 
 void
-OpenSLLayer::engineServiceRec(bool waiting) {
+OpenSLLayer::engineServiceRec(bool /* waiting */) {
     playCv.notify_one();
     recCv.notify_one();
     return;
diff --git a/src/media/audio/resampler.h b/src/media/audio/resampler.h
index df609a2ed1..00d50e965f 100644
--- a/src/media/audio/resampler.h
+++ b/src/media/audio/resampler.h
@@ -32,7 +32,7 @@
 
 namespace ring {
 
-struct SrcState;
+class SrcState;
 
 class Resampler {
     public:
diff --git a/src/media/libav_utils.cpp b/src/media/libav_utils.cpp
index d87875ca62..7bb5588537 100644
--- a/src/media/libav_utils.cpp
+++ b/src/media/libav_utils.cpp
@@ -129,7 +129,7 @@ androidAvLogCb(void* ptr, int level, const char* fmt, va_list vl)
         case AV_LOG_TRACE:   android_level = ANDROID_LOG_VERBOSE; break;
         default:             android_level = ANDROID_LOG_DEFAULT; break;
     }
-    __android_log_print(android_level, "FFmpeg", line);
+    __android_log_print(android_level, "FFmpeg", "%s", line);
 }
 #endif
 
diff --git a/src/media/video/androidvideo/video_device_impl.cpp b/src/media/video/androidvideo/video_device_impl.cpp
index 30ebd8f9cf..2dd11762d5 100644
--- a/src/media/video/androidvideo/video_device_impl.cpp
+++ b/src/media/video/androidvideo/video_device_impl.cpp
@@ -164,7 +164,6 @@ VideoDeviceImpl::getDeviceParams() const
 {
     DeviceParams params;
     std::stringstream ss1, ss2;
-    char sep;
 
     ss1 << fmt_->ring_format;
     ss1 >> params.format;
@@ -212,13 +211,13 @@ VideoDevice::getChannelList() const
 }
 
 std::vector<VideoSize>
-VideoDevice::getSizeList(const std::string& channel) const
+VideoDevice::getSizeList(const std::string& /* channel */) const
 {
     return deviceImpl_->getSizeList();
 }
 
 std::vector<FrameRate>
-VideoDevice::getRateList(const std::string& channel, VideoSize size) const
+VideoDevice::getRateList(const std::string& /* channel */, VideoSize /* size */) const
 {
     return deviceImpl_->getRateList();
 }
diff --git a/src/media/video/androidvideo/video_device_monitor_impl.cpp b/src/media/video/androidvideo/video_device_monitor_impl.cpp
index 87cbf8a0b4..4af7cea095 100644
--- a/src/media/video/androidvideo/video_device_monitor_impl.cpp
+++ b/src/media/video/androidvideo/video_device_monitor_impl.cpp
@@ -59,12 +59,9 @@ class VideoDeviceMonitorImpl {
 
     private:
         NON_COPYABLE(VideoDeviceMonitorImpl);
-
-        VideoDeviceMonitor* monitor_;
 };
 
-VideoDeviceMonitorImpl::VideoDeviceMonitorImpl(VideoDeviceMonitor* monitor) :
-    monitor_(monitor)
+VideoDeviceMonitorImpl::VideoDeviceMonitorImpl(VideoDeviceMonitor* monitor)
 {}
 
 void VideoDeviceMonitorImpl::start()
diff --git a/src/media/video/video_input.cpp b/src/media/video/video_input.cpp
index 12043dad30..ab55d4ab69 100644
--- a/src/media/video/video_input.cpp
+++ b/src/media/video/video_input.cpp
@@ -292,7 +292,7 @@ VideoInput::obtainFrame(int length)
 
     /* search for an available frame */
     for(auto& buffer : buffers_) {
-        if (buffer.length == length && buffer.status == BUFFER_AVAILABLE) {
+        if (buffer.length == static_cast<size_t>(length) && buffer.status == BUFFER_AVAILABLE) {
             buffer.status = BUFFER_CAPTURING;
             return buffer.data;
         }
diff --git a/src/ringdht/p2p.cpp b/src/ringdht/p2p.cpp
index 6f6e096331..5634d04a00 100644
--- a/src/ringdht/p2p.cpp
+++ b/src/ringdht/p2p.cpp
@@ -743,7 +743,7 @@ DhtPeerConnector::requestConnection(const std::string& peer_id,
                 });
         },
 
-        [this, peer_h, connect_cb](const std::shared_ptr<RingAccount>& account, bool found) {
+        [peer_h, connect_cb](const std::shared_ptr<RingAccount>& account, bool found) {
             if (!found) {
                 RING_WARN() << account << "[CNX] aborted, no devices for " << peer_h;
                 connect_cb(nullptr);
diff --git a/src/ringdht/ringaccount.cpp b/src/ringdht/ringaccount.cpp
index 6843e6e5ee..f3482b2c04 100644
--- a/src/ringdht/ringaccount.cpp
+++ b/src/ringdht/ringaccount.cpp
@@ -1178,7 +1178,7 @@ RingAccount::loadAccountFromDHT(const std::string& archive_password, const std::
         RING_ERR("DHT already running (stopping it first).");
         dht_.join();
     }
-    dht_.setOnStatusChanged([this](dht::NodeStatus s4, dht::NodeStatus s6) {
+    dht_.setOnStatusChanged([](dht::NodeStatus s4, dht::NodeStatus s6) {
         RING_WARN("Dht status : IPv4 %s; IPv6 %s", dhtStatusStr(s4), dhtStatusStr(s6));
     });
     dht_.run((in_port_t)dhtPortUsed_, {}, true);
@@ -1754,7 +1754,7 @@ RingAccount::handlePendingCall(PendingCall& pc, bool incoming)
         /*.cert_key = */identity_.first,
         /*.dh_params = */dhParams_,
         /*.timeout = */std::chrono::duration_cast<decltype(tls::TlsParams::timeout)>(TLS_TIMEOUT),
-        /*.cert_check = */[waccount,wcall,remote_device,remote_account,incoming](unsigned status,
+        /*.cert_check = */[waccount,wcall,remote_device,remote_account](unsigned status,
                                                              const gnutls_datum_t* cert_list,
                                                              unsigned cert_num) -> pj_status_t {
             try {
@@ -3308,7 +3308,7 @@ RingAccount::sendTextMessage(const std::string& to, const std::map<std::string,
 
         auto h = dht::InfoHash::get("inbox:"+dev.toString());
         std::weak_ptr<RingAccount> wshared = shared;
-        auto list_token = shared->dht_.listen<dht::ImMessage>(h, [h,wshared,token,confirm](dht::ImMessage&& msg) {
+        auto list_token = shared->dht_.listen<dht::ImMessage>(h, [wshared,token,confirm](dht::ImMessage&& msg) {
             if (auto sthis = wshared.lock()) {
                 auto& this_ = *sthis;
                 // check expected message confirmation
diff --git a/src/ringdht/ringaccount.h b/src/ringdht/ringaccount.h
index bd99f8dda2..a80ecedcf8 100644
--- a/src/ringdht/ringaccount.h
+++ b/src/ringdht/ringaccount.h
@@ -382,7 +382,7 @@ class RingAccount : public SIPAccountBase {
          * Get last messages (should be used to retrieve messages when launching the client)
          * @param base_timestamp
          */
-        std::vector<DRing::Message> getLastMessages(const uint64_t& base_timestamp);
+        std::vector<DRing::Message> getLastMessages(const uint64_t& base_timestamp) override;
 
     private:
         NON_COPYABLE(RingAccount);
diff --git a/src/sip/sipaccountbase.h b/src/sip/sipaccountbase.h
index 181269890d..d943bc80ad 100644
--- a/src/sip/sipaccountbase.h
+++ b/src/sip/sipaccountbase.h
@@ -277,7 +277,7 @@ public:
 
     virtual std::string getUserUri() const = 0;
 
-    std::vector<DRing::Message> getLastMessages(const uint64_t& base_timestamp) {
+    std::vector<DRing::Message> getLastMessages(const uint64_t& base_timestamp) override {
         std::lock_guard<std::mutex> lck(mutexLastMessages_);
         auto it = lastMessages_.begin();
         size_t num = lastMessages_.size();
diff --git a/src/sip/sipcall.h b/src/sip/sipcall.h
index a441f42cfd..01e2a04735 100644
--- a/src/sip/sipcall.h
+++ b/src/sip/sipcall.h
@@ -105,7 +105,7 @@ public: // overridden
     bool useVideoCodec(const AccountVideoCodecInfo* codec) const override;
     std::map<std::string, std::string> getDetails() const override;
 
-    virtual bool toggleRecording(); // SIPCall needs to spread recorder to rtp sessions, so override
+    virtual bool toggleRecording() override; // SIPCall needs to spread recorder to rtp sessions, so override
 
 public: // SIP related
     /**
diff --git a/src/smartools.cpp b/src/smartools.cpp
index 75d6081ea4..f01f7cfaa2 100644
--- a/src/smartools.cpp
+++ b/src/smartools.cpp
@@ -36,7 +36,7 @@ Smartools& Smartools::getInstance()
 
 // Launch process() in new thread
 Smartools::Smartools()
-: loop_([this] { return true; }, [this] { process(); }, [] {})
+: loop_([] { return true; }, [this] { process(); }, [] {})
 {}
 
 Smartools::~Smartools()
diff --git a/src/upnp/upnp_context.cpp b/src/upnp/upnp_context.cpp
index 0d40d24e65..30b4cb03bb 100644
--- a/src/upnp/upnp_context.cpp
+++ b/src/upnp/upnp_context.cpp
@@ -386,7 +386,7 @@ UPnPContext::addMapping(IGD* igd,
 #endif
     {
         /* success; add it to global list */
-        globalMappings->emplace(port_external, std::move(GlobalMapping{mapping}));
+        globalMappings->emplace(port_external, GlobalMapping{mapping});
 #if HAVE_LIBNATPMP
 #if HAVE_LIBUPNP
         if (not upnp)
-- 
GitLab