Switched from _snwprintf_s to _itow_s where possible.

This commit is contained in:
Birunthan Mohanathas 2011-11-09 08:52:32 +00:00
parent a1e722181e
commit f8f31a527e
8 changed files with 70 additions and 73 deletions

View File

@ -224,16 +224,16 @@ void CConfigParser::SetMultiMonitorVariables(bool reset)
SystemParametersInfo(SPI_GETWORKAREA, 0, &workArea, 0); SystemParametersInfo(SPI_GETWORKAREA, 0, &workArea, 0);
_snwprintf_s(buffer, _TRUNCATE, L"%i", workArea.left); _itow_s(workArea.left, buffer, 10);
SetMonitorVariable(L"WORKAREAX", buffer); SetMonitorVariable(L"WORKAREAX", buffer);
SetMonitorVariable(L"PWORKAREAX", buffer); SetMonitorVariable(L"PWORKAREAX", buffer);
_snwprintf_s(buffer, _TRUNCATE, L"%i", workArea.top); _itow_s(workArea.top, buffer, 10);
SetMonitorVariable(L"WORKAREAY", buffer); SetMonitorVariable(L"WORKAREAY", buffer);
SetMonitorVariable(L"PWORKAREAY", buffer); SetMonitorVariable(L"PWORKAREAY", buffer);
_snwprintf_s(buffer, _TRUNCATE, L"%i", workArea.right - workArea.left); _itow_s(workArea.right - workArea.left, buffer, 10);
SetMonitorVariable(L"WORKAREAWIDTH", buffer); SetMonitorVariable(L"WORKAREAWIDTH", buffer);
SetMonitorVariable(L"PWORKAREAWIDTH", buffer); SetMonitorVariable(L"PWORKAREAWIDTH", buffer);
_snwprintf_s(buffer, _TRUNCATE, L"%i", workArea.bottom - workArea.top); _itow_s(workArea.bottom - workArea.top, buffer, 10);
SetMonitorVariable(L"WORKAREAHEIGHT", buffer); SetMonitorVariable(L"WORKAREAHEIGHT", buffer);
SetMonitorVariable(L"PWORKAREAHEIGHT", buffer); SetMonitorVariable(L"PWORKAREAHEIGHT", buffer);
@ -244,26 +244,26 @@ void CConfigParser::SetMultiMonitorVariables(bool reset)
scrArea.right = GetSystemMetrics(SM_CXSCREEN); scrArea.right = GetSystemMetrics(SM_CXSCREEN);
scrArea.bottom = GetSystemMetrics(SM_CYSCREEN); scrArea.bottom = GetSystemMetrics(SM_CYSCREEN);
_snwprintf_s(buffer, _TRUNCATE, L"%i", scrArea.left); _itow_s(scrArea.left, buffer, 10);
SetMonitorVariable(L"SCREENAREAX", buffer); SetMonitorVariable(L"SCREENAREAX", buffer);
SetMonitorVariable(L"PSCREENAREAX", buffer); SetMonitorVariable(L"PSCREENAREAX", buffer);
_snwprintf_s(buffer, _TRUNCATE, L"%i", scrArea.top); _itow_s(scrArea.top, buffer, 10);
SetMonitorVariable(L"SCREENAREAY", buffer); SetMonitorVariable(L"SCREENAREAY", buffer);
SetMonitorVariable(L"PSCREENAREAY", buffer); SetMonitorVariable(L"PSCREENAREAY", buffer);
_snwprintf_s(buffer, _TRUNCATE, L"%i", scrArea.right - scrArea.left); _itow_s(scrArea.right - scrArea.left, buffer, 10);
SetMonitorVariable(L"SCREENAREAWIDTH", buffer); SetMonitorVariable(L"SCREENAREAWIDTH", buffer);
SetMonitorVariable(L"PSCREENAREAWIDTH", buffer); SetMonitorVariable(L"PSCREENAREAWIDTH", buffer);
_snwprintf_s(buffer, _TRUNCATE, L"%i", scrArea.bottom - scrArea.top); _itow_s(scrArea.bottom - scrArea.top, buffer, 10);
SetMonitorVariable(L"SCREENAREAHEIGHT", buffer); SetMonitorVariable(L"SCREENAREAHEIGHT", buffer);
SetMonitorVariable(L"PSCREENAREAHEIGHT", buffer); SetMonitorVariable(L"PSCREENAREAHEIGHT", buffer);
_snwprintf_s(buffer, _TRUNCATE, L"%i", GetSystemMetrics(SM_XVIRTUALSCREEN)); _itow_s(GetSystemMetrics(SM_XVIRTUALSCREEN), buffer, 10);
SetMonitorVariable(L"VSCREENAREAX", buffer); SetMonitorVariable(L"VSCREENAREAX", buffer);
_snwprintf_s(buffer, _TRUNCATE, L"%i", GetSystemMetrics(SM_YVIRTUALSCREEN)); _itow_s(GetSystemMetrics(SM_YVIRTUALSCREEN), buffer, 10);
SetMonitorVariable(L"VSCREENAREAY", buffer); SetMonitorVariable(L"VSCREENAREAY", buffer);
_snwprintf_s(buffer, _TRUNCATE, L"%i", GetSystemMetrics(SM_CXVIRTUALSCREEN)); _itow_s(GetSystemMetrics(SM_CXVIRTUALSCREEN), buffer, 10);
SetMonitorVariable(L"VSCREENAREAWIDTH", buffer); SetMonitorVariable(L"VSCREENAREAWIDTH", buffer);
_snwprintf_s(buffer, _TRUNCATE, L"%i", GetSystemMetrics(SM_CYVIRTUALSCREEN)); _itow_s(GetSystemMetrics(SM_CYVIRTUALSCREEN), buffer, 10);
SetMonitorVariable(L"VSCREENAREAHEIGHT", buffer); SetMonitorVariable(L"VSCREENAREAHEIGHT", buffer);
} }
@ -278,16 +278,16 @@ void CConfigParser::SetMultiMonitorVariables(bool reset)
const RECT work = (monitors[i].active) ? monitors[i].work : workArea; const RECT work = (monitors[i].active) ? monitors[i].work : workArea;
_snwprintf_s(buffer, _TRUNCATE, L"%i", work.left); _itow_s(work.left, buffer, 10);
_snwprintf_s(buffer2, _TRUNCATE, L"WORKAREAX@%i", (int)i + 1); _snwprintf_s(buffer2, _TRUNCATE, L"WORKAREAX@%i", (int)i + 1);
SetMonitorVariable(buffer2, buffer); SetMonitorVariable(buffer2, buffer);
_snwprintf_s(buffer, _TRUNCATE, L"%i", work.top); _itow_s(work.top, buffer, 10);
_snwprintf_s(buffer2, _TRUNCATE, L"WORKAREAY@%i", (int)i + 1); _snwprintf_s(buffer2, _TRUNCATE, L"WORKAREAY@%i", (int)i + 1);
SetMonitorVariable(buffer2, buffer); SetMonitorVariable(buffer2, buffer);
_snwprintf_s(buffer, _TRUNCATE, L"%i", work.right - work.left); _itow_s(work.right - work.left, buffer, 10);
_snwprintf_s(buffer2, _TRUNCATE, L"WORKAREAWIDTH@%i", (int)i + 1); _snwprintf_s(buffer2, _TRUNCATE, L"WORKAREAWIDTH@%i", (int)i + 1);
SetMonitorVariable(buffer2, buffer); SetMonitorVariable(buffer2, buffer);
_snwprintf_s(buffer, _TRUNCATE, L"%i", work.bottom - work.top); _itow_s(work.bottom - work.top, buffer, 10);
_snwprintf_s(buffer2, _TRUNCATE, L"WORKAREAHEIGHT@%i", (int)i + 1); _snwprintf_s(buffer2, _TRUNCATE, L"WORKAREAHEIGHT@%i", (int)i + 1);
SetMonitorVariable(buffer2, buffer); SetMonitorVariable(buffer2, buffer);
@ -295,16 +295,16 @@ void CConfigParser::SetMultiMonitorVariables(bool reset)
{ {
const RECT screen = (monitors[i].active) ? monitors[i].screen : scrArea; const RECT screen = (monitors[i].active) ? monitors[i].screen : scrArea;
_snwprintf_s(buffer, _TRUNCATE, L"%i", screen.left); _itow_s(screen.left, buffer, 10);
_snwprintf_s(buffer2, _TRUNCATE, L"SCREENAREAX@%i", (int)i + 1); _snwprintf_s(buffer2, _TRUNCATE, L"SCREENAREAX@%i", (int)i + 1);
SetMonitorVariable(buffer2, buffer); SetMonitorVariable(buffer2, buffer);
_snwprintf_s(buffer, _TRUNCATE, L"%i", screen.top); _itow_s(screen.top, buffer, 10);
_snwprintf_s(buffer2, _TRUNCATE, L"SCREENAREAY@%i", (int)i + 1); _snwprintf_s(buffer2, _TRUNCATE, L"SCREENAREAY@%i", (int)i + 1);
SetMonitorVariable(buffer2, buffer); SetMonitorVariable(buffer2, buffer);
_snwprintf_s(buffer, _TRUNCATE, L"%i", screen.right - screen.left); _itow_s(screen.right - screen.left, buffer, 10);
_snwprintf_s(buffer2, _TRUNCATE, L"SCREENAREAWIDTH@%i", (int)i + 1); _snwprintf_s(buffer2, _TRUNCATE, L"SCREENAREAWIDTH@%i", (int)i + 1);
SetMonitorVariable(buffer2, buffer); SetMonitorVariable(buffer2, buffer);
_snwprintf_s(buffer, _TRUNCATE, L"%i", screen.bottom - screen.top); _itow_s(screen.bottom - screen.top, buffer, 10);
_snwprintf_s(buffer2, _TRUNCATE, L"SCREENAREAHEIGHT@%i", (int)i + 1); _snwprintf_s(buffer2, _TRUNCATE, L"SCREENAREAHEIGHT@%i", (int)i + 1);
SetMonitorVariable(buffer2, buffer); SetMonitorVariable(buffer2, buffer);
} }
@ -356,13 +356,13 @@ void CConfigParser::SetAutoSelectedMonitorVariables(CMeterWindow* meterWindow)
s2 = monitors[screenIndex-1].screen.right - monitors[screenIndex-1].screen.left; s2 = monitors[screenIndex-1].screen.right - monitors[screenIndex-1].screen.left;
} }
_snwprintf_s(buffer, _TRUNCATE, L"%i", w1); _itow_s(w1, buffer, 10);
SetBuiltInVariable(L"WORKAREAX", buffer); SetBuiltInVariable(L"WORKAREAX", buffer);
_snwprintf_s(buffer, _TRUNCATE, L"%i", w2); _itow_s(w2, buffer, 10);
SetBuiltInVariable(L"WORKAREAWIDTH", buffer); SetBuiltInVariable(L"WORKAREAWIDTH", buffer);
_snwprintf_s(buffer, _TRUNCATE, L"%i", s1); _itow_s(s1, buffer, 10);
SetBuiltInVariable(L"SCREENAREAX", buffer); SetBuiltInVariable(L"SCREENAREAX", buffer);
_snwprintf_s(buffer, _TRUNCATE, L"%i", s2); _itow_s(s2, buffer, 10);
SetBuiltInVariable(L"SCREENAREAWIDTH", buffer); SetBuiltInVariable(L"SCREENAREAWIDTH", buffer);
// Set Y / HEIGHT // Set Y / HEIGHT
@ -389,13 +389,13 @@ void CConfigParser::SetAutoSelectedMonitorVariables(CMeterWindow* meterWindow)
s2 = monitors[screenIndex-1].screen.bottom - monitors[screenIndex-1].screen.top; s2 = monitors[screenIndex-1].screen.bottom - monitors[screenIndex-1].screen.top;
} }
_snwprintf_s(buffer, _TRUNCATE, L"%i", w1); _itow_s(w1, buffer, 10);
SetBuiltInVariable(L"WORKAREAY", buffer); SetBuiltInVariable(L"WORKAREAY", buffer);
_snwprintf_s(buffer, _TRUNCATE, L"%i", w2); _itow_s(w2, buffer, 10);
SetBuiltInVariable(L"WORKAREAHEIGHT", buffer); SetBuiltInVariable(L"WORKAREAHEIGHT", buffer);
_snwprintf_s(buffer, _TRUNCATE, L"%i", s1); _itow_s(s1, buffer, 10);
SetBuiltInVariable(L"SCREENAREAY", buffer); SetBuiltInVariable(L"SCREENAREAY", buffer);
_snwprintf_s(buffer, _TRUNCATE, L"%i", s2); _itow_s(s2, buffer, 10);
SetBuiltInVariable(L"SCREENAREAHEIGHT", buffer); SetBuiltInVariable(L"SCREENAREAHEIGHT", buffer);
} }
else else
@ -405,13 +405,13 @@ void CConfigParser::SetAutoSelectedMonitorVariables(CMeterWindow* meterWindow)
// Set default WORKAREA // Set default WORKAREA
SystemParametersInfo(SPI_GETWORKAREA, 0, &r, 0); SystemParametersInfo(SPI_GETWORKAREA, 0, &r, 0);
_snwprintf_s(buffer, _TRUNCATE, L"%i", r.left); _itow_s(r.left, buffer, 10);
SetBuiltInVariable(L"WORKAREAX", buffer); SetBuiltInVariable(L"WORKAREAX", buffer);
_snwprintf_s(buffer, _TRUNCATE, L"%i", r.top); _itow_s(r.top, buffer, 10);
SetBuiltInVariable(L"WORKAREAY", buffer); SetBuiltInVariable(L"WORKAREAY", buffer);
_snwprintf_s(buffer, _TRUNCATE, L"%i", r.right - r.left); _itow_s(r.right - r.left, buffer, 10);
SetBuiltInVariable(L"WORKAREAWIDTH", buffer); SetBuiltInVariable(L"WORKAREAWIDTH", buffer);
_snwprintf_s(buffer, _TRUNCATE, L"%i", r.bottom - r.top); _itow_s(r.bottom - r.top, buffer, 10);
SetBuiltInVariable(L"WORKAREAHEIGHT", buffer); SetBuiltInVariable(L"WORKAREAHEIGHT", buffer);
// Set default SCREENAREA // Set default SCREENAREA
@ -420,13 +420,13 @@ void CConfigParser::SetAutoSelectedMonitorVariables(CMeterWindow* meterWindow)
r.right = GetSystemMetrics(SM_CXSCREEN); r.right = GetSystemMetrics(SM_CXSCREEN);
r.bottom = GetSystemMetrics(SM_CYSCREEN); r.bottom = GetSystemMetrics(SM_CYSCREEN);
_snwprintf_s(buffer, _TRUNCATE, L"%i", r.left); _itow_s(r.left, buffer, 10);
SetBuiltInVariable(L"SCREENAREAX", buffer); SetBuiltInVariable(L"SCREENAREAX", buffer);
_snwprintf_s(buffer, _TRUNCATE, L"%i", r.top); _itow_s(r.top, buffer, 10);
SetBuiltInVariable(L"SCREENAREAY", buffer); SetBuiltInVariable(L"SCREENAREAY", buffer);
_snwprintf_s(buffer, _TRUNCATE, L"%i", r.right - r.left); _itow_s(r.right - r.left, buffer, 10);
SetBuiltInVariable(L"SCREENAREAWIDTH", buffer); SetBuiltInVariable(L"SCREENAREAWIDTH", buffer);
_snwprintf_s(buffer, _TRUNCATE, L"%i", r.bottom - r.top); _itow_s(r.bottom - r.top, buffer, 10);
SetBuiltInVariable(L"SCREENAREAHEIGHT", buffer); SetBuiltInVariable(L"SCREENAREAHEIGHT", buffer);
} }
} }

