Cycles: Fix infinite recursion of md5 calculation on Windows

Was caused by some safety things of making sure we've for NULL
terminator for the buffer when doing mbs<->wcs conversion, but
it turns out this simply confuses str::string and it can no
longer have proper .size(). Let's assume behavior of string
allocation is same all over the std, and we can avoid having
that extra null-terminator allocated.
This commit is contained in:
Sergey Sharybin 2016-02-14 21:05:29 +05:00
parent b4e10aa70b
commit 7d85da882b
1 changed files with 2 additions and 2 deletions

View File

@ -171,7 +171,7 @@ wstring string_to_wstring(const string& str)
str.length(),
NULL,
0);
wstring str_wc(length_wc + 1, 0);
wstring str_wc(length_wc, 0);
MultiByteToWideChar(CP_ACP,
0,
str.c_str(),
@ -190,7 +190,7 @@ string string_from_wstring(const wstring& str)
NULL,
0,
NULL, NULL);
string str_mb(length_mb + 1, 0);
string str_mb(length_mb, 0);
WideCharToMultiByte(CP_ACP,
0,
str.c_str(),