# HG changeset patch # User Chris Cannam # Date 1337873889 -3600 # Node ID 9648ba9812d603d555bcaac647f734072124c3a6 # Parent dba435f9b2838594e721764a6af3e9932db56573 Apply vamp-2.3-windows-unicode.patch from RJ Ryan in #464 diff -r dba435f9b283 -r 9648ba9812d6 src/vamp-hostsdk/PluginLoader.cpp --- 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);