Code cleanup.

This commit is contained in:
spx 2011-08-28 16:06:23 +00:00
parent 2df0f6f7f6
commit b52fd99949
2 changed files with 10 additions and 10 deletions

View File

@ -734,7 +734,7 @@ void CDialogManage::CTabSkins::ReadSkin()
ShowScrollBar(item, SB_VERT, FALSE); ShowScrollBar(item, SB_VERT, FALSE);
} }
delete buffer; delete [] buffer;
} }
/* /*
@ -1396,7 +1396,7 @@ void CDialogManage::CTabThemes::PreserveSetting(const std::wstring& backupFile,
WritePrivateProfileString(L"Rainmeter", key, buffer, Rainmeter->GetIniFile().c_str()); WritePrivateProfileString(L"Rainmeter", key, buffer, Rainmeter->GetIniFile().c_str());
} }
delete buffer; delete [] buffer;
} }
/* /*

View File

@ -466,11 +466,11 @@ std::string ConvertToAscii(LPCTSTR str)
if (str && *str) if (str && *str)
{ {
int strLen = (int)wcslen(str) + 1; int strLen = (int)wcslen(str);
int bufLen = WideCharToMultiByte(CP_ACP, 0, str, strLen, NULL, 0, NULL, NULL); int bufLen = WideCharToMultiByte(CP_ACP, 0, str, strLen, NULL, 0, NULL, NULL);
if (bufLen > 0) if (bufLen > 0)
{ {
szAscii.resize(bufLen - 1); szAscii.resize(bufLen);
WideCharToMultiByte(CP_ACP, 0, str, strLen, &szAscii[0], bufLen, NULL, NULL); WideCharToMultiByte(CP_ACP, 0, str, strLen, &szAscii[0], bufLen, NULL, NULL);
} }
} }
@ -483,11 +483,11 @@ std::wstring ConvertToWide(LPCSTR str)
if (str && *str) if (str && *str)
{ {
int strLen = (int)strlen(str) + 1; int strLen = (int)strlen(str);
int bufLen = MultiByteToWideChar(CP_ACP, 0, str, strLen, NULL, 0); int bufLen = MultiByteToWideChar(CP_ACP, 0, str, strLen, NULL, 0);
if (bufLen > 0) if (bufLen > 0)
{ {
szWide.resize(bufLen - 1); szWide.resize(bufLen);
MultiByteToWideChar(CP_ACP, 0, str, strLen, &szWide[0], bufLen); MultiByteToWideChar(CP_ACP, 0, str, strLen, &szWide[0], bufLen);
} }
} }
@ -500,11 +500,11 @@ std::string ConvertToUTF8(LPCWSTR str)
if (str && *str) if (str && *str)
{ {
int strLen = (int)wcslen(str) + 1; int strLen = (int)wcslen(str);
int bufLen = WideCharToMultiByte(CP_UTF8, 0, str, strLen, NULL, 0, NULL, NULL); int bufLen = WideCharToMultiByte(CP_UTF8, 0, str, strLen, NULL, 0, NULL, NULL);
if (bufLen > 0) if (bufLen > 0)
{ {
szAscii.resize(bufLen - 1); szAscii.resize(bufLen);
WideCharToMultiByte(CP_UTF8, 0, str, strLen, &szAscii[0], bufLen, NULL, NULL); WideCharToMultiByte(CP_UTF8, 0, str, strLen, &szAscii[0], bufLen, NULL, NULL);
} }
} }
@ -517,11 +517,11 @@ std::wstring ConvertUTF8ToWide(LPCSTR str)
if (str && *str) if (str && *str)
{ {
int strLen = (int)strlen(str) + 1; int strLen = (int)strlen(str);
int bufLen = MultiByteToWideChar(CP_UTF8, 0, str, strLen, NULL, 0); int bufLen = MultiByteToWideChar(CP_UTF8, 0, str, strLen, NULL, 0);
if (bufLen > 0) if (bufLen > 0)
{ {
szWide.resize(bufLen - 1); szWide.resize(bufLen);
MultiByteToWideChar(CP_UTF8, 0, str, strLen, &szWide[0], bufLen); MultiByteToWideChar(CP_UTF8, 0, str, strLen, &szWide[0], bufLen);
} }
} }