vamp-2.3-windows-unicode.patch
src/vamp-hostsdk/PluginLoader.cpp 2012-05-24 05:10:02 +0000 | ||
---|---|---|
531 | 531 |
void *handle = 0; |
532 | 532 |
#ifdef _WIN32 |
533 | 533 |
#ifdef UNICODE |
534 |
int len = path.length(); // cannot be more wchars than length in bytes of utf8 string |
|
534 |
int len = path.length() + 1; // cannot be more wchars than length in bytes of utf8 string
|
|
535 | 535 |
wchar_t *buffer = new wchar_t[len]; |
536 | 536 |
int rv = MultiByteToWideChar(CP_UTF8, 0, path.c_str(), len, buffer, len); |
537 | 537 |
if (rv <= 0) { |
... | ... | |
597 | 597 |
#ifdef _WIN32 |
598 | 598 |
string expression = dir + "\\*." + extension; |
599 | 599 |
#ifdef UNICODE |
600 |
int len = expression.length(); // cannot be more wchars than length in bytes of utf8 string |
|
600 |
int len = expression.length() + 1; // cannot be more wchars than length in bytes of utf8 string
|
|
601 | 601 |
wchar_t *buffer = new wchar_t[len]; |
602 | 602 |
int rv = MultiByteToWideChar(CP_UTF8, 0, expression.c_str(), len, buffer, len); |
603 | 603 |
if (rv <= 0) { |
... | ... | |
616 | 616 |
bool ok = true; |
617 | 617 |
while (ok) { |
618 | 618 |
wchar_t *fn = data.cFileName; |
619 |
int wlen = wcslen(fn); |
|
619 |
int wlen = wcslen(fn) + 1;
|
|
620 | 620 |
int maxlen = wlen * 6; |
621 | 621 |
char *conv = new char[maxlen]; |
622 | 622 |
int rv = WideCharToMultiByte(CP_UTF8, 0, fn, wlen, conv, maxlen, 0, 0); |