View File

@ -512,12 +512,12 @@ void CDialogManage::CTabSkins::SetControls()
item = GetDlgItem(m_Window, IDC_MANAGESKINS_X_TEXT); item = GetDlgItem(m_Window, IDC_MANAGESKINS_X_TEXT);
EnableWindow(item, TRUE); EnableWindow(item, TRUE);
_itow(m_SkinWindow->GetX(), buffer, 10); _itow_s(m_SkinWindow->GetX(), buffer, 10);
SetWindowText(item, buffer); SetWindowText(item, buffer);
item = GetDlgItem(m_Window, IDC_MANAGESKINS_Y_TEXT); item = GetDlgItem(m_Window, IDC_MANAGESKINS_Y_TEXT);
EnableWindow(item, TRUE); EnableWindow(item, TRUE);
_itow(m_SkinWindow->GetY(), buffer, 10); _itow_s(m_SkinWindow->GetY(), buffer, 10);
SetWindowText(item, buffer); SetWindowText(item, buffer);
item = GetDlgItem(m_Window, IDC_MANAGESKINS_DISPLAYMONITOR_BUTTON); item = GetDlgItem(m_Window, IDC_MANAGESKINS_DISPLAYMONITOR_BUTTON);
@ -564,7 +564,7 @@ void CDialogManage::CTabSkins::SetControls()
item = GetDlgItem(m_Window, IDC_MANAGESKINS_LOADORDER_TEXT); item = GetDlgItem(m_Window, IDC_MANAGESKINS_LOADORDER_TEXT);
EnableWindow(item, TRUE); EnableWindow(item, TRUE);
_itow(Rainmeter->GetLoadOrder(m_SkinName), buffer, 10); _itow_s(Rainmeter->GetLoadOrder(m_SkinName), buffer, 10);
SetWindowText(item, buffer); SetWindowText(item, buffer);
item = GetDlgItem(m_Window, IDC_MANAGESKINS_ONHOVER_COMBOBOX); item = GetDlgItem(m_Window, IDC_MANAGESKINS_ONHOVER_COMBOBOX);
@ -975,7 +975,7 @@ INT_PTR CDialogManage::CTabSkins::OnCommand(WPARAM wParam, LPARAM lParam)
if (x > m_SkinWindow->GetX()) if (x > m_SkinWindow->GetX())
{ {
_itow(m_SkinWindow->GetX(), buffer, 10); _itow_s(m_SkinWindow->GetX(), buffer, 10);
Edit_SetText((HWND)lParam, buffer); Edit_SetText((HWND)lParam, buffer);
} }
} }
@ -991,7 +991,7 @@ INT_PTR CDialogManage::CTabSkins::OnCommand(WPARAM wParam, LPARAM lParam)
if (y > m_SkinWindow->GetY()) if (y > m_SkinWindow->GetY())
{ {
_itow(m_SkinWindow->GetY(), buffer, 10); _itow_s(m_SkinWindow->GetY(), buffer, 10);
Edit_SetText((HWND)lParam, buffer); Edit_SetText((HWND)lParam, buffer);
} }
} }
@ -1023,7 +1023,7 @@ INT_PTR CDialogManage::CTabSkins::OnCommand(WPARAM wParam, LPARAM lParam)
m_IgnoreUpdate = true; m_IgnoreUpdate = true;
int value = _wtoi(buffer); int value = _wtoi(buffer);
_itow(value, buffer, 10); _itow_s(value, buffer, 10);
SetWindowText((HWND)lParam, buffer); SetWindowText((HWND)lParam, buffer);
// Reset selection // Reset selection

