Skip to content

Commit

Permalink
GPU: Fix D3D12_INTERNAL_StrToWStr returning incorrect length
Browse files Browse the repository at this point in the history
  • Loading branch information
thatcosmonaut committed Dec 12, 2024
1 parent a1e8d5c commit fa0225c
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/gpu/d3d12/SDL_gpu_d3d12.c
Original file line number Diff line number Diff line change
Expand Up @@ -3630,7 +3630,8 @@ static bool D3D12_INTERNAL_StrToWStr(
Uint32 *outSize)
{
size_t inlen, result;
size_t outlen = wstrSize;
size_t outBytesLeft = wstrSize;
*outSize = 0;

if (renderer->iconv == NULL) {
renderer->iconv = SDL_iconv_open("WCHAR_T", "UTF-8");
Expand All @@ -3644,9 +3645,8 @@ static bool D3D12_INTERNAL_StrToWStr(
&str,
&inlen,
(char **)&wstr,
&outlen);
&outBytesLeft);

*outSize = (Uint32)outlen;

// Check...
switch (result) {
Expand All @@ -3660,6 +3660,7 @@ static bool D3D12_INTERNAL_StrToWStr(
break;
}

*outSize = (Uint32)(wstrSize - outBytesLeft);
return true;
}

Expand Down

0 comments on commit fa0225c

Please sign in to comment.