Skip to content

Commit

Permalink
decklink: Fix string handling causing plugin to not function
Browse files Browse the repository at this point in the history
  • Loading branch information
CyBeRoni authored and RytoEX committed Nov 18, 2024
1 parent 4652daf commit 7722698
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions plugins/decklink/win/platform.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#include "../platform.hpp"

#include <util/platform.h>
#include <comdef.h>

IDeckLinkDiscovery *CreateDeckLinkDiscoveryInstance(void)
{
Expand Down Expand Up @@ -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;
}

0 comments on commit 7722698

Please sign in to comment.