Skip to content

Commit

Permalink
nvidia: Assign to std::string_view& instead of swapping
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Xaymar committed Aug 19, 2022
1 parent b264903 commit f792366
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
4 changes: 2 additions & 2 deletions source/nvidia/ar/nvidia-ar-feature.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
14 changes: 8 additions & 6 deletions source/nvidia/vfx/nvidia-vfx-effect.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
// SOFTWARE.

#include "nvidia-vfx-effect.hpp"
#include <string_view>
#include "obs/gs/gs-helper.hpp"
#include "util/util-logging.hpp"

Expand All @@ -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();
Expand All @@ -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();
Expand All @@ -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);
Expand Down

0 comments on commit f792366

Please # to comment.