From cbddee5b9073ec999285d1da4e0307026432eb97 Mon Sep 17 00:00:00 2001 From: Michael Fabian 'Xaymar' Dirks Date: Thu, 18 Aug 2022 21:20:59 +0200 Subject: [PATCH] nvidia: Assign to std::string_view& instead of swapping For unknown reasons this results in an error only when the project is built within git-bash and with cmake. It does not occur with cmake-gui or VS itself. --- source/nvidia/ar/nvidia-ar-feature.cpp | 4 ++-- source/nvidia/vfx/nvidia-vfx-effect.cpp | 14 ++++++++------ 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/source/nvidia/ar/nvidia-ar-feature.cpp b/source/nvidia/ar/nvidia-ar-feature.cpp index 76ac243..af8d1a0 100644 --- a/source/nvidia/ar/nvidia-ar-feature.cpp +++ b/source/nvidia/ar/nvidia-ar-feature.cpp @@ -70,9 +70,9 @@ streamfx::nvidia::cv::result streamfx::nvidia::ar::feature::get(parameter_t para cv::result res = get(param, cvalue); if (res == cv::result::SUCCESS) { if (cvalue) { - value.swap(std::string_view(cvalue)); + value = std::string_view(cvalue); } else { - value.swap(std::string_view()); + value = std::string_view(); } } return res; diff --git a/source/nvidia/vfx/nvidia-vfx-effect.cpp b/source/nvidia/vfx/nvidia-vfx-effect.cpp index e51c444..b836ba0 100644 --- a/source/nvidia/vfx/nvidia-vfx-effect.cpp +++ b/source/nvidia/vfx/nvidia-vfx-effect.cpp @@ -19,6 +19,7 @@ // SOFTWARE. #include "nvidia-vfx-effect.hpp" +#include #include "obs/gs/gs-helper.hpp" #include "util/util-logging.hpp" @@ -38,7 +39,7 @@ using namespace ::streamfx::nvidia; -vfx::effect::~effect() +streamfx::nvidia::vfx::effect::~effect() { auto gctx = ::streamfx::obs::gs::context(); auto cctx = cuda::obs::get()->get_context()->enter(); @@ -49,7 +50,8 @@ vfx::effect::~effect() _nvcuda.reset(); } -vfx::effect::effect(effect_t effect) : _nvcuda(cuda::obs::get()), _nvcvi(cv::cv::get()), _nvvfx(vfx::vfx::get()), _fx() +streamfx::nvidia::vfx::effect::effect(effect_t effect) + : _nvcuda(cuda::obs::get()), _nvcvi(cv::cv::get()), _nvvfx(vfx::vfx::get()), _fx() { auto gctx = ::streamfx::obs::gs::context(); auto cctx = cuda::obs::get()->get_context()->enter(); @@ -74,21 +76,21 @@ vfx::effect::effect(effect_t effect) : _nvcuda(cuda::obs::get()), _nvcvi(cv::cv: } } -cv::result vfx::effect::get(parameter_t param, std::string_view& value) +cv::result streamfx::nvidia::vfx::effect::get(parameter_t param, std::string_view& value) { const char* cvalue = nullptr; cv::result res = get(param, cvalue); if (res == cv::result::SUCCESS) { if (cvalue) { - value.swap(std::string_view(cvalue)); + value = std::string_view(cvalue); } else { - value.swap(std::string_view()); + value = std::string_view(); } } return res; } -cv::result vfx::effect::get(parameter_t param, std::string& value) +cv::result streamfx::nvidia::vfx::effect::get(parameter_t param, std::string& value) { const char* cvalue = nullptr; cv::result res = get(param, cvalue);