Fix BLI_strncpy_wchar_from_utf8 result on Windows

This function was documented to return the length but returned an
error value for WIN32. While this doesn't cause any bugs at the moment,
it could cause problems in the future.

Oversight in 5496d8cd36.
This commit is contained in:
Campbell Barton 2021-08-29 12:06:15 +10:00
parent 4256eeeec4
commit 2f7258d618
1 changed files with 3 additions and 1 deletions

View File

@ -378,7 +378,9 @@ size_t BLI_strncpy_wchar_from_utf8(wchar_t *__restrict dst_w,
const size_t maxncpy)
{
#ifdef WIN32
return conv_utf_8_to_16(src_c, dst_w, maxncpy);
conv_utf_8_to_16(src_c, dst_w, maxncpy);
/* NOTE: it would be more efficient to calculate the length as part of #conv_utf_8_to_16. */
return wcslen(dst_w);
#else
return BLI_str_utf8_as_utf32((char32_t *)dst_w, src_c, maxncpy);
#endif