View File

@ -71,7 +71,7 @@ extern CRainmeter* Rainmeter;
** The constructor ** The constructor
** **
*/ */
CMeasure::CMeasure(CMeterWindow* meterWindow, const WCHAR* name) : m_MeterWindow(meterWindow), m_Name(name), m_ANSIName(ConvertToAscii(name)), CMeasure::CMeasure(CMeterWindow* meterWindow, const WCHAR* name) : m_MeterWindow(meterWindow), m_Name(name), m_AsciiName(ConvertToAscii(name)),
m_DynamicVariables(false), m_DynamicVariables(false),
m_Invert(false), m_Invert(false),
m_LogMaxValue(false), m_LogMaxValue(false),
@ -650,7 +650,7 @@ const WCHAR* CMeasure::GetStringValue(AUTOSCALE autoScale, double scale, int dec
if (decimals == 0) if (decimals == 0)
{ {
_snwprintf_s(buffer, _TRUNCATE, L"%i", (int)val); _itow_s((int)val, buffer, 10);
} }
else else
{ {

View File

@ -56,7 +56,7 @@ public:
virtual const WCHAR* GetStats(); virtual const WCHAR* GetStats();
const WCHAR* GetName() { return m_Name.c_str(); } const WCHAR* GetName() { return m_Name.c_str(); }
const char* GetANSIName() { return m_ANSIName.c_str(); } const char* GetAsciiName() { return m_AsciiName.c_str(); }
void Disable() { m_Disabled = true; } void Disable() { m_Disabled = true; }
void Enable() { m_Disabled = false; } void Enable() { m_Disabled = false; }
@ -101,7 +101,7 @@ protected:
double m_MaxValue; // The maximum value (so far) double m_MaxValue; // The maximum value (so far)
double m_Value; // The current value double m_Value; // The current value
const std::wstring m_Name; // Name of this Measure const std::wstring m_Name; // Name of this Measure
const std::string m_ANSIName; // Name of this Measure in ANSI const std::string m_AsciiName; // Name of this Measure in ANSI
std::vector< std::pair<std::wstring, std::wstring> > m_Substitute; // Vec of substitute strings std::vector< std::pair<std::wstring, std::wstring> > m_Substitute; // Vec of substitute strings
bool m_RegExpSubstitute; bool m_RegExpSubstitute;

View File

@ -110,7 +110,7 @@ void CMeasureCalc::UpdateVariableMap(CMeterWindow& meterWindow)
std::list<CMeasure*>::const_iterator iter = measures.begin(); std::list<CMeasure*>::const_iterator iter = measures.begin();
for ( ; iter != measures.end(); ++iter) for ( ; iter != measures.end(); ++iter)
{ {
const char* name = (*iter)->GetANSIName(); const char* name = (*iter)->GetAsciiName();
double val = (*iter)->GetValue(); double val = (*iter)->GetValue();
StrMap_AddString(c_VarMap, name, &val); StrMap_AddString(c_VarMap, name, &val);
@ -182,7 +182,7 @@ void CMeasureCalc::FormulaReplace()
int randNumber = m_LowBound + (int)(range * rand()/(RAND_MAX + 1.0)); int randNumber = m_LowBound + (int)(range * rand()/(RAND_MAX + 1.0));
WCHAR buffer[32]; WCHAR buffer[32];
_snwprintf_s(buffer, _TRUNCATE, L"%i", randNumber); _itow_s(randNumber, buffer, 10);
m_Formula.replace(loc, 6, buffer); m_Formula.replace(loc, 6, buffer);
loc += wcslen(buffer); loc += wcslen(buffer);

View File

@ -645,7 +645,7 @@ void CMeasureNet::WriteStats(const WCHAR* iniFile, const WCHAR* statsDate)
AppendStatsValue(data, L"Since", statsDate); AppendStatsValue(data, L"Since", statsDate);
// Add stats count // Add stats count
_snwprintf_s(buffer, _TRUNCATE, L"%i", (int)statsSize); _itow_s((int)statsSize, buffer, 10);
AppendStatsValue(data, L"NetStatsCount", buffer); AppendStatsValue(data, L"NetStatsCount", buffer);
// Add stats // Add stats

View File

@ -1798,7 +1798,7 @@ void CMeterWindow::ScreenToWindow()
} }
else else
{ {
_snwprintf_s(buffer, _TRUNCATE, L"%i", pixel); _itow_s(pixel, buffer, 10);
} }
if (m_WindowXFromRight == true) if (m_WindowXFromRight == true)
{ {
@ -1839,7 +1839,7 @@ void CMeterWindow::ScreenToWindow()
} }
else else
{ {
_snwprintf_s(buffer, _TRUNCATE, L"%i", pixel); _itow_s(pixel, buffer, 10);
} }
if (m_WindowYFromBottom == true) if (m_WindowYFromBottom == true)
{ {
@ -1901,7 +1901,7 @@ void CMeterWindow::ReadConfig()
{ {
value = 0.0; value = 0.0;
} }
_snwprintf_s(buffer, _TRUNCATE, L"%i", (int)value); _itow_s((int)value, buffer, 10);
m_WindowX = buffer; m_WindowX = buffer;
} }
if (!m_WindowY.empty() && m_WindowY[0] == L'(' && m_WindowY[m_WindowY.size() - 1] == L')') if (!m_WindowY.empty() && m_WindowY[0] == L'(' && m_WindowY[m_WindowY.size() - 1] == L')')
@ -1910,7 +1910,7 @@ void CMeterWindow::ReadConfig()
{ {
value = 0.0; value = 0.0;
} }
_snwprintf_s(buffer, _TRUNCATE, L"%i", (int)value); _itow_s((int)value, buffer, 10);
m_WindowY = buffer; m_WindowY = buffer;
} }
@ -1978,13 +1978,13 @@ void CMeterWindow::WriteConfig(INT setting)
if (setting & SETTING_ALPHAVALUE) if (setting & SETTING_ALPHAVALUE)
{ {
_snwprintf_s(buffer, _TRUNCATE, L"%i", m_AlphaValue); _itow_s(m_AlphaValue, buffer, 10);
WritePrivateProfileString(section, L"AlphaValue", buffer, iniFile); WritePrivateProfileString(section, L"AlphaValue", buffer, iniFile);
} }
if (setting & SETTING_FADEDURATION) if (setting & SETTING_FADEDURATION)
{ {
_snwprintf_s(buffer, _TRUNCATE, L"%i", m_FadeDuration); _itow_s(m_FadeDuration, buffer, 10);
WritePrivateProfileString(section, L"FadeDuration", buffer, iniFile); WritePrivateProfileString(section, L"FadeDuration", buffer, iniFile);
} }
@ -2000,7 +2000,7 @@ void CMeterWindow::WriteConfig(INT setting)
if (setting & SETTING_HIDEONMOUSEOVER) if (setting & SETTING_HIDEONMOUSEOVER)
{ {
_snwprintf_s(buffer, _TRUNCATE, L"%i", m_WindowHide); _itow_s(m_WindowHide, buffer, 10);
WritePrivateProfileString(section, L"HideOnMouseOver", buffer, iniFile); WritePrivateProfileString(section, L"HideOnMouseOver", buffer, iniFile);
} }
@ -2026,7 +2026,7 @@ void CMeterWindow::WriteConfig(INT setting)
if (setting & SETTING_ALWAYSONTOP) if (setting & SETTING_ALWAYSONTOP)
{ {
_snwprintf_s(buffer, _TRUNCATE, L"%i", m_WindowZPosition); _itow_s(m_WindowZPosition, buffer, 10);
WritePrivateProfileString(section, L"AlwaysOnTop", buffer, iniFile); WritePrivateProfileString(section, L"AlwaysOnTop", buffer, iniFile);
} }
} }
@ -5033,9 +5033,9 @@ void CMeterWindow::SetWindowPositionVariables(int x, int y)
{ {
WCHAR buffer[32]; WCHAR buffer[32];
_snwprintf_s(buffer, _TRUNCATE, L"%i", x); _itow_s(x, buffer, 10);
m_Parser.SetBuiltInVariable(L"CURRENTCONFIGX", buffer); m_Parser.SetBuiltInVariable(L"CURRENTCONFIGX", buffer);
_snwprintf_s(buffer, _TRUNCATE, L"%i", y); _itow_s(y, buffer, 10);
m_Parser.SetBuiltInVariable(L"CURRENTCONFIGY", buffer); m_Parser.SetBuiltInVariable(L"CURRENTCONFIGY", buffer);
} }
@ -5049,9 +5049,9 @@ void CMeterWindow::SetWindowSizeVariables(int w, int h)
{ {
WCHAR buffer[32]; WCHAR buffer[32];
_snwprintf_s(buffer, _TRUNCATE, L"%i", w); _itow_s(w, buffer, 10);
m_Parser.SetBuiltInVariable(L"CURRENTCONFIGWIDTH", buffer); m_Parser.SetBuiltInVariable(L"CURRENTCONFIGWIDTH", buffer);
_snwprintf_s(buffer, _TRUNCATE, L"%i", h); _itow_s(h, buffer, 10);
m_Parser.SetBuiltInVariable(L"CURRENTCONFIGHEIGHT", buffer); m_Parser.SetBuiltInVariable(L"CURRENTCONFIGHEIGHT", buffer);
} }

