Fix UTF16 support for EXIF.UserComment on behalf of floessie

Issue reported here
https://discuss.pixls.us/t/call-for-testing-rawtherapee-5-4-rc2/6828/9
This commit is contained in:
Hombre
2018-03-03 16:03:15 +01:00
parent 4122583e5d
commit 5e10f1133b

View File

@@ -1948,8 +1948,8 @@ void Tag::initUserComment (const Glib::ustring &text)
memcpy(value, "ASCII\0\0\0", 8);
memcpy(value + 8, text.c_str(), valuesize - 8);
} else {
wchar_t *commentStr = (wchar_t*)g_utf8_to_utf16 (text.c_str(), -1, nullptr, nullptr, nullptr);
size_t wcStrSize = wcslen(commentStr);
glong wcStrSize = 0;
gunichar2 *commentStr = g_utf8_to_utf16 (text.c_str(), -1, nullptr, &wcStrSize, nullptr);
valuesize = count = wcStrSize * 2 + 8 + (useBOM ? 2 : 0);
value = new unsigned char[valuesize];
memcpy(value, "UNICODE\0", 8);