Unignore and fix warnings in Library/

This commit is contained in:
Birunthan Mohanathas 2013-12-23 19:42:31 +00:00
parent b25a7849d6
commit a577608835
16 changed files with 34 additions and 29 deletions

View File

@ -53,8 +53,12 @@
<ItemDefinitionGroup>
<ClCompile>
<!-- Ignore C4351 to get rid of "new behavior: elements of array 'array' will be default initialized" -->
<!-- Ignore C4530 to get rid of "C++ exception handler used, but unwind semantics are not enabled" -->
<DisableSpecificWarnings>4351;4530</DisableSpecificWarnings>
<!-- Set the version macros to 0x0601 (Win7) to avoid using Win8 specific features in the Win8 SDK. -->
<PreprocessorDefinitions>WIN32;_WINDOWS;WINVER=0x0601;_WIN32_WINNT=0x0601;_WIN32_IE=0x0601;PSAPI_VERSION=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>WIN32;_WINDOWS;WINVER=0x0601;_WIN32_WINNT=0x0601;_WIN32_IE=0x0601;PSAPI_VERSION=1;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<WarningLevel>Level3</WarningLevel>
</ClCompile>
<Link>

View File

@ -874,7 +874,7 @@ void DialogAbout::TabSkins::UpdateMeasureList(MeterWindow* meterWindow)
}
std::wstring tmpStr = (*iter).first;
wcslwr(&tmpStr[0]);
_wcslwr(&tmpStr[0]);
lvi.pszText = (WCHAR*)tmpStr.c_str();
if (lvi.iItem < count)

View File

@ -1582,7 +1582,7 @@ void DialogManage::TabLayouts::Initialize()
{
HWND item = GetControl(Id_List);
const std::vector<std::wstring>& layouts = GetRainmeter().GetAllLayouts();
for (int i = 0, isize = layouts.size(); i < isize; ++i)
for (size_t i = 0, isize = layouts.size(); i < isize; ++i)
{
ListBox_AddString(item, layouts[i].c_str());
}

View File

@ -34,7 +34,7 @@ LPCWSTR __stdcall RmReadString(void* rm, LPCWSTR option, LPCWSTR defValue, BOOL
MeasurePlugin* measure = (MeasurePlugin*)rm;
ConfigParser& parser = measure->GetMeterWindow()->GetParser();
return parser.ReadString(measure->GetName(), option, defValue, (bool)replaceMeasures).c_str();
return parser.ReadString(measure->GetName(), option, defValue, replaceMeasures != FALSE).c_str();
}
double __stdcall RmReadFormula(void* rm, LPCWSTR option, double defValue)

View File

@ -64,7 +64,7 @@ void IfActions::ReadConditionOptions(ConfigParser& parser, const WCHAR* section)
std::wstring fAction = parser.ReadString(section, L"IfFalseAction", L"", false);
if (!tAction.empty() || !fAction.empty())
{
int i = 1;
size_t i = 1;
do
{
if (m_Conditions.size() > (i - 1))

View File

@ -19,7 +19,6 @@
<ClCompile>
<AdditionalIncludeDirectories>lua/include;lua/lua;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>_USRDLL;HAVE_CONFIG_H;SUPPORT_UTF8;LIBRARY_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<DisableSpecificWarnings>4018;4090;4114;4267;4334;4351;4786;4800;4996</DisableSpecificWarnings>
</ClCompile>
<Link>
<AdditionalDependencies>comctl32.lib;Wininet.lib;UxTheme.lib;Winmm.lib;gdiplus.lib;Iphlpapi.lib;shlwapi.lib;d2d1.lib;dwrite.lib;windowscodecs.lib;Version.lib;%(AdditionalDependencies)</AdditionalDependencies>

View File

@ -276,11 +276,11 @@ const WCHAR* Measure::CheckSubstitute(const WCHAR* buffer)
re,
nullptr, // No extra data - we didn't study the pattern
utf8str.c_str(), // The subject string
utf8str.length(), // The length of the subject
(int)utf8str.length(), // The length of the subject
offset,
0,
ovector,
_countof(ovector));
(int)_countof(ovector));
if (rc <= 0)
{
break;
@ -311,10 +311,10 @@ const WCHAR* Measure::CheckSubstitute(const WCHAR* buffer)
}
}
const size_t start = ovector[0];
const size_t length = ovector[1] - ovector[0];
const int start = ovector[0];
const int length = ovector[1] - ovector[0];
utf8str.replace(start, length, result);
offset = start + result.length();
offset = start + (int)result.length();
}
while (true);

View File

@ -229,7 +229,7 @@ void MeasureCalc::UpdateUniqueNumberList()
const size_t range = (m_HighBound - m_LowBound) + 1;
m_UniqueNumbers.resize(range);
for (size_t i = 0; i < range; ++i)
for (int i = 0; i < (int)range; ++i)
{
m_UniqueNumbers[i] = m_LowBound + i;
}

View File

@ -642,7 +642,7 @@ void MeasureNet::WriteStats(const WCHAR* iniFile, const std::wstring& statsDate)
WCHAR buffer[48];
int len;
uint32_t count = c_StatValues.size() / 2;
uint32_t count = (uint32_t)c_StatValues.size() / 2;
// Reserve sufficient buffer for statistics
std::wstring data;

View File

