tag/FixString: use IsNonPrintableASCII()

Fixes breakage of non-ASCII characters, regression from commit
cc72ceb368

Fixes https://github.com/MusicPlayerDaemon/MPD/issues/842
This commit is contained in:
Max Kellermann 2020-04-27 13:58:02 +02:00
parent 814b2a218d
commit bca9678683

View File

@ -90,7 +90,7 @@ static const char *
find_non_printable(StringView p) find_non_printable(StringView p)
{ {
for (const char &ch : p) for (const char &ch : p)
if (!IsPrintableASCII(ch)) if (IsNonPrintableASCII(ch))
return &ch; return &ch;
return nullptr; return nullptr;
@ -110,7 +110,7 @@ clear_non_printable(StringView src)
char *dest = (char *)xmemdup(src.data, src.size); char *dest = (char *)xmemdup(src.data, src.size);
for (size_t i = first - src.data; i < src.size; ++i) for (size_t i = first - src.data; i < src.size; ++i)
if (!IsPrintableASCII(dest[i])) if (IsNonPrintableASCII(dest[i]))
dest[i] = ' '; dest[i] = ' ';
return { dest, src.size }; return { dest, src.size };