View File

@ -617,7 +617,7 @@ void CRainmeter::RainmeterWriteKeyValue(const WCHAR* arg)
{ {
const std::wstring& iniFile = subStrings[3]; const std::wstring& iniFile = subStrings[3];
if (iniFile.find(L"..\\") != std::string::npos || iniFile.find(L"../") != std::string::npos) if (iniFile.find(L"..\\") != std::wstring::npos || iniFile.find(L"../") != std::wstring::npos)
{ {
LogWithArgs(LOG_ERROR, L"!WriteKeyValue: Illegal path: %s", iniFile.c_str()); LogWithArgs(LOG_ERROR, L"!WriteKeyValue: Illegal path: %s", iniFile.c_str());
return; return;
@ -1080,8 +1080,7 @@ int CRainmeter::Initialize(HWND hParent, HINSTANCE hInstance, LPCWSTR szPath)
// Tray must exist before configs are read // Tray must exist before configs are read
m_TrayWindow = new CTrayWindow(m_Instance); m_TrayWindow = new CTrayWindow(m_Instance);
ScanForConfigs(m_SkinPath); ReloadSettings();
ScanForThemes(GetSettingsPath() + L"Themes");
if (m_ConfigStrings.empty()) if (m_ConfigStrings.empty())
{ {
@ -1089,15 +1088,8 @@ int CRainmeter::Initialize(HWND hParent, HINSTANCE hInstance, LPCWSTR szPath)
MessageBox(NULL, error.c_str(), APPNAME, MB_OK | MB_TOPMOST | MB_ICONERROR); MessageBox(NULL, error.c_str(), APPNAME, MB_OK | MB_TOPMOST | MB_ICONERROR);
} }
ReadGeneralSettings(m_IniFile);
WritePrivateProfileString(L"Rainmeter", L"CheckUpdate", NULL , m_IniFile.c_str()); WritePrivateProfileString(L"Rainmeter", L"CheckUpdate", NULL , m_IniFile.c_str());
if (!m_DisableVersionCheck)
{
CheckUpdate();
}
ResetStats(); ResetStats();
ReadStats(); ReadStats();
@ -1110,7 +1102,12 @@ int CRainmeter::Initialize(HWND hParent, HINSTANCE hInstance, LPCWSTR szPath)
// Create meter windows for active configs // Create meter windows for active configs
ActivateActiveConfigs(); ActivateActiveConfigs();
return result; // Alles OK if (!m_DisableVersionCheck)
{
CheckUpdate();
}
return result; // All is OK
} }
/* /*
@ -1256,7 +1253,7 @@ void CRainmeter::ToggleConfig(int configIndex, int iniIndex)
void CRainmeter::WriteActive(const std::wstring& config, int iniIndex) void CRainmeter::WriteActive(const std::wstring& config, int iniIndex)
{ {
WCHAR buffer[32]; WCHAR buffer[32];
_snwprintf_s(buffer, _TRUNCATE, L"%i", iniIndex + 1); _itow_s(iniIndex + 1, buffer, 10);
WritePrivateProfileString(config.c_str(), L"Active", buffer, m_IniFile.c_str()); WritePrivateProfileString(config.c_str(), L"Active", buffer, m_IniFile.c_str());
} }