From 04c7116f5ab3b869fcf99e83a63a47d4a95a6a8f Mon Sep 17 00:00:00 2001 From: Michael Fabian 'Xaymar' Dirks Date: Tue, 7 Sep 2021 05:11:04 +0200 Subject: [PATCH] project: Fix various warnings --- source/encoders/handlers/nvenc_shared.cpp | 2 +- source/nvidia/cuda/nvidia-cuda-context.cpp | 2 +- source/nvidia/cv/nvidia-cv-image.hpp | 2 +- source/nvidia/cv/nvidia-cv.cpp | 6 ++++-- source/nvidia/vfx/nvidia-vfx-superresolution.cpp | 8 ++++---- source/nvidia/vfx/nvidia-vfx.cpp | 3 ++- 6 files changed, 13 insertions(+), 10 deletions(-) diff --git a/source/encoders/handlers/nvenc_shared.cpp b/source/encoders/handlers/nvenc_shared.cpp index 9bce3926..873a6f3a 100644 --- a/source/encoders/handlers/nvenc_shared.cpp +++ b/source/encoders/handlers/nvenc_shared.cpp @@ -196,7 +196,7 @@ void nvenc::override_update(ffmpeg_instance* instance, obs_data_t*) } // Set delay - context->delay = std::min(std::max(async_depth, 3ll), surfaces - 1); + context->delay = std::min(std::max(static_cast(async_depth), 3), static_cast(surfaces - 1)); } void nvenc::get_defaults(obs_data_t* settings, const AVCodec*, AVCodecContext*) diff --git a/source/nvidia/cuda/nvidia-cuda-context.cpp b/source/nvidia/cuda/nvidia-cuda-context.cpp index e194a07e..ba48cef9 100644 --- a/source/nvidia/cuda/nvidia-cuda-context.cpp +++ b/source/nvidia/cuda/nvidia-cuda-context.cpp @@ -101,7 +101,7 @@ streamfx::nvidia::cuda::context::context(ID3D11Device* device) : context() { // Device Name std::vector name(256, 0); - _cuda->cuDeviceGetName(name.data(), name.size() - 1, _device); + _cuda->cuDeviceGetName(name.data(), static_cast(name.size() - 1), _device); device_name = std::string(name.data(), name.data() + strlen(name.data())); // Device LUID diff --git a/source/nvidia/cv/nvidia-cv-image.hpp b/source/nvidia/cv/nvidia-cv-image.hpp index 4c180bbd..0348d0d1 100644 --- a/source/nvidia/cv/nvidia-cv-image.hpp +++ b/source/nvidia/cv/nvidia-cv-image.hpp @@ -32,7 +32,7 @@ namespace streamfx::nvidia::cv { protected: std::shared_ptr<::streamfx::nvidia::cv::cv> _cv; image_t _image; - size_t _alignment; + uint32_t _alignment; public: virtual ~image(); diff --git a/source/nvidia/cv/nvidia-cv.cpp b/source/nvidia/cv/nvidia-cv.cpp index 7eafd479..d54a5035 100644 --- a/source/nvidia/cv/nvidia-cv.cpp +++ b/source/nvidia/cv/nvidia-cv.cpp @@ -88,7 +88,8 @@ streamfx::nvidia::cv::cv::cv() env_size = GetEnvironmentVariableW(ST_ENV_NVIDIA_VIDEO_EFFECTS_SDK_PATH, nullptr, 0); if (env_size > 0) { buffer.resize(static_cast(env_size) + 1); - env_size = GetEnvironmentVariableW(ST_ENV_NVIDIA_VIDEO_EFFECTS_SDK_PATH, buffer.data(), buffer.size()); + env_size = GetEnvironmentVariableW(ST_ENV_NVIDIA_VIDEO_EFFECTS_SDK_PATH, buffer.data(), + static_cast(buffer.size())); vfx_sdk_path = std::wstring(buffer.data(), buffer.size()); } else { PWSTR str = nullptr; @@ -116,7 +117,8 @@ streamfx::nvidia::cv::cv::cv() env_size = GetEnvironmentVariableW(ST_ENV_NVIDIA_AR_SDK_PATH, nullptr, 0); if (env_size > 0) { buffer.resize(static_cast(env_size) + 1); - env_size = GetEnvironmentVariableW(ST_ENV_NVIDIA_AR_SDK_PATH, buffer.data(), buffer.size()); + env_size = + GetEnvironmentVariableW(ST_ENV_NVIDIA_AR_SDK_PATH, buffer.data(), static_cast(buffer.size())); ar_sdk_path = std::wstring(buffer.data(), buffer.size()); } else { PWSTR str = nullptr; diff --git a/source/nvidia/vfx/nvidia-vfx-superresolution.cpp b/source/nvidia/vfx/nvidia-vfx-superresolution.cpp index ec2223ed..5733918b 100644 --- a/source/nvidia/vfx/nvidia-vfx-superresolution.cpp +++ b/source/nvidia/vfx/nvidia-vfx-superresolution.cpp @@ -113,7 +113,7 @@ void streamfx::nvidia::vfx::superresolution::set_strength(float strength) std::swap(_strength, strength); // If anything was changed, flag the effect as dirty. - if (!::streamfx::util::math::is_close(_strength, strength, 0.01)) + if (!::streamfx::util::math::is_close(_strength, strength, 0.01f)) _dirty = true; // Update Effect @@ -137,9 +137,9 @@ void streamfx::nvidia::vfx::superresolution::set_scale(float scale) scale = std::clamp(scale, 1., 4.); // Match to nearest scale. - std::pair minimal = {0., std::numeric_limits::max()}; + std::pair minimal = {0.f, std::numeric_limits::max()}; std::vector deltas{ - 1. + (1. / 3.), 1.5, 2.0, 3.0, 4.0, + 1.f + (1.f / 3.f), 1.5f, 2.0f, 3.0f, 4.0f, }; for (float delta : deltas) { float value = abs(delta - scale); @@ -150,7 +150,7 @@ void streamfx::nvidia::vfx::superresolution::set_scale(float scale) } // If anything was changed, flag the effect as dirty. - if (!::streamfx::util::math::is_close(_scale, minimal.first, 0.01)) + if (!::streamfx::util::math::is_close(_scale, minimal.first, 0.01f)) _dirty = true; _scale = minimal.first; diff --git a/source/nvidia/vfx/nvidia-vfx.cpp b/source/nvidia/vfx/nvidia-vfx.cpp index 0367e9a9..9913c156 100644 --- a/source/nvidia/vfx/nvidia-vfx.cpp +++ b/source/nvidia/vfx/nvidia-vfx.cpp @@ -86,7 +86,8 @@ streamfx::nvidia::vfx::vfx::vfx() env_size = GetEnvironmentVariableW(ST_ENV_NVIDIA_VIDEO_EFFECTS_SDK_PATH, nullptr, 0); if (env_size > 0) { buffer.resize(static_cast(env_size) + 1); - env_size = GetEnvironmentVariableW(ST_ENV_NVIDIA_VIDEO_EFFECTS_SDK_PATH, buffer.data(), buffer.size()); + env_size = GetEnvironmentVariableW(ST_ENV_NVIDIA_VIDEO_EFFECTS_SDK_PATH, buffer.data(), + static_cast(buffer.size())); sdk_path = std::wstring(buffer.data(), buffer.size()); } else { PWSTR str = nullptr;