mirror of
https://github.com/microsoft/PowerToys
synced 2024-11-22 08:11:25 +00:00
[CPP][Analyzers] turn on warning 4189 (#21522)
* Turn on 4189 and fix code * changes from PR comments
This commit is contained in:
parent
0a19f0dfc7
commit
f408c34aca
@ -42,7 +42,7 @@
|
||||
<ClCompile>
|
||||
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
|
||||
<WarningLevel>Level4</WarningLevel>
|
||||
<DisableSpecificWarnings>26800;28251;4189;4239;4244;4245;4389;4456;4457;4701;6387;4458;4505;4515;4459;4702;6031;6248;26451;28182;%(DisableSpecificWarnings)</DisableSpecificWarnings>
|
||||
<DisableSpecificWarnings>26800;28251;4239;4244;4245;4389;4456;4457;4701;6387;4458;4505;4515;4459;4702;6031;6248;26451;28182;%(DisableSpecificWarnings)</DisableSpecificWarnings>
|
||||
<DisableAnalyzeExternal >true</DisableAnalyzeExternal>
|
||||
<ExternalWarningLevel>TurnOffAllWarnings</ExternalWarningLevel>
|
||||
<ConformanceMode>false</ConformanceMode>
|
||||
|
@ -30,8 +30,6 @@ KeyboardHook::~KeyboardHook()
|
||||
void KeyboardHook::Start()
|
||||
{
|
||||
hookProc = gcnew HookProcDelegate(this, &KeyboardHook::HookProc);
|
||||
Process ^ curProcess = Process::GetCurrentProcess();
|
||||
ProcessModule ^ curModule = curProcess->MainModule;
|
||||
#if defined(DISABLE_LOWLEVEL_HOOKS_WHEN_DEBUGGED)
|
||||
const bool hookDisabled = IsDebuggerPresent();
|
||||
#else
|
||||
|
@ -425,7 +425,7 @@ void TwoWayPipeMessageIPC::TwoWayPipeMessageIPCImpl::start_named_pipe_server(HAN
|
||||
|
||||
if (token != NULL)
|
||||
{
|
||||
int err = change_pipe_security_allow_restricted_token(connect_pipe_handle, token);
|
||||
change_pipe_security_allow_restricted_token(connect_pipe_handle, token);
|
||||
}
|
||||
current_connect_pipe_handle = connect_pipe_handle;
|
||||
}
|
||||
|
@ -20,7 +20,7 @@ namespace notifications
|
||||
}
|
||||
const auto now = timeutil::now();
|
||||
const size_t buf_size = sizeof(now);
|
||||
if (RegSetValueExW(key, nullptr, 0, REG_QWORD, reinterpret_cast<const BYTE*>(&now), sizeof(now)) != ERROR_SUCCESS)
|
||||
if (RegSetValueExW(key, nullptr, 0, REG_QWORD, reinterpret_cast<const BYTE*>(&now), buf_size) != ERROR_SUCCESS)
|
||||
{
|
||||
RegCloseKey(key);
|
||||
return false;
|
||||
|
@ -405,7 +405,7 @@ void notifications::update_toast_progress_bar(std::wstring_view tag, progress_ba
|
||||
map.Insert(L"progressTitle", params.progress_title);
|
||||
|
||||
NotificationData data(map);
|
||||
NotificationUpdateResult res = notifier.Update(data, tag, DEFAULT_TOAST_GROUP);
|
||||
notifier.Update(data, tag, DEFAULT_TOAST_GROUP);
|
||||
}
|
||||
|
||||
void notifications::remove_toasts_by_tag(std::wstring_view tag)
|
||||
|
@ -57,7 +57,7 @@ namespace updating
|
||||
const bool architecture_matched = filename_lower.find(required_architecture) != std::wstring::npos;
|
||||
const bool filename_matched = filename_lower.find(required_filename_pattern) != std::wstring::npos;
|
||||
const bool asset_matched = extension_matched && architecture_matched && filename_matched;
|
||||
if (extension_matched && architecture_matched && filename_matched)
|
||||
if (asset_matched)
|
||||
{
|
||||
return std::make_pair(Uri{ asset.GetNamedString(L"browser_download_url") }, std::move(filename_lower));
|
||||
}
|
||||
|
@ -617,7 +617,7 @@ void D2DOverlayWindow::render(ID2D1DeviceContext5* d2d_dc)
|
||||
}
|
||||
|
||||
d2d_dc->Clear();
|
||||
int x_offset = 0, y_offset = 0, dimension = 0;
|
||||
int x_offset = 0, y_offset = 0;
|
||||
auto current_anim_value = (float)animation.value(Animation::AnimFunctions::LINEAR);
|
||||
SetLayeredWindowAttributes(hwnd, 0, (int)(255 * current_anim_value), LWA_ALPHA);
|
||||
double pos_anim_value = 1 - animation.value(Animation::AnimFunctions::EASE_OUT_EXPO);
|
||||
|
@ -254,7 +254,6 @@ bool FancyZonesWindowUtils::IsProcessOfWindowElevated(HWND window)
|
||||
pid) };
|
||||
|
||||
wil::unique_handle token;
|
||||
bool elevated = false;
|
||||
|
||||
if (OpenProcessToken(hProcess.get(), TOKEN_QUERY, &token))
|
||||
{
|
||||
|
@ -335,7 +335,6 @@ namespace FancyZonesUnitTests
|
||||
.monitorId = { .deviceId = { .id = L"DELA026", .instanceId = L"5&10a58c63&0&UID16777488" } },
|
||||
.virtualDesktopId = FancyZonesUtils::GuidFromString(L"{39B25DD2-130D-4B5D-8851-4791D66B1539}").value()
|
||||
};
|
||||
const auto window = Mocks::WindowCreate(m_hInst);
|
||||
|
||||
Assert::IsFalse(AppZoneHistory::instance().RemoveAppLastZone(nullptr, workAreaId, zoneSetId));
|
||||
}
|
||||
|
@ -18,7 +18,7 @@ namespace KeyboardEventHandlers
|
||||
// Use the suppress flag to ensure these are not intercepted by any remapped keys or shortcuts
|
||||
Helpers::SetKeyEvent(keyEventList, 0, INPUT_KEYBOARD, VK_NUMLOCK, KEYEVENTF_KEYUP, KeyboardManagerConstants::KEYBOARDMANAGER_SUPPRESS_FLAG);
|
||||
Helpers::SetKeyEvent(keyEventList, 1, INPUT_KEYBOARD, VK_NUMLOCK, 0, KeyboardManagerConstants::KEYBOARDMANAGER_SUPPRESS_FLAG);
|
||||
UINT res = ii.SendVirtualInput((UINT)key_count, keyEventList, sizeof(INPUT));
|
||||
ii.SendVirtualInput((UINT)key_count, keyEventList, sizeof(INPUT));
|
||||
delete[] keyEventList;
|
||||
}
|
||||
}
|
||||
|
@ -78,7 +78,6 @@ namespace PowerRenameManagerTests
|
||||
}
|
||||
|
||||
// TODO: Setup match and replace parameters
|
||||
wchar_t newReplaceTerm[MAX_PATH] = { 0 };
|
||||
CComPtr<IPowerRenameRegEx> renRegEx;
|
||||
Assert::IsTrue(mgr->GetRenameRegEx(&renRegEx) == S_OK);
|
||||
renRegEx->PutFlags(flags);
|
||||
@ -301,7 +300,6 @@ namespace PowerRenameManagerTests
|
||||
RenameHelper(renamePairs, ARRAYSIZE(renamePairs), L"foo", L"bar", SYSTEMTIME{ 2020, 7, 3, 22, 15, 6, 42, 453 }, DEFAULT_FLAGS | Lowercase | ExtensionOnly);
|
||||
}
|
||||
|
||||
|
||||
TEST_METHOD (VerifyFileAttributesNoPadding)
|
||||
{
|
||||
rename_pairs renamePairs[] = {
|
||||
|
@ -460,7 +460,6 @@ int WINAPI WinMain(HINSTANCE /*hInstance*/, HINSTANCE /*hPrevInstance*/, LPSTR l
|
||||
|
||||
// Apply the general settings but don't save it as the modules() variable has not been loaded yet
|
||||
apply_general_settings(general_settings, false);
|
||||
int rvalue = 0;
|
||||
const bool elevated = is_process_elevated();
|
||||
const bool with_dont_elevate_arg = cmdLine.find("--dont-elevate") != std::string::npos;
|
||||
const bool run_elevated_setting = general_settings.GetNamedBoolean(L"run_elevated", false);
|
||||
|
@ -62,7 +62,6 @@ optional<path> GetRootPath()
|
||||
|
||||
wstring GetChecksum(path filePath)
|
||||
{
|
||||
DWORD dwStatus = 0;
|
||||
BOOL bResult = FALSE;
|
||||
HCRYPTPROV hProv = 0;
|
||||
HCRYPTHASH hHash = 0;
|
||||
|
@ -57,7 +57,7 @@ namespace
|
||||
vector<pair<wstring, wstring>> QueryValues(HKEY key)
|
||||
{
|
||||
DWORD cValues;
|
||||
DWORD retCode = RegQueryInfoKeyW(key, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, &cValues, nullptr, nullptr, nullptr, nullptr);
|
||||
RegQueryInfoKeyW(key, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, &cValues, nullptr, nullptr, nullptr, nullptr);
|
||||
TCHAR achValue[255];
|
||||
DWORD cchValue = 255;
|
||||
LPBYTE value;
|
||||
@ -282,7 +282,7 @@ void ReportRegistry(const filesystem::path& tmpDir)
|
||||
{
|
||||
DWORD data = 0;
|
||||
DWORD dataSize = sizeof(data);
|
||||
LONG retCode = RegGetValueW(rootKey, subKey.c_str(), value.c_str(), flags, &type, &data, &dataSize);
|
||||
result = RegGetValueW(rootKey, subKey.c_str(), value.c_str(), flags, &type, &data, &dataSize);
|
||||
if (result == ERROR_SUCCESS)
|
||||
{
|
||||
registryReport << "\t" << value << " > " << data << "\n";
|
||||
|
Loading…
Reference in New Issue
Block a user