mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-23 23:17:46 +01:00
VST3: fix utf8 -> utf16 string conversion
This commit is contained in:
parent
bc78629788
commit
b03bfbbbb7
1 changed files with 4 additions and 3 deletions
|
|
@ -98,14 +98,15 @@ Steinberg::utf8_to_tchar (Vst::TChar* rv, const char* s, size_t l)
|
|||
{
|
||||
glong len;
|
||||
gunichar2* s16 = g_utf8_to_utf16 (s, -1, NULL, &len, NULL);
|
||||
if (!s16 || len == 0) {
|
||||
if (!s16 || len <= 0) {
|
||||
memset (rv, 0, sizeof (Vst::TChar));
|
||||
return false;
|
||||
}
|
||||
if (l > 0 && l < len) {
|
||||
len = l;
|
||||
if (l > 0 && l <= (size_t) len) {
|
||||
len = l - 1;
|
||||
}
|
||||
memcpy (rv, s16, len * sizeof (Vst::TChar));
|
||||
rv[len] = '\0';
|
||||
g_free (s16);
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue