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); m_UpdateRandom = 0!=parser.ReadInt(section, L"UpdateRandom", 0);
if (!m_Initialized || if (!m_Initialized ||
m_FormulaHolder != m_Formula || wcscmp(m_FormulaHolder.c_str(), m_Formula.c_str()) != 0 ||
oldLowBound != m_LowBound || oldLowBound != m_LowBound ||
oldHighBound != m_HighBound || oldHighBound != m_HighBound ||
oldUpdateRandom != m_UpdateRandom) oldUpdateRandom != m_UpdateRandom)
@ -183,9 +183,10 @@ void CMeasureCalc::FormulaReplace()
WCHAR buffer[32]; WCHAR buffer[32];
_itow_s(randNumber, buffer, 10); _itow_s(randNumber, buffer, 10);
size_t len = wcslen(buffer);
m_Formula.replace(loc, 6, buffer); m_Formula.replace(loc, 6, buffer, len);
loc += wcslen(buffer); loc += len;
} }
else 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()); std::string scriptFile = ConvertToAscii(m_MeterWindow->MakePathAbsolute(file).c_str());
if (!m_Initialized || if (!m_Initialized ||
scriptFile != m_ScriptFile) strcmp(scriptFile.c_str(), m_ScriptFile.c_str()) != 0)
{ {
DeleteLuaScript(); DeleteLuaScript();

View File

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

View File

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

View File

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

View File

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

View File

@ -210,7 +210,7 @@ bool CMeterImage::Update()
m_ImageNameResult = m_MeterWindow->MakePathAbsolute(m_ImageNameResult); 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; return true;
} }
else if (m_NeedsRedraw) else if (m_NeedsRedraw)

View File

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

View File

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