From b52fd999490a48ef0ab8806414141a53217c1ebe Mon Sep 17 00:00:00 2001 From: spx Date: Sun, 28 Aug 2011 16:06:23 +0000 Subject: [PATCH] Code cleanup. --- Library/DialogManage.cpp | 4 ++-- Library/Litestep.cpp | 16 ++++++++-------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/Library/DialogManage.cpp b/Library/DialogManage.cpp index 499218e8..2f35dba3 100644 --- a/Library/DialogManage.cpp +++ b/Library/DialogManage.cpp @@ -734,7 +734,7 @@ void CDialogManage::CTabSkins::ReadSkin() 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()); } - delete buffer; + delete [] buffer; } /* diff --git a/Library/Litestep.cpp b/Library/Litestep.cpp index 20eff360..e6ca0140 100644 --- a/Library/Litestep.cpp +++ b/Library/Litestep.cpp @@ -466,11 +466,11 @@ std::string ConvertToAscii(LPCTSTR 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); if (bufLen > 0) { - szAscii.resize(bufLen - 1); + szAscii.resize(bufLen); WideCharToMultiByte(CP_ACP, 0, str, strLen, &szAscii[0], bufLen, NULL, NULL); } } @@ -483,11 +483,11 @@ std::wstring ConvertToWide(LPCSTR 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); if (bufLen > 0) { - szWide.resize(bufLen - 1); + szWide.resize(bufLen); MultiByteToWideChar(CP_ACP, 0, str, strLen, &szWide[0], bufLen); } } @@ -500,11 +500,11 @@ std::string ConvertToUTF8(LPCWSTR 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); if (bufLen > 0) { - szAscii.resize(bufLen - 1); + szAscii.resize(bufLen); WideCharToMultiByte(CP_UTF8, 0, str, strLen, &szAscii[0], bufLen, NULL, NULL); } } @@ -517,11 +517,11 @@ std::wstring ConvertUTF8ToWide(LPCSTR 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); if (bufLen > 0) { - szWide.resize(bufLen - 1); + szWide.resize(bufLen); MultiByteToWideChar(CP_UTF8, 0, str, strLen, &szWide[0], bufLen); } }