- Fixed: Multibang [] not assumed when [Measure] is replaced in CConfigParser::ReadString().

- Minor changes of ConvertToXXX(): Get an appropriate buffer size to convert the string. And using [] when deleting arrays.
- Fixed a few memory leaks.
- It's now possible to send the !BANG command when all windows are "On Desktop". (Rainmeter.exe and WebParser)
This commit is contained in:
spx
2009-09-12 11:11:40 +00:00
parent 8ea3c6780a
commit 9d96ec61c1
10 changed files with 155 additions and 82 deletions

View File

@ -226,13 +226,18 @@ std::wstring ConvertToWide(LPCSTR str)
{
std::wstring szWide;
if (str)
if (str && *str)
{
size_t len = strlen(str) + 1;
WCHAR* wideSz = new WCHAR[len * 2];
MultiByteToWideChar(CP_ACP, 0, str, (int)len, wideSz, (int)len * 2);
szWide = wideSz;
delete wideSz;
int strLen = (int)strlen(str) + 1;
int bufLen = MultiByteToWideChar(CP_ACP, 0, str, strLen, NULL, 0);
if (bufLen > 0)
{
WCHAR* wideSz = new WCHAR[bufLen];
wideSz[0] = 0;
MultiByteToWideChar(CP_ACP, 0, str, strLen, wideSz, bufLen);
szWide = wideSz;
delete [] wideSz;
}
}
return szWide;
}