From 6dfd0cd3a8844cebf16cdcea67d1c85453b71e7b Mon Sep 17 00:00:00 2001 From: Alexander Bock Date: Wed, 26 Apr 2023 23:51:16 +0200 Subject: [PATCH] Remove warnings on MSVC --- apps/OpenSpace/ext/launcher/src/launcherwindow.cpp | 2 +- modules/base/rendering/renderablenodeline.cpp | 4 ++-- modules/base/rendering/renderabletrailtrajectory.cpp | 2 +- modules/globebrowsing/src/geojson/geojsonproperties.cpp | 8 ++++++-- .../globebrowsing/src/geojson/globegeometryfeature.cpp | 2 -- modules/server/src/topics/missiontopic.cpp | 2 +- modules/touch/src/touchinteraction.cpp | 2 +- modules/video/src/videoplayer.cpp | 8 ++++---- modules/video/src/videotileprovider.cpp | 4 ++-- src/navigation/orbitalnavigator.cpp | 6 +++--- src/navigation/orbitalnavigator_lua.inl | 4 ++-- 11 files changed, 23 insertions(+), 21 deletions(-) diff --git a/apps/OpenSpace/ext/launcher/src/launcherwindow.cpp b/apps/OpenSpace/ext/launcher/src/launcherwindow.cpp index c7334ab384..ce4a788859 100644 --- a/apps/OpenSpace/ext/launcher/src/launcherwindow.cpp +++ b/apps/OpenSpace/ext/launcher/src/launcherwindow.cpp @@ -687,7 +687,7 @@ void LauncherWindow::populateWindowConfigsList(std::string preset) { return; } } - catch (const std::runtime_error& e) { + catch (const std::runtime_error&) { // Ignore an exception here because clicking the edit button will // bring up an explanatory error message } diff --git a/modules/base/rendering/renderablenodeline.cpp b/modules/base/rendering/renderablenodeline.cpp index 6f61e2b3cc..11a50606fd 100644 --- a/modules/base/rendering/renderablenodeline.cpp +++ b/modules/base/rendering/renderablenodeline.cpp @@ -241,8 +241,8 @@ RenderableNodeLine::RenderableNodeLine(const ghoul::Dictionary& dictionary) } else { // Recompute relative values to meters - _startOffset = _startOffset * startNode->boundingSphere(); - _endOffset = _endOffset * endNode->boundingSphere(); + _startOffset = static_cast(_startOffset * startNode->boundingSphere()); + _endOffset = static_cast(_endOffset * endNode->boundingSphere()); } }); } diff --git a/modules/base/rendering/renderabletrailtrajectory.cpp b/modules/base/rendering/renderabletrailtrajectory.cpp index f67cb04f2d..c9a1aed7e4 100644 --- a/modules/base/rendering/renderabletrailtrajectory.cpp +++ b/modules/base/rendering/renderabletrailtrajectory.cpp @@ -239,7 +239,7 @@ void RenderableTrailTrajectory::update(const UpdateData& data) { unsigned int stopIndex = std::min(nextIndex, _numberOfVertices); // Calculate all vertex positions - for (int i = startIndex; i < stopIndex; ++i) { + for (unsigned int i = startIndex; i < stopIndex; ++i) { const glm::vec3 p = _translation->position({ {}, Time(_start + i * _totalSampleInterval), diff --git a/modules/globebrowsing/src/geojson/geojsonproperties.cpp b/modules/globebrowsing/src/geojson/geojsonproperties.cpp index 871136d132..a1f488633d 100644 --- a/modules/globebrowsing/src/geojson/geojsonproperties.cpp +++ b/modules/globebrowsing/src/geojson/geojsonproperties.cpp @@ -422,8 +422,12 @@ void GeoJsonProperties::createFromDictionary(const ghoul::Dictionary& dictionary // Distances are computed based on a certain lat/long angle size constexpr float DefaultAngle = glm::radians(1.f); constexpr float MaxAngle = glm::radians(45.f); - float defaultDistance = globe.ellipsoid().longitudalDistance(0.f, 0.f, DefaultAngle); - float maxDistance = globe.ellipsoid().longitudalDistance(0.f, 0.f, MaxAngle); + float defaultDistance = static_cast( + globe.ellipsoid().longitudalDistance(0.f, 0.f, DefaultAngle) + ); + float maxDistance = static_cast( + globe.ellipsoid().longitudalDistance(0.f, 0.f, MaxAngle) + ); tessellation.distance = defaultDistance; tessellation.distance.setMaxValue(maxDistance); diff --git a/modules/globebrowsing/src/geojson/globegeometryfeature.cpp b/modules/globebrowsing/src/geojson/globegeometryfeature.cpp index d771fc63e8..6c02b03e6e 100644 --- a/modules/globebrowsing/src/geojson/globegeometryfeature.cpp +++ b/modules/globebrowsing/src/geojson/globegeometryfeature.cpp @@ -575,8 +575,6 @@ std::vector> GlobeGeometryFeature::createLineGeometry() { continue; } - float length = static_cast(glm::distance(lastPos, v)); - if (_properties.tessellationEnabled()) { // Tessellate. // But first, determine the step size for the tessellation (larger diff --git a/modules/server/src/topics/missiontopic.cpp b/modules/server/src/topics/missiontopic.cpp index e8968a909d..bed874ffe6 100644 --- a/modules/server/src/topics/missiontopic.cpp +++ b/modules/server/src/topics/missiontopic.cpp @@ -112,7 +112,7 @@ nlohmann::json MissionTopic::createPhaseJson(const MissionPhase& phase) const { return phaseJson; } -void MissionTopic::handleJson(const nlohmann::json& input) { +void MissionTopic::handleJson(const nlohmann::json&) { nlohmann::json data = { {"missions", missionJson()} }; _connection->sendJson(wrappedPayload(data)); } diff --git a/modules/touch/src/touchinteraction.cpp b/modules/touch/src/touchinteraction.cpp index ce4d7438ae..a0399fe880 100644 --- a/modules/touch/src/touchinteraction.cpp +++ b/modules/touch/src/touchinteraction.cpp @@ -328,7 +328,7 @@ TouchInteraction::TouchInteraction() glm::vec4(0.2f) ) , _constTimeDecay_secs(ConstantTimeDecaySecsInfo, 1.75f, 0.1f, 4.f) - , _pinchInputs({ TouchInput(0, 0, 0.0, 0.0, 0.0), TouchInput(0, 0, 0.0, 0.0, 0.0) }) + , _pinchInputs({ TouchInput(0, 0, 0.f, 0.f, 0.0), TouchInput(0, 0, 0.f, 0.f, 0.0) }) , _vel{ glm::dvec2(0.0), 0.0, 0.0, glm::dvec2(0.0) } , _sensitivity{ glm::dvec2(0.08, 0.045), 12.0, 2.75, glm::dvec2(0.08, 0.045) } // Calculated with two vectors with known diff in length, then diff --git a/modules/video/src/videoplayer.cpp b/modules/video/src/videoplayer.cpp index 89bf0745dc..bf5212f28a 100644 --- a/modules/video/src/videoplayer.cpp +++ b/modules/video/src/videoplayer.cpp @@ -745,11 +745,11 @@ void VideoPlayer::handleMpvProperties(mpv_event* event) { break; } - if (list->keys[i] == "w") { + if (std::string_view(list->keys[i]) == "w") { width = list->values[i]; foundWidth = true; } - else if (list->keys[i] == "h") { + else if (std::string_view(list->keys[i]) == "h") { height = list->values[i]; foundHeight = true; } @@ -763,10 +763,10 @@ void VideoPlayer::handleMpvProperties(mpv_event* event) { int w = -1; int h = -1; if (width.format == MPV_FORMAT_INT64) { - w = width.u.int64; + w = static_cast(width.u.int64); } if (height.format == MPV_FORMAT_INT64) { - h = height.u.int64; + h = static_cast(height.u.int64); } if (w == -1 || h == -1) { diff --git a/modules/video/src/videotileprovider.cpp b/modules/video/src/videotileprovider.cpp index f1de10859b..64a6a18a24 100644 --- a/modules/video/src/videotileprovider.cpp +++ b/modules/video/src/videotileprovider.cpp @@ -112,8 +112,8 @@ void VideoTileProvider::reset() { globebrowsing::ChunkTile VideoTileProvider::chunkTile(globebrowsing::TileIndex tileIndex, int parents, int maxParents) { using namespace globebrowsing; - std::function ascendToParent = [] - (TileIndex& ti, TileUvTransform& uv) { + std::function ascendToParent = + [](TileIndex& ti, TileUvTransform&) { ti.level--; }; diff --git a/src/navigation/orbitalnavigator.cpp b/src/navigation/orbitalnavigator.cpp index 38e5467833..ea38cc6bae 100644 --- a/src/navigation/orbitalnavigator.cpp +++ b/src/navigation/orbitalnavigator.cpp @@ -435,9 +435,9 @@ OrbitalNavigator::LimitZoom::LimitZoom() , enableZoomOutLimit(EnabledMaximumDistanceInfo, false) , maximumAllowedDistance( MaximumDistanceInfo, - 4e+27, + 4e+27f, 50.f, - 4e+27 + 4e+27f ) { // Min @@ -724,7 +724,7 @@ void OrbitalNavigator::updateStatesFromInput(const MouseInputState& mouseInputSt _movementTimer = _idleBehavior.idleWaitTime; } else if (!cameraLocationChanged) { - tickMovementTimer(deltaTime); + tickMovementTimer(static_cast(deltaTime)); } } diff --git a/src/navigation/orbitalnavigator_lua.inl b/src/navigation/orbitalnavigator_lua.inl index a70e24f3a6..3dc95a7146 100644 --- a/src/navigation/orbitalnavigator_lua.inl +++ b/src/navigation/orbitalnavigator_lua.inl @@ -36,7 +36,7 @@ namespace { double is = node->interactionSphere(); global::navigationHandler->orbitalNavigator().setMinimumAllowedDistance( - is * multiplier + static_cast(is * multiplier) ); } @@ -52,7 +52,7 @@ namespace { double is = node->interactionSphere(); global::navigationHandler->orbitalNavigator().setMaximumAllowedDistance( - is * multiplier + static_cast(is * multiplier) ); }