From f31d9133c321afe32fea8e896d4f0ff471bac8c9 Mon Sep 17 00:00:00 2001 From: Guillaume Roguez <guillaume.roguez@savoirfairelinux.com> Date: Sat, 3 Dec 2016 00:39:11 -0500 Subject: [PATCH] build: fix some warnings fix warnings generated by our files. Reviewed-by: Andreas Traczyk <andreas.traczyk@savoirfairelinux.com> Change-Id: I8b5b4d4c74ddfac6b3e40ae79f7382133632f9f2 --- src/base64.cpp | 12 +++++------ src/call.cpp | 26 +++++++++++++++--------- src/media/audio/alsa/alsalayer.cpp | 2 +- src/media/video/v4l2/vaapi.cpp | 1 + src/media/video/video_receive_thread.cpp | 4 ++-- src/ringdht/ringaccount.cpp | 3 ++- 6 files changed, 28 insertions(+), 20 deletions(-) diff --git a/src/base64.cpp b/src/base64.cpp index d14812afd3..639df64ab9 100644 --- a/src/base64.cpp +++ b/src/base64.cpp @@ -33,7 +33,7 @@ static const char encoding_table[] = { '3', '4', '5', '6', '7', '8', '9', '+', '/' }; -static const int mod_table[] = { 0, 2, 1 }; +static const size_t mod_table[] = { 0, 2, 1 }; char *ring_base64_encode(const uint8_t *input, size_t input_length, char *output, size_t *output_length) @@ -71,7 +71,7 @@ uint8_t *ring_base64_decode(const char *input, size_t input_length, uint8_t c; for (c = 0; c < 64; c++) - decoding_table[encoding_table[c]] = c; + decoding_table[static_cast<int>(encoding_table[c])] = c; if (input_length % 4 != 0) return NULL; @@ -88,13 +88,13 @@ uint8_t *ring_base64_decode(const char *input, size_t input_length, for (i = 0, j = 0; i < input_length;) { uint8_t sextet_a = input[i] == '=' ? 0 & i++ - : decoding_table[input[i++]]; + : decoding_table[static_cast<int>(input[i++])]; uint8_t sextet_b = input[i] == '=' ? 0 & i++ - : decoding_table[input[i++]]; + : decoding_table[static_cast<int>(input[i++])]; uint8_t sextet_c = input[i] == '=' ? 0 & i++ - : decoding_table[input[i++]]; + : decoding_table[static_cast<int>(input[i++])]; uint8_t sextet_d = input[i] == '=' ? 0 & i++ - : decoding_table[input[i++]]; + : decoding_table[static_cast<int>(input[i++])]; uint32_t triple = (sextet_a << 3 * 6) + (sextet_b << 2 * 6) + diff --git a/src/call.cpp b/src/call.cpp index 7186acadd9..fbaa48e72b 100644 --- a/src/call.cpp +++ b/src/call.cpp @@ -402,15 +402,18 @@ Call::addSubCall(const std::shared_ptr<Call>& call) std::weak_ptr<Call> wthis = shared_from_this(); std::weak_ptr<Call> wcall = call; - call->addStateListener([wcall,wthis](Call::CallState new_state, Call::ConnectionState new_cstate, int code) { + call->addStateListener([wcall, wthis](Call::CallState new_state, + Call::ConnectionState new_cstate, + UNUSED int code) { if (auto call = wcall.lock()) { if (auto sthis = wthis.lock()) { auto& this_ = *sthis; auto sit = this_.subcalls.find(call); if (sit == this_.subcalls.end()) return; - RING_WARN("[call %s] DeviceCall call %s state changed %d %d", this_.getCallId().c_str(), call->getCallId().c_str(), - static_cast<int>(new_state), static_cast<int>(new_cstate)); + RING_WARN("[call:%s] DeviceCall call %s state changed %d %d", + this_.getCallId().c_str(), call->getCallId().c_str(), + static_cast<int>(new_state), static_cast<int>(new_cstate)); if (new_state == CallState::OVER) { std::lock_guard<std::recursive_mutex> lk (this_.callMutex_); this_.subcalls.erase(call); @@ -421,21 +424,22 @@ Call::addSubCall(const std::shared_ptr<Call>& call) this_.setState(new_cstate); } else if (new_cstate == ConnectionState::DISCONNECTED && new_state == CallState::ACTIVE) { std::lock_guard<std::recursive_mutex> lk (this_.callMutex_); - RING_WARN("[call %s] peer hangup", this_.getCallId().c_str()); + RING_WARN("[call:%s] peer hangup", this_.getCallId().c_str()); auto subcalls = std::move(this_.subcalls); for (auto& sub : subcalls) { if (sub != call) try { sub->hangup(0); } catch(const std::exception& e) { - RING_WARN("[call %s] error hanging up: %s", this_.getCallId().c_str(), e.what()); + RING_WARN("[call:%s] error hanging up: %s", + this_.getCallId().c_str(), e.what()); } } this_.peerHungup(); } if (new_state == CallState::ACTIVE && new_cstate == ConnectionState::CONNECTED) { std::lock_guard<std::recursive_mutex> lk (this_.callMutex_); - RING_WARN("[call %s] peer answer", this_.getCallId().c_str()); + RING_WARN("[call:%s] peer answer", this_.getCallId().c_str()); auto subcalls = std::move(this_.subcalls); for (auto& sub : subcalls) { if (sub != call) @@ -444,12 +448,14 @@ Call::addSubCall(const std::shared_ptr<Call>& call) this_.merge(call); Manager::instance().peerAnsweredCall(this_); } - RING_WARN("[call %s] Remaining %d subcalls", this_.getCallId().c_str(), static_cast<int>(this_.subcalls.size())); + RING_WARN("[call:%s] Remaining %zu subcalls", this_.getCallId().c_str(), + this_.subcalls.size()); if (this_.subcalls.empty()) this_.pendingOutMessages_.clear(); } else { - RING_WARN("DeviceCall IGNORED call %s state changed %d %d", call->getCallId().c_str(), - static_cast<int>(new_state), static_cast<int>(new_cstate)); + RING_WARN("DeviceCall IGNORED call %s state changed %d %d", + call->getCallId().c_str(), static_cast<int>(new_state), + static_cast<int>(new_cstate)); } } }); @@ -460,7 +466,7 @@ Call::addSubCall(const std::shared_ptr<Call>& call) void Call::merge(std::shared_ptr<Call> scall) { - RING_WARN("[call %s] merge to -> [call %s]", scall->getCallId().c_str(), getCallId().c_str()); + RING_WARN("[call:%s] merge to -> [call:%s]", scall->getCallId().c_str(), getCallId().c_str()); auto& call = *scall; std::lock(callMutex_, call.callMutex_); std::lock_guard<std::recursive_mutex> lk1 (callMutex_, std::adopt_lock); diff --git a/src/media/audio/alsa/alsalayer.cpp b/src/media/audio/alsa/alsalayer.cpp index 9ee2906a77..1e04c8b3a8 100644 --- a/src/media/audio/alsa/alsalayer.cpp +++ b/src/media/audio/alsa/alsalayer.cpp @@ -743,7 +743,7 @@ void AlsaLayer::playback() auto& playBuff = getToPlay(audioFormat_, maxFrames); auto& toPlay = ringBuff.frames() > 0 ? ringBuff : playBuff; - if (!toPlay.frames() > 0) + if (!(toPlay.frames() > 0)) return; toPlay.interleave(playbackIBuff_); diff --git a/src/media/video/v4l2/vaapi.cpp b/src/media/video/v4l2/vaapi.cpp index ebe3b3d880..4129573efc 100644 --- a/src/media/video/v4l2/vaapi.cpp +++ b/src/media/video/v4l2/vaapi.cpp @@ -55,6 +55,7 @@ VaapiAccel::~VaapiAccel() int VaapiAccel::allocateBuffer(AVFrame* frame, int flags) { + (void) flags; // unused return av_hwframe_get_buffer(framesBufferRef_.get(), frame, 0); } diff --git a/src/media/video/video_receive_thread.cpp b/src/media/video/video_receive_thread.cpp index b2769d5134..cd600ce46f 100644 --- a/src/media/video/video_receive_thread.cpp +++ b/src/media/video/video_receive_thread.cpp @@ -45,10 +45,10 @@ VideoReceiveThread::VideoReceiveThread(const std::string& id, , dstHeight_(0) , id_(id) , stream_(sdp) - , restartDecoder_(false) - , isReset_(isReset) , sdpContext_(stream_.str().size(), false, &readFunction, 0, 0, this) , sink_ {Manager::instance().createSinkClient(id)} + , restartDecoder_(false) + , isReset_(isReset) , requestKeyFrameCallback_(0) , loop_(std::bind(&VideoReceiveThread::setup, this), std::bind(&VideoReceiveThread::process, this), diff --git a/src/ringdht/ringaccount.cpp b/src/ringdht/ringaccount.cpp index 40e57a56bf..a464713061 100644 --- a/src/ringdht/ringaccount.cpp +++ b/src/ringdht/ringaccount.cpp @@ -437,7 +437,8 @@ RingAccount::startOutgoingCall(const std::shared_ptr<SIPCall>& call, const std:: std::chrono::steady_clock::now(), ice, weak_dev_call, std::move(listenKey), - callkey, dev + callkey, dev, + nullptr }); return false; }); -- GitLab