decklink: Fix string handling causing plugin to not function

This commit is contained in:
Marco
2024-11-16 13:49:07 +01:00
committed by Ryan Foster
parent 4652daf748
commit 7722698c7c

View File

@@ -1,6 +1,7 @@
#include "../platform.hpp"
#include <util/platform.h>
#include <comdef.h>
IDeckLinkDiscovery *CreateDeckLinkDiscoveryInstance(void)
{
@@ -31,11 +32,10 @@ bool DeckLinkStringToStdString(decklink_string_t input, std::string &output)
if (input == nullptr)
return false;
size_t len = wcslen(input);
size_t utf8_len = os_wcs_to_utf8(input, len, nullptr, 0);
char *out = _com_util::ConvertBSTRToString(input);
output = std::string(out);
output.resize(utf8_len);
os_wcs_to_utf8(input, len, &output[0], utf8_len);
delete[] out;
return true;
}