mirror of
https://github.com/chibicitiberiu/rainmeter-studio.git
synced 2024-02-24 04:33:31 +00:00
Shrunk some string buffer size.
This commit is contained in:
parent
27b07f653c
commit
2cb88b0733
@ -309,7 +309,7 @@ void UpdateWidgets()
|
||||
|
||||
if ((*iter).version != 0)
|
||||
{
|
||||
WCHAR buffer[256];
|
||||
WCHAR buffer[64];
|
||||
swprintf(buffer, L"%i.%i", (*iter).version / 1000, (*iter).version % 1000);
|
||||
ListView_SetItemText(widget, i, 1, buffer);
|
||||
}
|
||||
|
@ -697,7 +697,7 @@ std::vector<Gdiplus::REAL> CConfigParser::ReadFloats(LPCTSTR section, LPCTSTR ke
|
||||
|
||||
int CConfigParser::ReadInt(LPCTSTR section, LPCTSTR key, int defValue)
|
||||
{
|
||||
TCHAR buffer[256];
|
||||
TCHAR buffer[32];
|
||||
swprintf(buffer, L"%i", defValue);
|
||||
|
||||
const std::wstring& result = ReadString(section, key, buffer);
|
||||
@ -752,7 +752,7 @@ int CConfigParser::ReadFormula(const std::wstring& result, double* resultValue)
|
||||
|
||||
Color CConfigParser::ReadColor(LPCTSTR section, LPCTSTR key, const Color& defValue)
|
||||
{
|
||||
TCHAR buffer[256];
|
||||
TCHAR buffer[128];
|
||||
swprintf(buffer, L"%i, %i, %i, %i", defValue.GetR(), defValue.GetG(), defValue.GetB(), defValue.GetA());
|
||||
|
||||
const std::wstring& result = ReadString(section, key, buffer);
|
||||
|
@ -520,7 +520,7 @@ BOOL LSLog(int nLevel, LPCTSTR pszModule, LPCTSTR pszMessage)
|
||||
{
|
||||
startTime = time;
|
||||
}
|
||||
WCHAR buffer[MAX_PATH];
|
||||
WCHAR buffer[128];
|
||||
swprintf(buffer, L"(%02i:%02i:%02i.%03i) ", (time - startTime) / (1000 * 60* 60), ((time - startTime) / (1000 * 60)) % 60, ((time - startTime) / 1000) % 60, (time - startTime) % 1000);
|
||||
|
||||
std::wstring message(buffer);
|
||||
|
@ -506,8 +506,7 @@ double CMeasure::GetValueRange()
|
||||
const WCHAR* CMeasure::GetStringValue(bool autoScale, double scale, int decimals, bool percentual)
|
||||
{
|
||||
static WCHAR buffer[MAX_LINE_LENGTH];
|
||||
static WCHAR buffer2[MAX_LINE_LENGTH];
|
||||
double theValue = GetValue();
|
||||
WCHAR format[32];
|
||||
|
||||
if(percentual)
|
||||
{
|
||||
@ -515,20 +514,20 @@ const WCHAR* CMeasure::GetStringValue(bool autoScale, double scale, int decimals
|
||||
}
|
||||
else if(autoScale)
|
||||
{
|
||||
GetScaledValue(decimals, theValue, buffer);
|
||||
GetScaledValue(decimals, GetValue(), buffer);
|
||||
}
|
||||
else
|
||||
{
|
||||
if(decimals == 0)
|
||||
{
|
||||
double val = theValue * (1.0 / scale);
|
||||
val = (val + ( (val >= 0) ? 0.5 : -0.5 ) );
|
||||
double val = GetValue() * (1.0 / scale);
|
||||
val += (val >= 0) ? 0.5 : -0.5;
|
||||
swprintf(buffer, L"%lli", (LONGLONG)val);
|
||||
}
|
||||
else
|
||||
{
|
||||
swprintf(buffer2, L"%%.%if", decimals);
|
||||
swprintf(buffer, buffer2, theValue * (1.0 / scale));
|
||||
swprintf(format, L"%%.%if", decimals);
|
||||
swprintf(buffer, format, GetValue() * (1.0 / scale));
|
||||
}
|
||||
}
|
||||
|
||||
@ -537,7 +536,7 @@ const WCHAR* CMeasure::GetStringValue(bool autoScale, double scale, int decimals
|
||||
|
||||
void CMeasure::GetScaledValue(int decimals, double theValue, WCHAR* buffer)
|
||||
{
|
||||
WCHAR format[16];
|
||||
WCHAR format[32];
|
||||
double value = 0;
|
||||
|
||||
if(decimals == 0)
|
||||
|
@ -586,7 +586,7 @@ void CMeasureNet::ResetStats()
|
||||
*/
|
||||
void CMeasureNet::ReadStats(const std::wstring& iniFile)
|
||||
{
|
||||
WCHAR buffer[256];
|
||||
WCHAR buffer[64];
|
||||
int count = GetPrivateProfileInt(L"Statistics", L"NetStatsCount", 0, iniFile.c_str());
|
||||
|
||||
c_StatValues.clear();
|
||||
@ -621,8 +621,8 @@ void CMeasureNet::ReadStats(const std::wstring& iniFile)
|
||||
*/
|
||||
void CMeasureNet::WriteStats(const std::wstring& iniFile)
|
||||
{
|
||||
WCHAR buffer[256];
|
||||
WCHAR buffer2[256];
|
||||
WCHAR buffer[32];
|
||||
WCHAR buffer2[64];
|
||||
|
||||
wsprintf(buffer, L"%i", c_StatValues.size() / 2);
|
||||
WritePrivateProfileString(L"Statistics", L"NetStatsCount", buffer, iniFile.c_str());
|
||||
|
@ -541,7 +541,7 @@ std::wstring CMeter::ReplaceMeasures(std::wstring source)
|
||||
return source;
|
||||
}
|
||||
|
||||
WCHAR buffer[256];
|
||||
WCHAR buffer[64];
|
||||
// Create the actual text (i.e. replace %1, %2, .. with the measure texts)
|
||||
|
||||
for (size_t i = 0; i < stringValues.size(); ++i)
|
||||
|
@ -92,7 +92,7 @@ void CMeterLine::Initialize()
|
||||
*/
|
||||
void CMeterLine::ReadConfig(const WCHAR* section)
|
||||
{
|
||||
WCHAR tmpName[256];
|
||||
WCHAR tmpName[64];
|
||||
|
||||
// Store the current number of lines so we know if the buffer needs to be updated
|
||||
int oldLineCount = (int)m_Colors.size();
|
||||
|
@ -215,7 +215,7 @@ void CMeterString::Initialize()
|
||||
*/
|
||||
void CMeterString::ReadConfig(const WCHAR* section)
|
||||
{
|
||||
WCHAR tmpName[256];
|
||||
WCHAR tmpName[64];
|
||||
|
||||
// Store the current font values so we know if the font needs to be updated
|
||||
std::wstring oldFontFace = m_FontFace;
|
||||
@ -418,7 +418,7 @@ bool CMeterString::Update()
|
||||
}
|
||||
else
|
||||
{
|
||||
WCHAR buffer[256];
|
||||
WCHAR buffer[64];
|
||||
// Create the actual text (i.e. replace %1, %2, .. with the measure texts)
|
||||
std::wstring tmpText = m_Text;
|
||||
|
||||
|
@ -1606,14 +1606,14 @@ void CMeterWindow::ReadConfig()
|
||||
if (!m_WindowX.empty() && m_WindowX[0] == L'(' && m_WindowX[m_WindowX.size() - 1] == L')')
|
||||
{
|
||||
double value = parser.ReadFormula(section, L"WindowX", 0.0);
|
||||
WCHAR buffer[256];
|
||||
WCHAR buffer[32];
|
||||
swprintf(buffer, L"%i", (int)value);
|
||||
m_WindowX = buffer;
|
||||
}
|
||||
if (!m_WindowY.empty() && m_WindowY[0] == L'(' && m_WindowY[m_WindowY.size() - 1] == L')')
|
||||
{
|
||||
double value = parser.ReadFormula(section, L"WindowY", 0.0);
|
||||
WCHAR buffer[256];
|
||||
WCHAR buffer[32];
|
||||
swprintf(buffer, L"%i", (int)value);
|
||||
m_WindowY = buffer;
|
||||
}
|
||||
@ -1682,7 +1682,7 @@ void CMeterWindow::ReadConfig()
|
||||
*/
|
||||
void CMeterWindow::WriteConfig()
|
||||
{
|
||||
WCHAR buffer[256];
|
||||
WCHAR buffer[32];
|
||||
std::wstring iniFile = m_Rainmeter->GetIniFile();
|
||||
const WCHAR* section = m_SkinName.c_str();
|
||||
|
||||
@ -1757,7 +1757,7 @@ bool CMeterWindow::ReadSkin()
|
||||
int appVersion = m_Parser.ReadInt(L"Rainmeter", L"AppVersion", 0);
|
||||
if (appVersion > RAINMETER_VERSION)
|
||||
{
|
||||
WCHAR buffer[256];
|
||||
WCHAR buffer[128];
|
||||
std::wstring text;
|
||||
if (appVersion % 1000 != 0)
|
||||
{
|
||||
@ -1864,7 +1864,7 @@ bool CMeterWindow::ReadSkin()
|
||||
}
|
||||
// Here we are checking to see if there are more than one local font
|
||||
// to be loaded. They will be named LocalFont2, LocalFont 3, etc.
|
||||
WCHAR tmpName[256];
|
||||
WCHAR tmpName[64];
|
||||
int i = 2;
|
||||
bool loop = true;
|
||||
do
|
||||
|
@ -1643,8 +1643,8 @@ void CRainmeter::CheckSkinVersions()
|
||||
// DebugLog(L"New: %s", strVersionNew.c_str());
|
||||
|
||||
// Compare with the version entry in the Rainmeter.ini
|
||||
WCHAR tmpSz[MAX_LINE_LENGTH] = {0};
|
||||
GetPrivateProfileString(menu[i].name.c_str(), L"Version", L"", tmpSz, MAX_LINE_LENGTH, m_IniFile.c_str());
|
||||
WCHAR tmpSz[256] = {0};
|
||||
GetPrivateProfileString(menu[i].name.c_str(), L"Version", L"", tmpSz, 256, m_IniFile.c_str());
|
||||
strVersionInIni = tmpSz;
|
||||
|
||||
// DebugLog(L"In Ini: %s", strVersionInIni.c_str());
|
||||
@ -2827,7 +2827,7 @@ void CRainmeter::ReadGeneralSettings(std::wstring& iniFile)
|
||||
|
||||
for (UINT i = 1; i <= CSystem::GetMonitorCount(); ++i)
|
||||
{
|
||||
WCHAR buffer[256];
|
||||
WCHAR buffer[64];
|
||||
wsprintf(buffer, L"DesktopWorkArea@%i", i);
|
||||
area = parser.ReadString(L"Rainmeter", buffer, L"");
|
||||
if (!area.empty())
|
||||
@ -3103,7 +3103,7 @@ void CRainmeter::UpdateDesktopWorkArea(bool reset)
|
||||
std::wstring format = L"Applying DesktopWorkArea";
|
||||
if (i != 0)
|
||||
{
|
||||
WCHAR buffer[256];
|
||||
WCHAR buffer[64];
|
||||
wsprintf(buffer, L"@%i", i);
|
||||
format += buffer;
|
||||
}
|
||||
@ -3604,7 +3604,7 @@ void CRainmeter::CreateMonitorMenu(HMENU monitorMenu, CMeterWindow* meterWindow)
|
||||
|
||||
for (size_t i = 0; i < monitors.size(); ++i)
|
||||
{
|
||||
WCHAR buffer[256];
|
||||
WCHAR buffer[64];
|
||||
wsprintf(buffer, L"@%i: ", i + 1);
|
||||
std::wstring item = buffer;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user