From af4b8986887c42cf5f15c1184d50a1f07da77ade Mon Sep 17 00:00:00 2001 From: Simon Rozman Date: Fri, 14 Jun 2019 13:08:03 +0200 Subject: [PATCH] Enable code analysis and resolve reported warnings Signed-off-by: Simon Rozman --- WLANSetEAPUserData/WLANSetEAPUserData.cpp | 9 ++++----- WLANSetEAPUserData/WLANSetEAPUserData.h | 12 ++++++------ WLANSetEAPUserData/WLANSetEAPUserData.vcxproj | 12 ++++++++++++ 3 files changed, 22 insertions(+), 11 deletions(-) diff --git a/WLANSetEAPUserData/WLANSetEAPUserData.cpp b/WLANSetEAPUserData/WLANSetEAPUserData.cpp index 4fabb0f..6d2894e 100644 --- a/WLANSetEAPUserData/WLANSetEAPUserData.cpp +++ b/WLANSetEAPUserData/WLANSetEAPUserData.cpp @@ -39,11 +39,10 @@ using namespace std; /// Main program body /// int CALLBACK WinMain( - _In_ HINSTANCE hInstance, - _In_ HINSTANCE hPrevInstance, - _In_ LPSTR lpCmdLine, - _In_ int nCmdShow -) + _In_ HINSTANCE hInstance, + _In_opt_ HINSTANCE hPrevInstance, + _In_ LPSTR lpCmdLine, + _In_ int nCmdShow) { UNREFERENCED_PARAMETER(hInstance ); UNREFERENCED_PARAMETER(hPrevInstance); diff --git a/WLANSetEAPUserData/WLANSetEAPUserData.h b/WLANSetEAPUserData/WLANSetEAPUserData.h index b8da86c..1f3457d 100644 --- a/WLANSetEAPUserData/WLANSetEAPUserData.h +++ b/WLANSetEAPUserData/WLANSetEAPUserData.h @@ -49,7 +49,7 @@ struct LocalFree_delete<_Ty[]> /// /// Frees memory /// - inline void operator()(_Ty *_Ptr) const + inline void operator()(_Frees_ptr_opt_ _Ty *_Ptr) const noexcept { LocalFree(_Ptr); } @@ -80,7 +80,7 @@ public: /// /// \sa [CoInitialize function](https://msdn.microsoft.com/en-us/library/windows/desktop/ms678543.aspx) /// - inline com_initializer(_In_opt_ LPVOID pvReserved) + inline com_initializer(_In_opt_ LPVOID pvReserved) noexcept { m_result = CoInitialize(pvReserved); } @@ -91,7 +91,7 @@ public: /// /// \sa [CoInitializeEx function](https://msdn.microsoft.com/en-us/library/windows/desktop/ms695279.aspx) /// - inline com_initializer(_In_opt_ LPVOID pvReserved, _In_ DWORD dwCoInit) + inline com_initializer(_In_opt_ LPVOID pvReserved, _In_ DWORD dwCoInit) noexcept { m_result = CoInitializeEx(pvReserved, dwCoInit); } @@ -114,7 +114,7 @@ public: /// /// \sa [CoInitialize function](https://msdn.microsoft.com/en-us/library/windows/desktop/ms678543.aspx) /// - inline HRESULT status() const + inline HRESULT status() const noexcept { return m_result; } @@ -136,7 +136,7 @@ struct WlanCloseHandle_delete /// /// \sa [WlanCloseHandle function](https://msdn.microsoft.com/en-us/library/windows/desktop/ms706610.aspx) /// - inline void operator()(void *_Ptr) const + inline void operator()(void *_Ptr) const noexcept { WlanCloseHandle(_Ptr, NULL); } @@ -154,7 +154,7 @@ struct WlanFreeMemory_delete /// /// \sa [WlanFreeMemory function](https://msdn.microsoft.com/en-us/library/windows/desktop/ms706722.aspx) /// - void operator()(_Ty *_Ptr) const + void operator()(_Ty *_Ptr) const noexcept { WlanFreeMemory(_Ptr); } diff --git a/WLANSetEAPUserData/WLANSetEAPUserData.vcxproj b/WLANSetEAPUserData/WLANSetEAPUserData.vcxproj index acd956f..36814ff 100644 --- a/WLANSetEAPUserData/WLANSetEAPUserData.vcxproj +++ b/WLANSetEAPUserData/WLANSetEAPUserData.vcxproj @@ -70,24 +70,33 @@ $(Platform)\$(Configuration)\ $(SolutionDir)$(Platform)\$(Configuration)\ + NativeRecommendedRules.ruleset + true $(SolutionDir)$(Platform)\$(Configuration)\ $(Platform)\$(Configuration)\ + NativeRecommendedRules.ruleset + true $(Platform)\$(Configuration)\ $(SolutionDir)$(Platform)\$(Configuration)\ + NativeRecommendedRules.ruleset + true $(SolutionDir)$(Platform)\$(Configuration)\ $(Platform)\$(Configuration)\ + NativeRecommendedRules.ruleset + true Level4 WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) MultiThreadedDebug + true Windows @@ -98,6 +107,7 @@ Level4 WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) MultiThreadedDebug + true Windows @@ -108,6 +118,7 @@ Level4 WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) MultiThreaded + true Windows @@ -120,6 +131,7 @@ Level4 WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) MultiThreaded + true Windows