Switched from std::wstring.compare() to wcscmp().

This commit is contained in:
spx 2011-11-27 08:30:39 +00:00
parent e56273113d
commit 34005f14a4
10 changed files with 19 additions and 17 deletions

View File

@ -143,7 +143,7 @@ void CMeasureCalc::ReadConfig(CConfigParser& parser, const WCHAR* section)
m_UpdateRandom = 0!=parser.ReadInt(section, L"UpdateRandom", 0);
if (!m_Initialized ||
m_FormulaHolder != m_Formula ||
wcscmp(m_FormulaHolder.c_str(), m_Formula.c_str()) != 0 ||
oldLowBound != m_LowBound ||
oldHighBound != m_HighBound ||
oldUpdateRandom != m_UpdateRandom)
@ -183,9 +183,10 @@ void CMeasureCalc::FormulaReplace()
WCHAR buffer[32];
_itow_s(randNumber, buffer, 10);
size_t len = wcslen(buffer);
m_Formula.replace(loc, 6, buffer);
loc += wcslen(buffer);
m_Formula.replace(loc, 6, buffer, len);
loc += len;
}
else
{

View File

@ -141,7 +141,7 @@ void CMeasureScript::ReadConfig(CConfigParser& parser, const WCHAR* section)
std::string scriptFile = ConvertToAscii(m_MeterWindow->MakePathAbsolute(file).c_str());
if (!m_Initialized ||
scriptFile != m_ScriptFile)
strcmp(scriptFile.c_str(), m_ScriptFile.c_str()) != 0)
{
DeleteLuaScript();

View File

@ -282,11 +282,10 @@ void CMeter::ReadConfig(CConfigParser& parser, const WCHAR* section)
std::wstring oldStyleX = m_StyleX;
std::wstring oldStyleY = m_StyleY;
std::wstring oldStyleHidden = m_StyleHidden;
std::wstring coord = parser.ReadString(section, L"X", L"0");
m_StyleX = parser.GetLastUsedStyle();
if (!m_Initialized || parser.GetLastReplaced() || !parser.GetLastDefaultUsed() && m_StyleX != oldStyleX)
if (!m_Initialized || parser.GetLastReplaced() || !parser.GetLastDefaultUsed() && wcscmp(m_StyleX.c_str(), oldStyleX.c_str()) != 0)
{
if (!coord.empty())
{
@ -325,7 +324,7 @@ void CMeter::ReadConfig(CConfigParser& parser, const WCHAR* section)
coord = parser.ReadString(section, L"Y", L"0");
m_StyleY = parser.GetLastUsedStyle();
if (!m_Initialized || parser.GetLastReplaced() || !parser.GetLastDefaultUsed() && m_StyleY != oldStyleY)
if (!m_Initialized || parser.GetLastReplaced() || !parser.GetLastDefaultUsed() && wcscmp(m_StyleY.c_str(), oldStyleY.c_str()) != 0)
{
if (!coord.empty())
{
@ -376,9 +375,11 @@ void CMeter::ReadConfig(CConfigParser& parser, const WCHAR* section)
}
else
{
std::wstring oldStyleHidden = m_StyleHidden;
const std::wstring& result = parser.ReadString(section, L"Hidden", L"0");
m_StyleHidden = parser.GetLastUsedStyle();
if (parser.GetLastReplaced() || !parser.GetLastDefaultUsed() && m_StyleHidden != oldStyleHidden)
if (parser.GetLastReplaced() || !parser.GetLastDefaultUsed() && wcscmp(m_StyleHidden.c_str(), oldStyleHidden.c_str()) != 0)
{
m_Hidden = 0!=parser.ParseInt(result.c_str(), 0);
}

View File

@ -140,7 +140,7 @@ void CMeterBar::ReadConfig(CConfigParser& parser, const WCHAR* section)
if (m_Initialized)
{
m_NeedsReload = (oldImageName != m_ImageName);
m_NeedsReload = (wcscmp(oldImageName.c_str(), m_ImageName.c_str()) != 0);
if (m_NeedsReload ||
m_Image.IsConfigsChanged())

View File

@ -221,7 +221,7 @@ void CMeterBitmap::ReadConfig(CConfigParser& parser, const WCHAR* section)
if (m_Initialized)
{
m_NeedsReload = (oldImageName != m_ImageName);
m_NeedsReload = (wcscmp(oldImageName.c_str(), m_ImageName.c_str()) != 0);
if (m_NeedsReload ||
m_Image.IsConfigsChanged())

View File

@ -161,7 +161,7 @@ void CMeterButton::ReadConfig(CConfigParser& parser, const WCHAR* section)
if (m_Initialized)
{
m_NeedsReload = (oldImageName != m_ImageName);
m_NeedsReload = (wcscmp(oldImageName.c_str(), m_ImageName.c_str()) != 0);
if (m_NeedsReload ||
m_Image.IsConfigsChanged())

View File

@ -273,9 +273,9 @@ void CMeterHistogram::ReadConfig(CConfigParser& parser, const WCHAR* section)
m_W = oldW;
m_H = oldH;
m_PrimaryNeedsReload = (oldPrimaryImageName != m_PrimaryImageName);
m_SecondaryNeedsReload = (oldSecondaryImageName != m_SecondaryImageName);
m_BothNeedsReload = (oldBothImageName != m_BothImageName);
m_PrimaryNeedsReload = (wcscmp(oldPrimaryImageName.c_str(), m_PrimaryImageName.c_str()) != 0);
m_SecondaryNeedsReload = (wcscmp(oldSecondaryImageName.c_str(), m_SecondaryImageName.c_str()) != 0);
m_BothNeedsReload = (wcscmp(oldBothImageName.c_str(), m_BothImageName.c_str()) != 0);
if (m_PrimaryNeedsReload ||
m_SecondaryNeedsReload ||

View File

@ -210,7 +210,7 @@ bool CMeterImage::Update()
m_ImageNameResult = m_MeterWindow->MakePathAbsolute(m_ImageNameResult);
}
LoadImage(m_ImageNameResult, oldResult != m_ImageNameResult);
LoadImage(m_ImageNameResult, (wcscmp(oldResult.c_str(), m_ImageNameResult.c_str()) != 0));
return true;
}
else if (m_NeedsRedraw)

View File

@ -115,7 +115,7 @@ void CMeterRotator::ReadConfig(CConfigParser& parser, const WCHAR* section)
if (m_Initialized)
{
m_NeedsReload = (oldImageName != m_ImageName);
m_NeedsReload = (wcscmp(oldImageName.c_str(), m_ImageName.c_str()) != 0);
if (m_NeedsReload ||
m_Image.IsConfigsChanged())

View File

@ -463,7 +463,7 @@ void CMeterString::ReadConfig(CConfigParser& parser, const WCHAR* section)
}
if (m_Initialized &&
(oldFontFace != m_FontFace ||
(wcscmp(oldFontFace.c_str(), m_FontFace.c_str()) != 0 ||
oldFontSize != m_FontSize ||
oldStyle != m_Style))
{