diff --git a/CppRuleSet.ruleset b/CppRuleSet.ruleset index 0249aee228d5..1a59aeeeb320 100644 --- a/CppRuleSet.ruleset +++ b/CppRuleSet.ruleset @@ -64,7 +64,7 @@ - + diff --git a/src/ActionRunner/actionRunner.cpp b/src/ActionRunner/actionRunner.cpp index 829078d53735..421ee45da129 100644 --- a/src/ActionRunner/actionRunner.cpp +++ b/src/ActionRunner/actionRunner.cpp @@ -79,7 +79,7 @@ int WINAPI WinMain(HINSTANCE, HINSTANCE, LPSTR, int) hMapFile = OpenFileMappingW(FILE_MAP_WRITE, FALSE, pidFile.data()); if (hMapFile) { - pidBuffer = reinterpret_cast(MapViewOfFile(hMapFile, FILE_MAP_ALL_ACCESS, 0, 0, sizeof(DWORD))); + pidBuffer = static_cast(MapViewOfFile(hMapFile, FILE_MAP_ALL_ACCESS, 0, 0, sizeof(DWORD))); if (pidBuffer) { *pidBuffer = 0; diff --git a/src/common/utils/exec.h b/src/common/utils/exec.h index d8267304d7d7..feeda08b89db 100644 --- a/src/common/utils/exec.h +++ b/src/common/utils/exec.h @@ -2,7 +2,12 @@ #define WIN32_LEAN_AND_MEAN #include + +// disable warning 26471 - Don't use reinterpret_cast. A cast from void* can use static_cast +#pragma warning(push) +#pragma warning(disable: 26471) #include +#pragma warning(pop) #include #include diff --git a/src/modules/alwaysontop/AlwaysOnTop/AlwaysOnTop.h b/src/modules/alwaysontop/AlwaysOnTop/AlwaysOnTop.h index 6f4b09c002fc..dc41a12d67ea 100644 --- a/src/modules/alwaysontop/AlwaysOnTop/AlwaysOnTop.h +++ b/src/modules/alwaysontop/AlwaysOnTop/AlwaysOnTop.h @@ -24,7 +24,7 @@ class AlwaysOnTop : public SettingsObserver if (!thisRef && (message == WM_CREATE)) { const auto createStruct = reinterpret_cast(lparam); - thisRef = reinterpret_cast(createStruct->lpCreateParams); + thisRef = static_cast(createStruct->lpCreateParams); SetWindowLongPtr(window, GWLP_USERDATA, reinterpret_cast(thisRef)); } diff --git a/src/modules/alwaysontop/AlwaysOnTop/WindowBorder.h b/src/modules/alwaysontop/AlwaysOnTop/WindowBorder.h index 50c4d15ee1e7..5f2145423ffa 100644 --- a/src/modules/alwaysontop/AlwaysOnTop/WindowBorder.h +++ b/src/modules/alwaysontop/AlwaysOnTop/WindowBorder.h @@ -23,7 +23,7 @@ class WindowBorder : public SettingsObserver if ((thisRef == nullptr) && (message == WM_CREATE)) { auto createStruct = reinterpret_cast(lparam); - thisRef = reinterpret_cast(createStruct->lpCreateParams); + thisRef = static_cast(createStruct->lpCreateParams); SetWindowLongPtr(window, GWLP_USERDATA, reinterpret_cast(thisRef)); } diff --git a/src/modules/fancyzones/FancyZonesLib/FancyZones.cpp b/src/modules/fancyzones/FancyZonesLib/FancyZones.cpp index 7487acd49da0..599f96b34240 100644 --- a/src/modules/fancyzones/FancyZonesLib/FancyZones.cpp +++ b/src/modules/fancyzones/FancyZonesLib/FancyZones.cpp @@ -748,7 +748,7 @@ LRESULT CALLBACK FancyZones::s_WndProc(HWND window, UINT message, WPARAM wparam, if (!thisRef && (message == WM_CREATE)) { const auto createStruct = reinterpret_cast(lparam); - thisRef = reinterpret_cast(createStruct->lpCreateParams); + thisRef = static_cast(createStruct->lpCreateParams); SetWindowLongPtr(window, GWLP_USERDATA, reinterpret_cast(thisRef)); } diff --git a/src/modules/fancyzones/FancyZonesLib/WorkArea.cpp b/src/modules/fancyzones/FancyZonesLib/WorkArea.cpp index a35ad9a3b479..6b83fee0e57f 100644 --- a/src/modules/fancyzones/FancyZonesLib/WorkArea.cpp +++ b/src/modules/fancyzones/FancyZonesLib/WorkArea.cpp @@ -680,7 +680,7 @@ LRESULT CALLBACK WorkArea::s_WndProc(HWND window, UINT message, WPARAM wparam, L if ((thisRef == nullptr) && (message == WM_CREATE)) { auto createStruct = reinterpret_cast(lparam); - thisRef = reinterpret_cast(createStruct->lpCreateParams); + thisRef = static_cast(createStruct->lpCreateParams); SetWindowLongPtr(window, GWLP_USERDATA, reinterpret_cast(thisRef)); } diff --git a/src/modules/fancyzones/FancyZonesTests/UnitTests/Util.cpp b/src/modules/fancyzones/FancyZonesTests/UnitTests/Util.cpp index 2c7a006c2db8..f85597c0c63d 100644 --- a/src/modules/fancyzones/FancyZonesTests/UnitTests/Util.cpp +++ b/src/modules/fancyzones/FancyZonesTests/UnitTests/Util.cpp @@ -79,7 +79,7 @@ BOOL RegisterDLLWindowClass(LPCWSTR szClassName, Mocks::HwndCreator* creator) DWORD WINAPI ThreadProc(LPVOID lpParam) { MSG messages; - Mocks::HwndCreator* creator = reinterpret_cast(lpParam); + Mocks::HwndCreator* creator = static_cast(lpParam); if (!creator) return static_cast(-1); diff --git a/src/modules/powerrename/lib/PowerRenameManager.cpp b/src/modules/powerrename/lib/PowerRenameManager.cpp index 5e89677be336..f32ee46f7cae 100644 --- a/src/modules/powerrename/lib/PowerRenameManager.cpp +++ b/src/modules/powerrename/lib/PowerRenameManager.cpp @@ -727,7 +727,7 @@ DWORD WINAPI CPowerRenameManager::s_fileOpWorkerThread(_In_ void* pv) { if (SUCCEEDED(CoInitializeEx(nullptr, COINIT_APARTMENTTHREADED | COINIT_DISABLE_OLE1DDE))) { - WorkerThreadData* pwtd = reinterpret_cast(pv); + WorkerThreadData* pwtd = static_cast(pv); if (pwtd) { bool closeUIWindowAfterRenaming = true; @@ -914,7 +914,7 @@ DWORD WINAPI CPowerRenameManager::s_regexWorkerThread(_In_ void* pv) try { winrt::check_hresult(CoInitializeEx(nullptr, COINIT_APARTMENTTHREADED | COINIT_DISABLE_OLE1DDE)); - WorkerThreadData* pwtd = reinterpret_cast(pv); + WorkerThreadData* pwtd = static_cast(pv); if (pwtd) { PostMessage(pwtd->hwndManager, SRM_REGEX_STARTED, GetCurrentThreadId(), 0); diff --git a/tools/WebcamReportTool/DirectShowUtils.h b/tools/WebcamReportTool/DirectShowUtils.h index c230422238c5..71a091648d3b 100644 --- a/tools/WebcamReportTool/DirectShowUtils.h +++ b/tools/WebcamReportTool/DirectShowUtils.h @@ -5,7 +5,12 @@ #include #include +// disable warning 26471 - Don't use reinterpret_cast. A cast from void* can use static_cast +#pragma warning(push) +#pragma warning(disable: 26471) #include +#pragma warning(push) + #include #include diff --git a/tools/WebcamReportTool/main.cpp b/tools/WebcamReportTool/main.cpp index 89ff3e8cdaef..3a7501ce239e 100644 --- a/tools/WebcamReportTool/main.cpp +++ b/tools/WebcamReportTool/main.cpp @@ -5,7 +5,12 @@ #include #include +// disable warning 26471 - Don't use reinterpret_cast. A cast from void* can use static_cast +#pragma warning(push) +#pragma warning(disable: 26471) #include +#pragma warning(push) + #include #include