Mercurial > hg > vamp-plugin-sdk
diff src/vamp-hostsdk/PluginLoader.cpp @ 331:9648ba9812d6
Apply vamp-2.3-windows-unicode.patch from RJ Ryan in #464
author | Chris Cannam |
---|---|
date | Thu, 24 May 2012 16:38:09 +0100 |
parents | 0e08ebd5c13b |
children | 06988ce35ff0 |
line wrap: on
line diff
--- a/src/vamp-hostsdk/PluginLoader.cpp Fri Dec 02 11:31:00 2011 +0000 +++ b/src/vamp-hostsdk/PluginLoader.cpp Thu May 24 16:38:09 2012 +0100 @@ -531,7 +531,7 @@ void *handle = 0; #ifdef _WIN32 #ifdef UNICODE - int len = path.length(); // cannot be more wchars than length in bytes of utf8 string + int len = path.length() + 1; // cannot be more wchars than length in bytes of utf8 string wchar_t *buffer = new wchar_t[len]; int rv = MultiByteToWideChar(CP_UTF8, 0, path.c_str(), len, buffer, len); if (rv <= 0) { @@ -597,7 +597,7 @@ #ifdef _WIN32 string expression = dir + "\\*." + extension; #ifdef UNICODE - int len = expression.length(); // cannot be more wchars than length in bytes of utf8 string + int len = expression.length() + 1; // cannot be more wchars than length in bytes of utf8 string wchar_t *buffer = new wchar_t[len]; int rv = MultiByteToWideChar(CP_UTF8, 0, expression.c_str(), len, buffer, len); if (rv <= 0) { @@ -616,7 +616,7 @@ bool ok = true; while (ok) { wchar_t *fn = data.cFileName; - int wlen = wcslen(fn); + int wlen = wcslen(fn) + 1; int maxlen = wlen * 6; char *conv = new char[maxlen]; int rv = WideCharToMultiByte(CP_UTF8, 0, fn, wlen, conv, maxlen, 0, 0);