From f894f2587f93d75460c514c413959dad50f569e5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adrien=20B=C3=A9raud?= Date: Thu, 20 Oct 2022 19:38:17 -0400 Subject: [PATCH] misc: fix compilation warnings Change-Id: Ic01845c26653338719b76410878aece456ac93cc --- src/ice_transport.cpp | 4 ++-- src/media/video/video_mixer.cpp | 4 ++-- src/plugin/callservicesmanager.cpp | 2 +- src/security/tls_session.cpp | 25 ++++++++++++------------- src/sip/sdp.cpp | 7 +++---- src/sip/sipcall.cpp | 30 +++++++++++++++--------------- src/upnp/protocol/pupnp/pupnp.cpp | 4 ++-- 7 files changed, 37 insertions(+), 39 deletions(-) diff --git a/src/ice_transport.cpp b/src/ice_transport.cpp index 514708a8d..eae623871 100644 --- a/src/ice_transport.cpp +++ b/src/ice_transport.cpp @@ -965,8 +965,8 @@ IceTransport::Impl::addServerReflexiveCandidates( const std::vector>& addrList) { if (addrList.size() != compCount_) { - JAMI_WARN("[ice:%p] Provided addr list size %lu does not match component count %u", - this, + JAMI_WARNING("[ice:{}] Provided addr list size {} does not match component count {}", + fmt::ptr(this), addrList.size(), compCount_); return; diff --git a/src/media/video/video_mixer.cpp b/src/media/video/video_mixer.cpp index 78f47c100..274a499c8 100644 --- a/src/media/video/video_mixer.cpp +++ b/src/media/video/video_mixer.cpp @@ -223,7 +223,7 @@ VideoMixer::attached(Observable>* ob) src->source = ob; JAMI_DBG("Add new source [%p]", src.get()); sources_.emplace_back(std::move(src)); - JAMI_DBG("Total sources: %lu", sources_.size()); + JAMI_DEBUG("Total sources: {:d}", sources_.size()); updateLayout(); } @@ -236,7 +236,7 @@ VideoMixer::detached(Observable>* ob) if (x->source == ob) { JAMI_DBG("Remove source [%p]", x.get()); sources_.remove(x); - JAMI_DBG("Total sources: %lu", sources_.size()); + JAMI_DEBUG("Total sources: {:d}", sources_.size()); updateLayout(); break; } diff --git a/src/plugin/callservicesmanager.cpp b/src/plugin/callservicesmanager.cpp index 2b8d185b7..606be3fc1 100644 --- a/src/plugin/callservicesmanager.cpp +++ b/src/plugin/callservicesmanager.cpp @@ -122,7 +122,7 @@ CallServicesManager::registerComponentsLifeCycleManagers(PluginManager& pluginMa for (auto& toggledList : mediaHandlerToggled_) { auto handlerId = std::find_if(toggledList.second.begin(), toggledList.second.end(), - [this, handlerIt]( + [handlerIt]( std::pair handlerIdPair) { return handlerIdPair.first == (uintptr_t) handlerIt->get() diff --git a/src/security/tls_session.cpp b/src/security/tls_session.cpp index e0b5e28a6..86adea023 100644 --- a/src/security/tls_session.cpp +++ b/src/security/tls_session.cpp @@ -502,7 +502,7 @@ TlsSession::TlsSessionImpl::initCredentials() chain.first.size()); if (not chain.second.empty()) gnutls_certificate_set_x509_crl(*xcred_, chain.second.data(), chain.second.size()); - JAMI_DBG("[TLS] Peer CA list %lu (%lu CRLs): %d", + JAMI_DEBUG("[TLS] Peer CA list {:d} ({:d} CRLs): {:d}", chain.first.size(), chain.second.size(), ret); @@ -771,13 +771,12 @@ TlsSession::TlsSessionImpl::sendOcspRequest(const std::string& uri, request->set_header_field(restinio::http_field_t::content_type, "application/ocsp-request"); request->set_body(std::move(body)); request->set_connection_type(restinio::http_connection_header_t::close); - request->timeout(timeout, [this, request](const asio::error_code& ec) { + request->timeout(timeout, [request](const asio::error_code& ec) { if (ec and ec != asio::error::operation_aborted) - JAMI_ERR("HTTP OCSP Request timeout with error: %s", ec.message().c_str()); + JAMI_ERROR("HTTP OCSP Request timeout with error: {:s}", ec.message()); request->cancel(); }); - request->add_on_state_change_callback([this, - cb = std::move(cb)](const http::Request::State state, + request->add_on_state_change_callback([this, cb = std::move(cb)](const http::Request::State state, const http::Response response) { JAMI_DBG("HTTP OCSP Request state=%i status_code=%i", (unsigned int) state, @@ -974,7 +973,7 @@ TlsSession::TlsSessionImpl::waitForRawData(std::chrono::milliseconds timeout) return -1; } if (rxQueue_.empty()) { - JAMI_ERR("[TLS] waitForRawData: timeout after %ld ms", timeout.count()); + JAMI_ERROR("[TLS] waitForRawData: timeout after {}", timeout); return 0; } return 1; @@ -993,7 +992,7 @@ TlsSession::TlsSessionImpl::initFromRecordState(int offset) baseSeq_ = array2uint(seq) + offset; gapOffset_ = baseSeq_; lastRxSeq_ = baseSeq_ - 1; - JAMI_DBG("[TLS] Initial sequence number: %lx", baseSeq_); + JAMI_DEBUG("[TLS] Initial sequence number: {:d}", baseSeq_); return true; } @@ -1128,8 +1127,8 @@ TlsSession::TlsSessionImpl::handleStateCookie(TlsSessionState state) // So we retry until we get a valid cookie. // To protect against a flood attack we delay each retry after FLOOD_THRESHOLD rx bytes. if (cookie_count_ >= FLOOD_THRESHOLD) { - JAMI_WARN("[TLS] flood threshold reach (retry in %zds)", - std::chrono::duration_cast(FLOOD_PAUSE).count()); + JAMI_WARNING("[TLS] flood threshold reach (retry in {})", + std::chrono::duration_cast(FLOOD_PAUSE)); dump_io_stats(); std::this_thread::sleep_for(FLOOD_PAUSE); // flood attack protection } @@ -1351,14 +1350,14 @@ TlsSession::TlsSessionImpl::handleDataPacket(std::vector&& buf, uint6 } else { // too old? if (seq_delta <= -MISS_ORDERING_LIMIT) { - JAMI_WARN("[TLS] drop old pkt: 0x%lx", pkt_seq); + JAMI_WARNING("[TLS] drop old pkt: 0x{:x}", pkt_seq); return; } // No duplicate check as DTLS prevents that for us (replay protection) // accept Out-Of-Order pkt - will be reordered by queue flush operation - JAMI_WARN("[TLS] OOO pkt: 0x%lx", pkt_seq); + JAMI_WARNING("[TLS] OOO pkt: 0x{:x}", pkt_seq); } std::unique_lock lk {rxMutex_}; @@ -1413,9 +1412,9 @@ TlsSession::TlsSessionImpl::flushRxQueue(std::unique_lock& lk) if ((now - lastReadTime_) >= RX_OOO_TIMEOUT) { // OOO packet timeout - consider waited packets as lost if (auto lost = next_offset - gapOffset_) - JAMI_WARN("[TLS] %lu lost since 0x%lx", lost, gapOffset_); + JAMI_WARNING("[TLS] {:d} lost since 0x{:x}", lost, gapOffset_); else - JAMI_WARN("[TLS] slow flush"); + JAMI_WARNING("[TLS] slow flush"); } else if (next_offset != gapOffset_) return; diff --git a/src/sip/sdp.cpp b/src/sip/sdp.cpp index 7f900a973..13554edcc 100644 --- a/src/sip/sdp.cpp +++ b/src/sip/sdp.cpp @@ -553,8 +553,7 @@ Sdp::createOffer(const std::vector& mediaList) if (mediaList.size() >= PJMEDIA_MAX_SDP_MEDIA) { throw SdpException("Media list size exceeds SDP media maximum size"); } - - JAMI_DBG("Creating SDP offer with %lu media", mediaList.size()); + JAMI_DEBUG("Creating SDP offer with {} media", mediaList.size()); createLocalSession(SdpDirection::OFFER); @@ -603,8 +602,8 @@ Sdp::processIncomingOffer(const std::vector& mediaList) if (not remoteSession_) return false; - JAMI_DBG("Processing received offer for [%s] with %lu media", - sessionName_.c_str(), + JAMI_DEBUG("Processing received offer for [{:s}] with {:d} media", + sessionName_, mediaList.size()); printSession(remoteSession_, "Remote session:", SdpDirection::OFFER); diff --git a/src/sip/sipcall.cpp b/src/sip/sipcall.cpp index 170a015c5..e8bb3ae25 100644 --- a/src/sip/sipcall.cpp +++ b/src/sip/sipcall.cpp @@ -139,8 +139,8 @@ SIPCall::SIPCall(const std::shared_ptr& account, } } - JAMI_DBG("[call:%s] Create a new [%s] SIP call with %lu media", - getCallId().c_str(), + JAMI_DEBUG("[call:{:s}] Create a new [{:s}] SIP call with {:d} media", + getCallId(), type == Call::CallType::INCOMING ? "INCOMING" : (type == Call::CallType::OUTGOING ? "OUTGOING" : "MISSED"), @@ -874,8 +874,8 @@ SIPCall::answer(const std::vector& mediaList) JAMI_DBG("[call:%s] Media list is empty, using current media", getCallId().c_str()); } else if (newMediaAttrList.size() != rtpStreams_.size()) { // Media count is not expected to change - JAMI_ERR("[call:%s] Media list size %lu in answer does not match. Expected %lu", - getCallId().c_str(), + JAMI_ERROR("[call:{:s}] Media list size {:d} in answer does not match. Expected {:d}", + getCallId(), newMediaAttrList.size(), rtpStreams_.size()); return; @@ -887,10 +887,10 @@ SIPCall::answer(const std::vector& mediaList) JAMI_DBG("[call:%s] Answering incoming call with following media:", getCallId().c_str()); for (size_t idx = 0; idx < mediaAttrList.size(); idx++) { auto const& mediaAttr = mediaAttrList.at(idx); - JAMI_DBG("[call:%s] Media @%lu - %s", - getCallId().c_str(), + JAMI_DEBUG("[call:{:s}] Media @{:d} - {:s}", + getCallId(), idx, - mediaAttr.toString(true).c_str()); + mediaAttr.toString(true)); } // Apply the media attributes. @@ -2001,13 +2001,13 @@ SIPCall::initMediaStreams(const std::vector& mediaAttrList) auto& stream = rtpStreams_.back(); createRtpSession(stream); - JAMI_DBG("[call:%s] Added media @%lu: %s", - getCallId().c_str(), + JAMI_DEBUG("[call:{:s}] Added media @{:d}: {:s}", + getCallId(), idx, - stream.mediaAttribute_->toString(true).c_str()); + stream.mediaAttribute_->toString(true)); } - JAMI_DBG("[call:%s] Created %lu Media streams", getCallId().c_str(), rtpStreams_.size()); + JAMI_DEBUG("[call:{:s}] Created {:d} Media streams", getCallId(), rtpStreams_.size()); return rtpStreams_.size(); } @@ -2270,10 +2270,10 @@ SIPCall::updateRemoteMedia() auto const& remoteMedia = rtpStream.remoteMediaAttribute_ = std::make_shared( remoteMediaList[idx]); if (remoteMedia->type_ == MediaType::MEDIA_VIDEO) { - JAMI_DBG("[call:%s] Remote media @ %lu : %s", - getCallId().c_str(), + JAMI_DEBUG("[call:{:s}] Remote media @ {:d}: {:s}", + getCallId(), idx, - remoteMedia->toString().c_str()); + remoteMedia->toString()); rtpStream.rtpSession_->setMuted(remoteMedia->muted_, RtpSession::Direction::RECV); // Request a key-frame if we are un-muting the video if (not remoteMedia->muted_) @@ -2375,7 +2375,7 @@ SIPCall::updateAllMediaStreams(const std::vector& mediaAttrList, JAMI_DBG("[call:%s] New local media", getCallId().c_str()); if (mediaAttrList.size() > PJ_ICE_MAX_COMP / 2) { - JAMI_DBG("[call:%s] Too many medias, limit it (%lu vs %u)", + JAMI_DEBUG("[call:{:s}] Too many medias, limit it ({:d} vs {:d})", getCallId().c_str(), mediaAttrList.size(), PJ_ICE_MAX_COMP); diff --git a/src/upnp/protocol/pupnp/pupnp.cpp b/src/upnp/protocol/pupnp/pupnp.cpp index 9d5942758..0e0159419 100644 --- a/src/upnp/protocol/pupnp/pupnp.cpp +++ b/src/upnp/protocol/pupnp/pupnp.cpp @@ -1380,9 +1380,9 @@ PUPnP::getMappingsListByDescr(const std::shared_ptr& igd, const std::string mapList.emplace(map.getMapKey(), std::move(map)); } - JAMI_DBG("PUPnP: Found %lu allocated mappings on IGD %s", + JAMI_DEBUG("PUPnP: Found {:d} allocated mappings on IGD {:s}", mapList.size(), - upnpIgd->toString().c_str()); + upnpIgd->toString()); return mapList; }