libobs: Make wcs<->utf8 conversion consistent

On Windows NULL characters would be included in the output if insize is
non-zero, but on *nix it would abort on the first NULL.
This commit is contained in:
derrod
2022-10-23 03:19:58 +02:00
committed by Jim
parent 77e4c1c305
commit a5468cfee0

View File

@@ -146,7 +146,7 @@ size_t utf8_to_wchar(const char *in, size_t insize, wchar_t *out,
wlim = out == NULL ? NULL : out + outsize;
for (; p < lim; p += n) {
if (!*p)
if (!*p && insize == 0)
break;
if (utf8_forbidden(*p) != 0 && (flags & UTF8_IGNORE_ERROR) == 0)
@@ -276,7 +276,7 @@ size_t wchar_to_utf8(const wchar_t *in, size_t insize, char *out,
total = 0;
for (; w < wlim; w++) {
if (!*w)
if (!*w && insize == 0)
break;
if (wchar_forbidden(*w) != 0) {