Fixed that !RainmeterSetVariable and !RainmeterWriteKeyValue are unable to set/write empty value (thanks spx!).

This commit is contained in:
Birunthan Mohanathas 2011-01-27 15:23:15 +00:00
parent c24a3c025f
commit ce614da5f3
2 changed files with 20 additions and 12 deletions

View File

@ -54,9 +54,6 @@ std::vector<std::wstring> CRainmeter::ParseString(LPCTSTR str)
while (quotePos != std::wstring::npos || spacePos != std::wstring::npos)
{
size_t endPos = 0;
std::wstring newStr;
if (spacePos == std::wstring::npos) spacePos = arg.size() - 1;
if (quotePos == 0)
{
@ -65,17 +62,18 @@ std::vector<std::wstring> CRainmeter::ParseString(LPCTSTR str)
// Find the second quote
quotePos = arg.find(L"\"");
endPos = quotePos;
newStr = arg.substr(0, endPos);
arg.erase(0, endPos + 1);
}
else
{
if (spacePos == std::wstring::npos) spacePos = arg.size() - 1;
endPos = spacePos;
newStr = arg.substr(0, endPos);
arg.erase(0, endPos + 1);
}
if (newStr.size() > 0)
std::wstring newStr = arg.substr(0, endPos);
arg.erase(0, endPos + 1);
if (newStr.size() > 0 || quotePos == 0)
{
result.push_back(newStr);
}
@ -123,9 +121,9 @@ int initModuleEx(HWND ParentWnd, HINSTANCE dllInst, LPCSTR szPath)
Result=Rainmeter->Initialize(ParentWnd, dllInst, szPath);
}
}
catch(CError& error)
{
}
catch(CError& error)
{
MessageBox(ParentWnd, error.GetString().c_str(), APPNAME, MB_OK | MB_TOPMOST | MB_ICONEXCLAMATION);
}

View File

@ -130,7 +130,17 @@ LPCTSTR GetString(UINT id, UINT flags)
*/
void Finalize(HMODULE instance, UINT id)
{
/* Nothing to do here */
std::map<UINT, eMeasureType>::iterator i1 = g_Types.find(id);
if (i1 != g_Types.end())
{
g_Types.erase(i1);
}
std::map<UINT, int>::iterator i2 = g_Indexes.find(id);
if (i2 != g_Indexes.end())
{
g_Indexes.erase(i2);
}
}
/*