Minor tweaks.

This commit is contained in:
spx 2011-07-12 13:37:31 +00:00
parent c776cff348
commit 6ceacb0d98
4 changed files with 13 additions and 13 deletions

View File

@ -469,13 +469,13 @@ bool CConfigParser::ReplaceVariables(std::wstring& result)
end = result.find(L'#', pos + 1);
if (end != std::wstring::npos)
{
std::wstring strVariable(result.begin() + pos + 1, result.begin() + end);
std::wstring strVariable = result.substr(pos + 1, end - (pos + 1));
std::wstring strValue;
if (GetVariable(strVariable, strValue))
{
// Variable found, replace it with the value
result.replace(result.begin() + pos, result.begin() + end + 1, strValue);
result.replace(pos, end - pos + 1, strValue);
start = pos + strValue.length();
replaced = true;
}
@ -526,7 +526,7 @@ bool CConfigParser::ReplaceMeasures(std::wstring& result)
pos2 = result.find(L'[', pos + 1);
if (pos2 == std::wstring::npos || end < pos2)
{
std::wstring var(result.begin() + pos + 1, result.begin() + end);
std::wstring var = result.substr(pos + 1, end - (pos + 1));
CMeasure* measure = GetMeasure(var);
if (measure)
@ -534,7 +534,7 @@ bool CConfigParser::ReplaceMeasures(std::wstring& result)
std::wstring value = measure->GetStringValue(AUTOSCALE_OFF, 1, -1, false);
// Measure found, replace it with the value
result.replace(result.begin() + pos, result.begin() + end + 1, value);
result.replace(pos, end - pos + 1, value);
start = pos + value.length();
replaced = true;
}

View File

@ -213,8 +213,8 @@ const WCHAR* CMeasure::CheckSubstitute(const WCHAR* buffer)
pos = str.find(m_Substitute[i], start);
if (pos != std::wstring::npos)
{
str.replace(str.begin() + pos, str.begin() + pos + m_Substitute[i].size(), m_Substitute[i + 1]);
start = pos + m_Substitute[i + 1].size();
str.replace(pos, m_Substitute[i].length(), m_Substitute[i + 1]);
start = pos + m_Substitute[i + 1].length();
}
} while (pos != std::wstring::npos);
}

View File

@ -625,7 +625,7 @@ bool CMeter::ReplaceMeasures(const std::vector<std::wstring>& stringValues, std:
pos = str.find(buffer, start);
if (pos != std::wstring::npos)
{
str.replace(str.begin() + pos, str.begin() + pos + wcslen(buffer), stringValues[i - 1]);
str.replace(pos, wcslen(buffer), stringValues[i - 1]);
start = pos + stringValues[i - 1].length();
replaced = true;
}

View File

@ -97,7 +97,7 @@ std::vector<std::wstring> CRainmeter::ParseString(LPCTSTR str)
size_t pos = result[i].find(L"\"");
while (pos != std::wstring::npos)
{
result[i].erase(result[i].begin() + pos, result[i].begin() + pos + 1);
result[i].erase(pos, 1);
pos = result[i].find(L"\"");
}
}
@ -2245,7 +2245,7 @@ void CRainmeter::CreateDefaultConfigFile(const std::wstring& strFile)
size_t pos = strFile.find_last_of(L'\\');
if (pos != std::wstring::npos)
{
std::wstring strPath(strFile.begin(), strFile.begin() + pos);
std::wstring strPath(strFile, 0, pos);
CreateDirectory(strPath.c_str(), NULL);
}