From 29db089e18c3ce10f5736b5ef08a5c8115a4edb4 Mon Sep 17 00:00:00 2001 From: irwir Date: Mon, 1 Jan 2018 15:35:03 +0300 Subject: [PATCH] Prefer default initialization. Remove unused and predefined preprocessor macros. Add /Zc:throwingNew option. --- ResizableLib/ResizableComboLBox.cpp | 3 +- ResizableLib/ResizableLib.vcxproj | 958 ++++++++++++++-------------- ResizableLib/ResizableSheetEx.cpp | 5 +- 3 files changed, 485 insertions(+), 481 deletions(-) diff --git a/ResizableLib/ResizableComboLBox.cpp b/ResizableLib/ResizableComboLBox.cpp index 97b0e76..b573856 100644 --- a/ResizableLib/ResizableComboLBox.cpp +++ b/ResizableLib/ResizableComboLBox.cpp @@ -85,8 +85,7 @@ void CResizableComboLBox::InitializeControl() m_sizeAfterSizing.cy += GetSystemMetrics(SM_CYHSCROLL); // apply size constraints - WINDOWPOS wp; - ZeroMemory(&wp, sizeof(wp)); + WINDOWPOS wp = {}; wp.cx = m_sizeAfterSizing.cx; wp.cy = m_sizeAfterSizing.cy; ApplyLimitsToPos(&wp); diff --git a/ResizableLib/ResizableLib.vcxproj b/ResizableLib/ResizableLib.vcxproj index ba1a072..94b17b5 100644 --- a/ResizableLib/ResizableLib.vcxproj +++ b/ResizableLib/ResizableLib.vcxproj @@ -1,476 +1,484 @@ - - - - - Debug Static Unicode - Win32 - - - Debug Static - Win32 - - - Debug Unicode - Win32 - - - Debug - Win32 - - - Release Static Unicode - Win32 - - - Release Static - Win32 - - - Release Unicode - Win32 - - - Release - Win32 - - - - {C176053F-C799-4BF4-ABFA-125A4192CEB9} - MFCProj - 8.1 - - - - StaticLibrary - v140_xp - Dynamic - Unicode - - - StaticLibrary - v140_xp - Dynamic - MultiByte - - - StaticLibrary - v140_xp - Static - Unicode - - - StaticLibrary - v140_xp - Static - MultiByte - - - StaticLibrary - v140_xp - Static - MultiByte - - - StaticLibrary - v140_xp - Static - Unicode - - - StaticLibrary - v140_xp - Dynamic - Unicode - - - StaticLibrary - v140_xp - Dynamic - MultiByte - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - <_ProjectFileVersion>14.0.23107.0 - - - .\Release\ - .\Release\ - - - .\Release_Unicode\ - .\Release_Unicode\ - - - .\Release_Static_Unicode\ - .\Release_Static_Unicode\ - - - .\Release_Static\ - .\Release_Static\ - - - .\Debug_Static\ - .\Debug_Static\ - - - .\Debug_Static_Unicode\ - .\Debug_Static_Unicode\ - - - .\Debug\ - .\Debug\ - - - .\Debug_Unicode\ - .\Debug_Unicode\ - - - - MaxSpeed - OnlyExplicitInline - WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) - true - MultiThreadedDLL - true - Use - stdafx.h - .\Release/ResizableLib.pch - .\Release/ - .\Release/ - .\Release/ - Level4 - true - - - NDEBUG;%(PreprocessorDefinitions) - 0x0410 - - - .\Release\ResizableLib.lib - true - - - true - .\Release/ResizableLib.bsc - - - - - MaxSpeed - OnlyExplicitInline - WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) - true - MultiThreadedDLL - true - Use - stdafx.h - .\Release_Unicode/ResizableLib.pch - .\Release_Unicode/ - .\Release_Unicode/ - .\Release_Unicode/ - Level4 - true - - - NDEBUG;%(PreprocessorDefinitions) - 0x0410 - - - .\Release_Unicode\ResizableLib.lib - true - - - true - .\Release_Unicode/ResizableLib.bsc - - - - - MaxSpeed - OnlyExplicitInline - WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) - true - MultiThreaded - true - Use - stdafx.h - .\Release_Static_Unicode/ResizableLib.pch - .\Release_Static_Unicode/ - .\Release_Static_Unicode/ - .\Release_Static_Unicode/ - Level4 - true - - - NDEBUG;%(PreprocessorDefinitions) - 0x0410 - - - .\Release_Static_Unicode\ResizableLib.lib - true - - - true - .\Release_Static_Unicode/ResizableLib.bsc - - - - - MaxSpeed - OnlyExplicitInline - WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) - true - MultiThreaded - true - Use - stdafx.h - .\Release_Static/ResizableLib.pch - .\Release_Static/ - .\Release_Static/ - .\Release_Static/ - Level4 - true - - - NDEBUG;%(PreprocessorDefinitions) - 0x0410 - - - .\Release_Static\ResizableLib.lib - true - - - true - .\Release_Static/ResizableLib.bsc - - - - - Disabled - WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) - true - EnableFastChecks - MultiThreadedDebug - Use - stdafx.h - .\Debug_Static/ResizableLib.pch - .\Debug_Static/ - .\Debug_Static/ - .\Debug_Static/ - Level4 - true - EditAndContinue - - - _DEBUG;%(PreprocessorDefinitions) - 0x0410 - - - .\Debug_Static\ResizableLib.lib - true - - - true - .\Debug_Static/ResizableLib.bsc - - - - - Disabled - WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) - true - EnableFastChecks - MultiThreadedDebug - Use - stdafx.h - .\Debug_Static_Unicode/ResizableLib.pch - .\Debug_Static_Unicode/ - .\Debug_Static_Unicode/ - .\Debug_Static_Unicode/ - Level4 - true - EditAndContinue - - - _DEBUG;%(PreprocessorDefinitions) - 0x0410 - - - .\Debug_Static_Unicode\ResizableLib.lib - true - - - true - .\Debug_Static_Unicode/ResizableLib.bsc - - - - - Disabled - WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) - true - EnableFastChecks - MultiThreadedDebugDLL - Use - stdafx.h - .\Debug/ResizableLib.pch - .\Debug/ - .\Debug/ - .\Debug/ - Level4 - true - EditAndContinue - - - _DEBUG;%(PreprocessorDefinitions) - 0x0410 - - - .\Debug\ResizableLib.lib - true - - - true - .\Debug/ResizableLib.bsc - - - - - Disabled - WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) - true - EnableFastChecks - MultiThreadedDebugDLL - Use - stdafx.h - .\Debug_Unicode/ResizableLib.pch - .\Debug_Unicode/ - .\Debug_Unicode/ - .\Debug_Unicode/ - Level4 - true - EditAndContinue - - - _DEBUG;%(PreprocessorDefinitions) - 0x0410 - - - .\Debug_Unicode\ResizableLib.lib - true - - - true - .\Debug_Unicode/ResizableLib.bsc - - - - - - - - - - - - - - - - - - - - - - - - - Create - Create - Create - Create - Create - Create - Create - Create - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + Debug Static Unicode + Win32 + + + Debug Static + Win32 + + + Debug Unicode + Win32 + + + Debug + Win32 + + + Release Static Unicode + Win32 + + + Release Static + Win32 + + + Release Unicode + Win32 + + + Release + Win32 + + + + {C176053F-C799-4BF4-ABFA-125A4192CEB9} + MFCProj + 8.1 + + + + StaticLibrary + v140_xp + Dynamic + Unicode + + + StaticLibrary + v140_xp + Dynamic + MultiByte + + + StaticLibrary + v140_xp + Static + Unicode + + + StaticLibrary + v140_xp + Static + MultiByte + + + StaticLibrary + v140_xp + Static + MultiByte + + + StaticLibrary + v140_xp + Static + Unicode + + + StaticLibrary + v140_xp + Dynamic + Unicode + + + StaticLibrary + v140_xp + Dynamic + MultiByte + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <_ProjectFileVersion>14.0.23107.0 + + + .\Release\ + .\Release\ + + + .\Release_Unicode\ + .\Release_Unicode\ + + + .\Release_Static_Unicode\ + .\Release_Static_Unicode\ + + + .\Release_Static\ + .\Release_Static\ + + + .\Debug_Static\ + .\Debug_Static\ + + + .\Debug_Static_Unicode\ + .\Debug_Static_Unicode\ + + + .\Debug\ + .\Debug\ + + + .\Debug_Unicode\ + .\Debug_Unicode\ + + + + MaxSpeed + OnlyExplicitInline + NDEBUG;%(PreprocessorDefinitions) + true + MultiThreadedDLL + true + Use + stdafx.h + .\Release/ResizableLib.pch + .\Release/ + .\Release/ + .\Release/ + Level4 + true + /Zc:throwingNew + + + NDEBUG;%(PreprocessorDefinitions) + 0x0410 + + + .\Release\ResizableLib.lib + true + + + true + .\Release/ResizableLib.bsc + + + + + MaxSpeed + OnlyExplicitInline + NDEBUG;%(PreprocessorDefinitions) + true + MultiThreadedDLL + true + Use + stdafx.h + .\Release_Unicode/ResizableLib.pch + .\Release_Unicode/ + .\Release_Unicode/ + .\Release_Unicode/ + Level4 + true + /Zc:throwingNew + + + NDEBUG;%(PreprocessorDefinitions) + 0x0410 + + + .\Release_Unicode\ResizableLib.lib + true + + + true + .\Release_Unicode/ResizableLib.bsc + + + + + MaxSpeed + OnlyExplicitInline + NDEBUG;%(PreprocessorDefinitions) + true + MultiThreaded + true + Use + stdafx.h + .\Release_Static_Unicode/ResizableLib.pch + .\Release_Static_Unicode/ + .\Release_Static_Unicode/ + .\Release_Static_Unicode/ + Level4 + true + /Zc:throwingNew + + + NDEBUG;%(PreprocessorDefinitions) + 0x0410 + + + .\Release_Static_Unicode\ResizableLib.lib + true + + + true + .\Release_Static_Unicode/ResizableLib.bsc + + + + + MaxSpeed + OnlyExplicitInline + NDEBUG;%(PreprocessorDefinitions) + true + MultiThreaded + true + Use + stdafx.h + .\Release_Static/ResizableLib.pch + .\Release_Static/ + .\Release_Static/ + .\Release_Static/ + Level4 + true + /Zc:throwingNew + + + NDEBUG;%(PreprocessorDefinitions) + 0x0410 + + + .\Release_Static\ResizableLib.lib + true + + + true + .\Release_Static/ResizableLib.bsc + + + + + Disabled + %(PreprocessorDefinitions) + true + EnableFastChecks + MultiThreadedDebug + Use + stdafx.h + .\Debug_Static/ResizableLib.pch + .\Debug_Static/ + .\Debug_Static/ + .\Debug_Static/ + Level4 + true + EditAndContinue + /Zc:throwingNew + + + %(PreprocessorDefinitions) + 0x0410 + + + .\Debug_Static\ResizableLib.lib + true + + + true + .\Debug_Static/ResizableLib.bsc + + + + + Disabled + %(PreprocessorDefinitions) + true + EnableFastChecks + MultiThreadedDebug + Use + stdafx.h + .\Debug_Static_Unicode/ResizableLib.pch + .\Debug_Static_Unicode/ + .\Debug_Static_Unicode/ + .\Debug_Static_Unicode/ + Level4 + true + EditAndContinue + /Zc:throwingNew + + + %(PreprocessorDefinitions) + 0x0410 + + + .\Debug_Static_Unicode\ResizableLib.lib + true + + + true + .\Debug_Static_Unicode/ResizableLib.bsc + + + + + Disabled + %(PreprocessorDefinitions) + true + EnableFastChecks + MultiThreadedDebugDLL + Use + stdafx.h + .\Debug/ResizableLib.pch + .\Debug/ + .\Debug/ + .\Debug/ + Level4 + true + EditAndContinue + /Zc:throwingNew + + + %(PreprocessorDefinitions) + 0x0410 + + + .\Debug\ResizableLib.lib + true + + + true + .\Debug/ResizableLib.bsc + + + + + Disabled + %(PreprocessorDefinitions) + true + EnableFastChecks + MultiThreadedDebugDLL + Use + stdafx.h + .\Debug_Unicode/ResizableLib.pch + .\Debug_Unicode/ + .\Debug_Unicode/ + .\Debug_Unicode/ + Level4 + true + EditAndContinue + /Zc:throwingNew + + + %(PreprocessorDefinitions) + 0x0410 + + + .\Debug_Unicode\ResizableLib.lib + true + + + true + .\Debug_Unicode/ResizableLib.bsc + + + + + + + + + + + + + + + + + + + + + + + + + Create + Create + Create + Create + Create + Create + Create + Create + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/ResizableLib/ResizableSheetEx.cpp b/ResizableLib/ResizableSheetEx.cpp index 2e78f14..083b90e 100644 --- a/ResizableLib/ResizableSheetEx.cpp +++ b/ResizableLib/ResizableSheetEx.cpp @@ -406,7 +406,6 @@ BOOL CResizableSheetEx::OnEraseBkgnd(CDC* pDC) if (m_psh.dwFlags & PSH_STRETCHWATERMARK) { BITMAP bmp; - ZeroMemory(&bmp, sizeof(bmp)); if (pHdr->GetBitmap(&bmp)) { CDC dc; @@ -429,9 +428,7 @@ BOOL CResizableSheetEx::OnEraseBkgnd(CDC* pDC) pDC->FillSolidRect(&rect, ::GetSysColor(COLOR_WINDOW)); } // get system font - NONCLIENTMETRICS ncm; - ZeroMemory(&ncm, sizeof(ncm)); - ncm.cbSize = sizeof(NONCLIENTMETRICS); + NONCLIENTMETRICS ncm = {sizeof(NONCLIENTMETRICS)}; SystemParametersInfo(SPI_GETNONCLIENTMETRICS, 0, &ncm, 0); // create fonts, with bold variant CFont fontTitle, fontSubTitle;