From b28fa86e6ab633b2d3d9bfdb4642c661ff8c45fc Mon Sep 17 00:00:00 2001 From: Nicolas Werner Date: Wed, 26 Oct 2022 01:10:35 +0200 Subject: Enable -Wconversion --- src/voip/CallManager.cpp | 10 ++++++---- src/voip/WebRTCSession.cpp | 12 ++++++++---- 2 files changed, 14 insertions(+), 8 deletions(-) (limited to 'src/voip') diff --git a/src/voip/CallManager.cpp b/src/voip/CallManager.cpp index 5e711499..1bb1700f 100644 --- a/src/voip/CallManager.cpp +++ b/src/voip/CallManager.cpp @@ -124,10 +124,10 @@ CallManager::CallManager(QObject *parent) // Request new credentials close to expiry // See https://tools.ietf.org/html/draft-uberti-behave-turn-rest-00 turnURIs_ = getTurnURIs(res); - uint32_t ttl = std::max(res.ttl, UINT32_C(3600)); + uint32_t ttl = std::max(res.ttl, std::uint32_t{3600}); if (res.ttl < 3600) nhlog::net()->warn("Setting ttl to 1 hour"); - turnServerTimer_.setInterval(ttl * 1000 * 0.9); + turnServerTimer_.setInterval(std::chrono::seconds(ttl) * 10 / 9); }); connect(&session_, &WebRTCSession::stateChanged, this, [this](webrtc::State state) { @@ -728,7 +728,8 @@ CallManager::devices(bool isVideo) const isVideo ? UserSettings::instance()->camera() : UserSettings::instance()->microphone(); std::vector devices = CallDevices::instance().names(isVideo, defaultDevice.toStdString()); - ret.reserve(devices.size()); + assert(devices.size() < std::numeric_limits::max()); + ret.reserve(static_cast(devices.size())); std::transform(devices.cbegin(), devices.cend(), std::back_inserter(ret), [](const auto &d) { return QString::fromStdString(d); }); @@ -867,7 +868,8 @@ CallManager::windowList() } #endif QStringList ret; - ret.reserve(windows_.size()); + assert(windows_.size() < std::numeric_limits::max()); + ret.reserve(static_cast(windows_.size())); for (const auto &w : windows_) ret.append(w.first); diff --git a/src/voip/WebRTCSession.cpp b/src/voip/WebRTCSession.cpp index b3e6bf26..706a69d9 100644 --- a/src/voip/WebRTCSession.cpp +++ b/src/voip/WebRTCSession.cpp @@ -141,7 +141,8 @@ parseSDP(const std::string &sdp, GstWebRTCSDPType type) { GstSDPMessage *msg; gst_sdp_message_new(&msg); - if (gst_sdp_message_parse_buffer((guint8 *)sdp.c_str(), sdp.size(), msg) == GST_SDP_OK) { + if (gst_sdp_message_parse_buffer((guint8 *)sdp.c_str(), static_cast(sdp.size()), msg) == + GST_SDP_OK) { return gst_webrtc_session_description_new(type, msg); } else { nhlog::ui()->error("WebRTC: failed to parse remote session description"); @@ -371,9 +372,12 @@ getResolution(GstElement *pipe, const gchar *elementName, const gchar *padName) std::pair getPiPDimensions(const std::pair &resolution, int fullWidth, double scaleFactor) { - int pipWidth = fullWidth * scaleFactor; - int pipHeight = static_cast(resolution.second) / resolution.first * pipWidth; - return {pipWidth, pipHeight}; + double pipWidth = fullWidth * scaleFactor; + double pipHeight = static_cast(resolution.second) / resolution.first * pipWidth; + return { + static_cast(std::ceil(pipWidth)), + static_cast(std::ceil(pipHeight)), + }; } void -- cgit 1.5.1