project: Fix various warnings

This commit is contained in:
Michael Fabian 'Xaymar' Dirks 2021-09-07 05:11:04 +02:00
parent 380d75f770
commit 04c7116f5a
6 changed files with 13 additions and 10 deletions

View File

@ -196,7 +196,7 @@ void nvenc::override_update(ffmpeg_instance* instance, obs_data_t*)
} }
// Set delay // Set delay
context->delay = std::min<int>(std::max<int64_t>(async_depth, 3ll), surfaces - 1); context->delay = std::min<int>(std::max<int>(static_cast<int>(async_depth), 3), static_cast<int>(surfaces - 1));
} }
void nvenc::get_defaults(obs_data_t* settings, const AVCodec*, AVCodecContext*) void nvenc::get_defaults(obs_data_t* settings, const AVCodec*, AVCodecContext*)

View File

@ -101,7 +101,7 @@ streamfx::nvidia::cuda::context::context(ID3D11Device* device) : context()
{ {
// Device Name // Device Name
std::vector<char> name(256, 0); std::vector<char> name(256, 0);
_cuda->cuDeviceGetName(name.data(), name.size() - 1, _device); _cuda->cuDeviceGetName(name.data(), static_cast<int32_t>(name.size() - 1), _device);
device_name = std::string(name.data(), name.data() + strlen(name.data())); device_name = std::string(name.data(), name.data() + strlen(name.data()));
// Device LUID // Device LUID

View File

@ -32,7 +32,7 @@ namespace streamfx::nvidia::cv {
protected: protected:
std::shared_ptr<::streamfx::nvidia::cv::cv> _cv; std::shared_ptr<::streamfx::nvidia::cv::cv> _cv;
image_t _image; image_t _image;
size_t _alignment; uint32_t _alignment;
public: public:
virtual ~image(); virtual ~image();

View File

@ -88,7 +88,8 @@ streamfx::nvidia::cv::cv::cv()
env_size = GetEnvironmentVariableW(ST_ENV_NVIDIA_VIDEO_EFFECTS_SDK_PATH, nullptr, 0); env_size = GetEnvironmentVariableW(ST_ENV_NVIDIA_VIDEO_EFFECTS_SDK_PATH, nullptr, 0);
if (env_size > 0) { if (env_size > 0) {
buffer.resize(static_cast<size_t>(env_size) + 1); buffer.resize(static_cast<size_t>(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<DWORD>(buffer.size()));
vfx_sdk_path = std::wstring(buffer.data(), buffer.size()); vfx_sdk_path = std::wstring(buffer.data(), buffer.size());
} else { } else {
PWSTR str = nullptr; PWSTR str = nullptr;
@ -116,7 +117,8 @@ streamfx::nvidia::cv::cv::cv()
env_size = GetEnvironmentVariableW(ST_ENV_NVIDIA_AR_SDK_PATH, nullptr, 0); env_size = GetEnvironmentVariableW(ST_ENV_NVIDIA_AR_SDK_PATH, nullptr, 0);
if (env_size > 0) { if (env_size > 0) {
buffer.resize(static_cast<size_t>(env_size) + 1); buffer.resize(static_cast<size_t>(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<DWORD>(buffer.size()));
ar_sdk_path = std::wstring(buffer.data(), buffer.size()); ar_sdk_path = std::wstring(buffer.data(), buffer.size());
} else { } else {
PWSTR str = nullptr; PWSTR str = nullptr;

View File

@ -113,7 +113,7 @@ void streamfx::nvidia::vfx::superresolution::set_strength(float strength)
std::swap(_strength, strength); std::swap(_strength, strength);
// If anything was changed, flag the effect as dirty. // If anything was changed, flag the effect as dirty.
if (!::streamfx::util::math::is_close<float>(_strength, strength, 0.01)) if (!::streamfx::util::math::is_close<float>(_strength, strength, 0.01f))
_dirty = true; _dirty = true;
// Update Effect // Update Effect
@ -137,9 +137,9 @@ void streamfx::nvidia::vfx::superresolution::set_scale(float scale)
scale = std::clamp<float>(scale, 1., 4.); scale = std::clamp<float>(scale, 1., 4.);
// Match to nearest scale. // Match to nearest scale.
std::pair<float, float> minimal = {0., std::numeric_limits<float>::max()}; std::pair<float, float> minimal = {0.f, std::numeric_limits<float>::max()};
std::vector<float> deltas{ std::vector<float> 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) { for (float delta : deltas) {
float value = abs(delta - scale); 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 anything was changed, flag the effect as dirty.
if (!::streamfx::util::math::is_close<float>(_scale, minimal.first, 0.01)) if (!::streamfx::util::math::is_close<float>(_scale, minimal.first, 0.01f))
_dirty = true; _dirty = true;
_scale = minimal.first; _scale = minimal.first;

View File

@ -86,7 +86,8 @@ streamfx::nvidia::vfx::vfx::vfx()
env_size = GetEnvironmentVariableW(ST_ENV_NVIDIA_VIDEO_EFFECTS_SDK_PATH, nullptr, 0); env_size = GetEnvironmentVariableW(ST_ENV_NVIDIA_VIDEO_EFFECTS_SDK_PATH, nullptr, 0);
if (env_size > 0) { if (env_size > 0) {
buffer.resize(static_cast<size_t>(env_size) + 1); buffer.resize(static_cast<size_t>(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<DWORD>(buffer.size()));
sdk_path = std::wstring(buffer.data(), buffer.size()); sdk_path = std::wstring(buffer.data(), buffer.size());
} else { } else {
PWSTR str = nullptr; PWSTR str = nullptr;