@ -531,7 +531,7 @@ bool Meter::ReplaceMeasures(std::wstring& str, AUTOSCALE autoScale, double scale
const WCHAR* measureValue = m_Measures[i - 1]->GetStringOrFormattedValue(
autoScale, scale, decimals, percentual);
int measureValueLen = wcslen(measureValue);
const size_t measureValueLen = wcslen(measureValue);
do
{

View File

@ -153,8 +153,8 @@ void MeterString::Initialize()
m_TextFormat->SetProperties(
m_FontFace.c_str(),
m_FontSize,
m_Style & BOLD,
m_Style & ITALIC,
(m_Style & BOLD) != 0,
(m_Style & ITALIC) != 0,
m_MeterWindow->GetFontCollection());
}

View File

@ -871,28 +871,28 @@ void MeterWindow::DoBang(Bang bang, const std::vector<std::wstring>& args)
case Bang::ClickThrough:
{
int f = m_Parser.ParseInt(args[0].c_str(), 0);
SetClickThrough((f == -1) ? !m_ClickThrough : f);
SetClickThrough((f == -1) ? !m_ClickThrough : f != 0);
}
break;
case Bang::Draggable:
{
int f = m_Parser.ParseInt(args[0].c_str(), 0);
SetWindowDraggable((f == -1) ? !m_WindowDraggable : f);
SetWindowDraggable((f == -1) ? !m_WindowDraggable : f != 0);
}
break;
case Bang::SnapEdges:
{
int f = m_Parser.ParseInt(args[0].c_str(), 0);
SetSnapEdges((f == -1) ? !m_SnapEdges : f);
SetSnapEdges((f == -1) ? !m_SnapEdges : f != 0);
}
break;
case Bang::KeepOnScreen:
{
int f = m_Parser.ParseInt(args[0].c_str(), 0);
SetKeepOnScreen((f == -1) ? !m_KeepOnScreen : f);
SetKeepOnScreen((f == -1) ? !m_KeepOnScreen : f != 0);
}
break;
@ -1526,7 +1526,8 @@ void MeterWindow::SetOption(const std::wstring& section, const std::wstring& opt
}
// ContextTitle and ContextAction in [Rainmeter] are dynamic
if ((_wcsicmp(section.c_str(), L"Rainmeter") == 0) && (wcsnicmp(option.c_str(), L"Context", 7) == 0))
if (_wcsicmp(section.c_str(), L"Rainmeter") == 0 &&
_wcsnicmp(option.c_str(), L"Context", 7) == 0)
{
if (value.empty())
{

View File

@ -471,7 +471,7 @@ bool Rainmeter::IsAlreadyRunning()
MD5_CTX ctx = {0};
MD5Init(&ctx);
MD5Update(&ctx, (LPBYTE)&data[0], data.length() * sizeof(WCHAR));
MD5Update(&ctx, (LPBYTE)&data[0], (UINT)data.length() * sizeof(WCHAR));
MD5Final(&ctx);
FreeLibrary(cryptDll);
@ -584,7 +584,7 @@ LRESULT CALLBACK Rainmeter::MainWndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPA
void Rainmeter::SetNetworkStatisticsTimer()
{
static bool set = SetTimer(m_Window, TIMER_NETSTATS, INTERVAL_NETSTATS, nullptr);
static bool set = SetTimer(m_Window, TIMER_NETSTATS, INTERVAL_NETSTATS, nullptr) != 0;
}
void Rainmeter::CreateOptionsFile()
@ -1307,9 +1307,10 @@ void Rainmeter::ReadGeneralSettings(const std::wstring& iniFile)
m_DesktopWorkAreaChanged = true;
}
for (UINT i = 1, isize = System::GetMonitorCount(); i <= isize; ++i)
const size_t monitorCount = System::GetMonitorCount();
for (UINT i = 1; i <= monitorCount; ++i)
{
_snwprintf_s(buffer, _TRUNCATE, L"DesktopWorkArea@%i", i);
_snwprintf_s(buffer, _TRUNCATE, L"DesktopWorkArea@%i", (int)i);
const std::wstring& area = parser.ReadString(L"Rainmeter", buffer, L"");
if (!area.empty())
{

View File

@ -129,7 +129,7 @@ bool TrayWindow::IsTrayIconReady()
tnid.hWnd = m_Window;
tnid.uID = IDI_TRAY;
return Shell_NotifyIcon(NIM_MODIFY, &tnid);
return Shell_NotifyIcon(NIM_MODIFY, &tnid) != FALSE;
}
void TrayWindow::TryAddTrayIcon()

View File

@ -125,7 +125,7 @@ static int GetStringValue(lua_State* L)
AUTOSCALE autoScale = (top > 1) ? (AUTOSCALE)(int)lua_tonumber(L, 2) : AUTOSCALE_OFF;
double scale = (top > 2) ? lua_tonumber(L, 3) : 1.0;
int decimals = (int)lua_tonumber(L, 4);
bool percentual = lua_toboolean(L, 5);
bool percentual = lua_toboolean(L, 5) != 0;
const WCHAR* val = self->GetStringOrFormattedValue(autoScale, scale, decimals, percentual);
LuaManager::PushWide(val);

View File

@ -68,7 +68,7 @@ static int GetH(lua_State* L)
static int GetX(lua_State* L)
{
DECLARE_SELF(L)
bool abs = (bool)lua_toboolean(L, 2);
const bool abs = lua_toboolean(L, 2) != 0;
lua_pushnumber(L, self->GetX(abs));
return 1;
@ -77,7 +77,7 @@ static int GetX(lua_State* L)
static int GetY(lua_State* L)
{
DECLARE_SELF(L)
bool abs = (bool)lua_toboolean(L, 2);
const bool abs = lua_toboolean(L, 2) != 0;
lua_pushnumber(L, self->GetY(abs));
return 1;