mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-04 18:26:39 +02:00
[Analyzers][CPP] turn on Warning 4100 (#21449)
* Analyzers CPP Changing the warning level from 3 to 4. change some project files to make them use the warning config in cpp props file. * Analyzers C++ turn on warning 4706 Change Cpp.Build.props file to enable 4706 fix BugReportTool code to get rid of 4706 * Turn on warning 4100 and fix the code * Follow c++ core guidelines * Adapting to PR comments
This commit is contained in:
@@ -138,7 +138,7 @@ namespace FancyZonesDataTypes
|
||||
GUID virtualDesktopId{};
|
||||
|
||||
std::wstring toString() const noexcept;
|
||||
};
|
||||
};
|
||||
|
||||
struct AppZoneHistoryData
|
||||
{
|
||||
@@ -194,7 +194,7 @@ namespace FancyZonesDataTypes
|
||||
{
|
||||
return lhs.monitor == rhs.monitor;
|
||||
}
|
||||
|
||||
|
||||
if (!lhs.serialNumber.empty() && !rhs.serialNumber.empty())
|
||||
{
|
||||
bool serialNumbersEqual = lhs.serialNumber == rhs.serialNumber;
|
||||
@@ -232,7 +232,7 @@ namespace FancyZonesDataTypes
|
||||
lhs.virtualDesktopId.Data2 < rhs.virtualDesktopId.Data2 ||
|
||||
lhs.virtualDesktopId.Data3 < rhs.virtualDesktopId.Data3;
|
||||
}
|
||||
|
||||
|
||||
if (!lhs.monitorId.serialNumber.empty() || rhs.monitorId.serialNumber.empty())
|
||||
{
|
||||
return lhs.monitorId.serialNumber < rhs.monitorId.serialNumber;
|
||||
@@ -247,7 +247,7 @@ namespace std
|
||||
template<>
|
||||
struct hash<FancyZonesDataTypes::WorkAreaId>
|
||||
{
|
||||
size_t operator()(const FancyZonesDataTypes::WorkAreaId& Value) const
|
||||
size_t operator()(const FancyZonesDataTypes::WorkAreaId& /*Value*/) const
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -110,7 +110,7 @@ namespace std
|
||||
template<>
|
||||
struct hash<BackwardsCompatibility::DeviceIdData>
|
||||
{
|
||||
size_t operator()(const BackwardsCompatibility::DeviceIdData& Value) const
|
||||
size_t operator()(const BackwardsCompatibility::DeviceIdData& /*Value*/) const
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@ public:
|
||||
FancyZonesSettings::instance().RemoveObserver(*this);
|
||||
}
|
||||
|
||||
virtual void SettingsUpdate(SettingId type) {}
|
||||
virtual void SettingsUpdate(SettingId /*type*/) {}
|
||||
|
||||
bool WantsToBeNotified(SettingId type) const noexcept
|
||||
{
|
||||
|
||||
@@ -59,7 +59,7 @@ WindowMoveHandler::WindowMoveHandler(const std::function<void()>& keyUpdateCallb
|
||||
{
|
||||
}
|
||||
|
||||
void WindowMoveHandler::MoveSizeStart(HWND window, HMONITOR monitor, POINT const& ptScreen, const std::unordered_map<HMONITOR, std::shared_ptr<WorkArea>>& workAreaMap) noexcept
|
||||
void WindowMoveHandler::MoveSizeStart(HWND window, HMONITOR monitor, POINT const& /*ptScreen*/, const std::unordered_map<HMONITOR, std::shared_ptr<WorkArea>>& workAreaMap) noexcept
|
||||
{
|
||||
if (!FancyZonesWindowProcessing::IsProcessable(window))
|
||||
{
|
||||
@@ -272,7 +272,7 @@ void WindowMoveHandler::MoveSizeEnd(HWND window, const std::unordered_map<HMONIT
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
FancyZonesWindowProperties::RemoveZoneIndexProperty(window);
|
||||
}
|
||||
|
||||
@@ -373,7 +373,7 @@ void WindowMoveHandler::SetWindowTransparency(HWND window) noexcept
|
||||
if (FancyZonesSettings::settings().makeDraggedWindowTransparent)
|
||||
{
|
||||
m_windowTransparencyProperties.draggedWindowExstyle = GetWindowLong(window, GWL_EXSTYLE);
|
||||
|
||||
|
||||
SetWindowLong(window,
|
||||
GWL_EXSTYLE,
|
||||
m_windowTransparencyProperties.draggedWindowExstyle | WS_EX_LAYERED);
|
||||
@@ -401,7 +401,7 @@ void WindowMoveHandler::ResetWindowTransparency() noexcept
|
||||
{
|
||||
Logger::error(L"Window transparency: SetLayeredWindowAttributes failed");
|
||||
}
|
||||
|
||||
|
||||
if (SetWindowLong(m_windowTransparencyProperties.draggedWindow, GWL_EXSTYLE, m_windowTransparencyProperties.draggedWindowExstyle) == 0)
|
||||
{
|
||||
Logger::error(L"Window transparency: SetWindowLong failed, {}", get_last_error_or_default(GetLastError()));
|
||||
|
||||
@@ -37,8 +37,8 @@ enum DWM_WINDOW_CORNER_PREFERENCE
|
||||
};
|
||||
|
||||
namespace
|
||||
{
|
||||
BOOL CALLBACK saveDisplayToVector(HMONITOR monitor, HDC hdc, LPRECT rect, LPARAM data)
|
||||
{
|
||||
BOOL CALLBACK saveDisplayToVector(HMONITOR monitor, HDC /*hdc*/, LPRECT /*rect*/, LPARAM data)
|
||||
{
|
||||
reinterpret_cast<std::vector<HMONITOR>*>(data)->emplace_back(monitor);
|
||||
return true;
|
||||
@@ -121,7 +121,6 @@ namespace
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool FancyZonesWindowUtils::IsSplashScreen(HWND window)
|
||||
{
|
||||
wchar_t className[MAX_PATH];
|
||||
@@ -200,9 +199,7 @@ bool FancyZonesWindowUtils::IsPopupWindow(HWND window) noexcept
|
||||
bool FancyZonesWindowUtils::HasThickFrameAndMinimizeMaximizeButtons(HWND window) noexcept
|
||||
{
|
||||
auto style = GetWindowLong(window, GWL_STYLE);
|
||||
return ((style & WS_THICKFRAME) == WS_THICKFRAME
|
||||
&& (style & WS_MINIMIZEBOX) == WS_MINIMIZEBOX
|
||||
&& (style & WS_MAXIMIZEBOX) == WS_MAXIMIZEBOX);
|
||||
return ((style & WS_THICKFRAME) == WS_THICKFRAME && (style & WS_MINIMIZEBOX) == WS_MINIMIZEBOX && (style & WS_MAXIMIZEBOX) == WS_MAXIMIZEBOX);
|
||||
}
|
||||
|
||||
bool FancyZonesWindowUtils::IsCandidateForZoning(HWND window)
|
||||
@@ -212,7 +209,7 @@ bool FancyZonesWindowUtils::IsCandidateForZoning(HWND window)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
// popup could be the window we don't want to snap: start menu, notification popup, tray window, etc.
|
||||
// also, popup could be the windows we want to snap disregarding the "allowSnapPopupWindows" setting, e.g. Telegram
|
||||
bool isPopup = IsPopupWindow(window);
|
||||
@@ -220,8 +217,8 @@ bool FancyZonesWindowUtils::IsCandidateForZoning(HWND window)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// allow child windows
|
||||
|
||||
// allow child windows
|
||||
auto hasOwner = HasVisibleOwner(window);
|
||||
if (hasOwner && !FancyZonesSettings::settings().allowSnapChildWindows)
|
||||
{
|
||||
@@ -283,7 +280,7 @@ bool FancyZonesWindowUtils::IsExcludedByDefault(const std::wstring& processPath)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
static std::vector<std::wstring> defaultExcludedApps = { NonLocalizable::PowerToysAppFZEditor, NonLocalizable::CoreWindow, NonLocalizable::SearchUI };
|
||||
return (find_app_name_in_path(processPath, defaultExcludedApps));
|
||||
}
|
||||
@@ -346,7 +343,7 @@ void FancyZonesWindowUtils::SizeWindowToRect(HWND window, RECT rect) noexcept
|
||||
{
|
||||
Logger::error(L"SetWindowPlacement failed, {}", get_last_error_or_default(GetLastError()));
|
||||
}
|
||||
|
||||
|
||||
// Do it again, allowing Windows to resize the window and set correct scaling
|
||||
// This fixes Issue #365
|
||||
result = ::SetWindowPlacement(window, &placement);
|
||||
|
||||
@@ -14,7 +14,7 @@ public:
|
||||
~WorkArea();
|
||||
|
||||
public:
|
||||
inline bool Init(HINSTANCE hinstance, const FancyZonesDataTypes::WorkAreaId& parentUniqueId)
|
||||
inline bool Init([[maybe_unused]] HINSTANCE hinstance, const FancyZonesDataTypes::WorkAreaId& parentUniqueId)
|
||||
{
|
||||
#ifndef UNIT_TESTS
|
||||
if (!InitWindow(hinstance))
|
||||
@@ -22,7 +22,6 @@ public:
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
||||
InitLayout(parentUniqueId);
|
||||
return true;
|
||||
}
|
||||
@@ -60,7 +59,7 @@ public:
|
||||
const std::unique_ptr<LayoutAssignedWindows>& GetLayoutWindows() const noexcept { return m_layoutWindows; }
|
||||
|
||||
ZoneIndexSet GetWindowZoneIndexes(HWND window) const noexcept;
|
||||
|
||||
|
||||
HRESULT MoveSizeEnter(HWND window) noexcept;
|
||||
HRESULT MoveSizeUpdate(POINT const& ptScreen, bool dragEnabled, bool selectManyZones) noexcept;
|
||||
HRESULT MoveSizeEnd(HWND window) noexcept;
|
||||
@@ -70,7 +69,7 @@ public:
|
||||
bool MoveWindowIntoZoneByDirectionAndPosition(HWND window, DWORD vkCode, bool cycle) noexcept;
|
||||
bool ExtendWindowByDirectionAndPosition(HWND window, DWORD vkCode) noexcept;
|
||||
void SaveWindowProcessToZoneIndex(HWND window) noexcept;
|
||||
|
||||
|
||||
void UpdateActiveZoneSet() noexcept;
|
||||
|
||||
void ShowZonesOverlay() noexcept;
|
||||
@@ -115,7 +114,7 @@ inline std::shared_ptr<WorkArea> MakeWorkArea(HINSTANCE hinstance, HMONITOR moni
|
||||
self->LogInitializationError();
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
||||
if (!self->Init(hinstance, parentUniqueId))
|
||||
{
|
||||
return nullptr;
|
||||
@@ -123,4 +122,3 @@ inline std::shared_ptr<WorkArea> MakeWorkArea(HINSTANCE hinstance, HMONITOR moni
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
|
||||
@@ -43,7 +43,7 @@ namespace FancyZonesUtils
|
||||
quad->rgbBlue = GetBValue(color) * alpha / 255;
|
||||
}
|
||||
|
||||
inline void FillRectARGB(wil::unique_hdc& hdc, RECT const* prcFill, BYTE alpha, COLORREF color, bool blendAlpha)
|
||||
inline void FillRectARGB(wil::unique_hdc& hdc, RECT const* prcFill, BYTE alpha, COLORREF color, bool /*blendAlpha*/)
|
||||
{
|
||||
BITMAPINFO bi;
|
||||
ZeroMemory(&bi, sizeof(bi));
|
||||
@@ -104,7 +104,7 @@ namespace FancyZonesUtils
|
||||
using result_t = std::vector<std::pair<HMONITOR, RECT>>;
|
||||
result_t result;
|
||||
|
||||
auto enumMonitors = [](HMONITOR monitor, HDC hdc, LPRECT pRect, LPARAM param) -> BOOL {
|
||||
auto enumMonitors = [](HMONITOR monitor, HDC /*hdc*/, LPRECT /*pRect*/, LPARAM param) -> BOOL {
|
||||
MONITORINFOEX mi;
|
||||
mi.cbSize = sizeof(mi);
|
||||
result_t& result = *reinterpret_cast<result_t*>(param);
|
||||
@@ -126,7 +126,7 @@ namespace FancyZonesUtils
|
||||
using result_t = std::vector<std::pair<HMONITOR, MONITORINFOEX>>;
|
||||
result_t result;
|
||||
|
||||
auto enumMonitors = [](HMONITOR monitor, HDC hdc, LPRECT pRect, LPARAM param) -> BOOL {
|
||||
auto enumMonitors = [](HMONITOR monitor, HDC /*hdc*/, LPRECT /*pRect*/, LPARAM param) -> BOOL {
|
||||
MONITORINFOEX mi;
|
||||
mi.cbSize = sizeof(mi);
|
||||
result_t& result = *reinterpret_cast<result_t*>(param);
|
||||
@@ -176,5 +176,5 @@ namespace FancyZonesUtils
|
||||
std::optional<std::wstring> GuidToString(const GUID& guid) noexcept;
|
||||
|
||||
RECT PrepareRectForCycling(RECT windowRect, RECT workAreaRect, DWORD vkCode) noexcept;
|
||||
size_t ChooseNextZoneByPosition(DWORD vkCode, RECT windowRect, const std::vector<RECT>& zoneRects) noexcept;
|
||||
size_t ChooseNextZoneByPosition(DWORD vkCode, RECT windowRect, const std::vector<RECT>& zoneRects) noexcept;
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
// Non-localizable
|
||||
const std::wstring fancyZonesPath = L"modules\\FancyZones\\PowerToys.FancyZones.exe";
|
||||
|
||||
BOOL APIENTRY DllMain(HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserved)
|
||||
BOOL APIENTRY DllMain(HMODULE /*hModule*/, DWORD ul_reason_for_call, LPVOID /*lpReserved*/)
|
||||
{
|
||||
switch (ul_reason_for_call)
|
||||
{
|
||||
@@ -59,20 +59,20 @@ public:
|
||||
|
||||
// Return JSON with the configuration options.
|
||||
// These are the settings shown on the settings page along with their current values.
|
||||
virtual bool get_config(_Out_ PWSTR buffer, _Out_ int* buffer_size) override
|
||||
virtual bool get_config(_Out_ PWSTR /*buffer*/, _Out_ int* /*buffer_size*/) override
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// Passes JSON with the configuration settings for the powertoy.
|
||||
// This is called when the user hits Save on the settings page.
|
||||
virtual void set_config(PCWSTR config) override
|
||||
virtual void set_config(PCWSTR /*config*/) override
|
||||
{
|
||||
}
|
||||
|
||||
// Signal from the Settings editor to call a custom action.
|
||||
// This can be used to spawn more complex editors.
|
||||
virtual void call_custom_action(const wchar_t* action) override
|
||||
virtual void call_custom_action(const wchar_t* /*action*/) override
|
||||
{
|
||||
SetEvent(m_toggleEditorEvent);
|
||||
}
|
||||
@@ -124,7 +124,7 @@ public:
|
||||
{
|
||||
app_name = GET_RESOURCE_STRING(IDS_FANCYZONES);
|
||||
app_key = NonLocalizable::ModuleKey;
|
||||
|
||||
|
||||
m_toggleEditorEvent = CreateDefaultEvent(CommonSharedConstants::FANCY_ZONES_EDITOR_TOGGLE_EVENT);
|
||||
if (!m_toggleEditorEvent)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user