mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-04 18:26:39 +02:00
[CodeQuality]Fix C++ static analyzer findings (#29745)
* [PVS] Fix static analyzer findings * f: fix error handling * f: more improvements * Update src/modules/FileLocksmith/FileLocksmithLibInterop/NtdllExtensions.cpp
This commit is contained in:
@@ -238,7 +238,7 @@ void FancyZonesSettings::LoadSettings()
|
||||
if (auto val = values.get_int_value(NonLocalizable::OverlappingZonesAlgorithmID))
|
||||
{
|
||||
// Avoid undefined behavior
|
||||
if (*val >= 0 || *val < static_cast<int>(OverlappingZonesAlgorithm::EnumElements))
|
||||
if (*val >= 0 && *val < static_cast<int>(OverlappingZonesAlgorithm::EnumElements))
|
||||
{
|
||||
auto algorithm = (OverlappingZonesAlgorithm)*val;
|
||||
if (m_settings.overlappingZonesAlgorithm != algorithm)
|
||||
|
||||
@@ -306,26 +306,23 @@ void FancyZonesWindowUtils::SizeWindowToRect(HWND window, RECT rect) noexcept
|
||||
::GetWindowPlacement(window, &placement);
|
||||
}
|
||||
|
||||
if (!IsWindowVisible(window))
|
||||
{
|
||||
placement.showCmd = SW_HIDE;
|
||||
}
|
||||
else
|
||||
if (IsWindowVisible(window))
|
||||
{
|
||||
// Do not restore minimized windows. We change their placement though so they restore to the correct zone.
|
||||
if ((placement.showCmd != SW_SHOWMINIMIZED) &&
|
||||
(placement.showCmd != SW_MINIMIZE))
|
||||
{
|
||||
placement.showCmd = SW_RESTORE;
|
||||
}
|
||||
// Remove maximized show command to make sure window is moved to the correct zone.
|
||||
if (placement.showCmd == SW_SHOWMAXIMIZED)
|
||||
placement.flags &= ~WPF_RESTORETOMAXIMIZED;
|
||||
|
||||
// Remove maximized show command to make sure window is moved to the correct zone.
|
||||
if (placement.showCmd == SW_SHOWMAXIMIZED)
|
||||
{
|
||||
placement.showCmd = SW_RESTORE;
|
||||
placement.flags &= ~WPF_RESTORETOMAXIMIZED;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
placement.showCmd = SW_HIDE;
|
||||
}
|
||||
|
||||
ScreenToWorkAreaCoords(window, rect);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user