From a3116818e020e1007b9edd196173256109ef8652 Mon Sep 17 00:00:00 2001 From: Don Ho Date: Mon, 13 Sep 2021 21:19:44 +0200 Subject: [PATCH] Code enhancement: Initialize variable member's value of struct/class Close #10545 --- PowerEditor/src/EncodingMapper.h | 4 +- PowerEditor/src/MISC/Common/Sorters.h | 10 ++-- .../src/MISC/Exception/Win32Exception.h | 8 +-- .../src/MISC/PluginsManager/IDAllocator.h | 6 +-- .../src/MISC/PluginsManager/PluginInterface.h | 24 ++++----- .../src/MISC/PluginsManager/PluginsManager.h | 4 +- PowerEditor/src/Notepad_plus.h | 15 ++---- PowerEditor/src/ScintillaComponent/Buffer.h | 6 +-- .../src/ScintillaComponent/DocTabView.h | 2 +- .../src/ScintillaComponent/FindReplaceDlg.h | 14 +++--- PowerEditor/src/ScintillaComponent/Printer.h | 10 ++-- .../src/ScintillaComponent/ScintillaCtrls.h | 1 + .../ScintillaComponent/ScintillaEditView.h | 23 ++++----- .../src/ScintillaComponent/SmartHighlighter.h | 2 +- .../src/ScintillaComponent/UserDefineDialog.h | 16 +++--- .../src/WinControls/AboutDlg/URLCtrl.h | 19 +++---- .../ClipboardHistory/clipboardHistoryPanel.h | 19 ++++--- .../WinControls/ColourPicker/ColourPopup.h | 5 +- .../WinControls/ColourPicker/WordStyleDlg.h | 4 +- .../src/WinControls/DockingWnd/Docking.h | 22 ++++---- .../src/WinControls/DockingWnd/DockingCont.h | 50 +++++++++---------- .../WinControls/DockingWnd/DockingManager.h | 8 +-- .../src/WinControls/DocumentMap/documentMap.h | 8 +-- .../src/WinControls/FileBrowser/fileBrowser.h | 4 +- .../FunctionList/functionListPanel.h | 9 ++-- PowerEditor/src/WinControls/Grid/BabyGrid.h | 4 +- .../src/WinControls/Grid/ShortcutMapper.h | 10 ++-- .../WinControls/PluginsAdmin/pluginsAdmin.h | 8 +-- .../WinControls/Preference/preferenceDlg.h | 5 +- .../ReadDirectoryChanges.h | 6 +-- .../ReadDirectoryChangesPrivate.h | 10 ++-- .../ReadDirectoryChanges/ReadFileChanges.h | 6 +-- .../ReadDirectoryChanges/ThreadSafeQueue.h | 2 +- .../WinControls/SplitterContainer/Splitter.h | 3 +- .../WinControls/StaticDialog/StaticDialog.h | 22 ++++---- PowerEditor/src/WinControls/TabBar/TabBar.h | 4 +- .../src/WinControls/TaskList/TaskList.h | 4 +- PowerEditor/src/WinControls/ToolBar/ToolBar.h | 4 +- .../WinControls/TrayIcon/trayIconControler.h | 4 +- .../src/WinControls/TreeView/TreeView.h | 10 ++-- .../VerticalFileSwitcher.h | 6 +-- .../VerticalFileSwitcherListView.h | 4 +- .../src/WinControls/WindowsDlg/WindowsDlg.h | 14 +++--- .../src/WinControls/shortcut/shortcut.h | 14 +++--- 44 files changed, 209 insertions(+), 224 deletions(-) diff --git a/PowerEditor/src/EncodingMapper.h b/PowerEditor/src/EncodingMapper.h index 260c15fd6..ceef23d80 100644 --- a/PowerEditor/src/EncodingMapper.h +++ b/PowerEditor/src/EncodingMapper.h @@ -18,8 +18,8 @@ #pragma once struct EncodingUnit { - int _codePage; - const char *_aliasList; + int _codePage = 0; + const char *_aliasList = nullptr; }; class EncodingMapper { diff --git a/PowerEditor/src/MISC/Common/Sorters.h b/PowerEditor/src/MISC/Common/Sorters.h index 9dd087f0a..6ceb961fa 100644 --- a/PowerEditor/src/MISC/Common/Sorters.h +++ b/PowerEditor/src/MISC/Common/Sorters.h @@ -14,9 +14,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . - -#ifndef NPP_SORTERS_H -#define NPP_SORTERS_H +#pragma once #include #include @@ -26,8 +24,9 @@ class ISorter { private: - bool _isDescending; - size_t _fromColumn, _toColumn; + bool _isDescending = true; + size_t _fromColumn = 0; + size_t _toColumn = 0; protected: bool isDescending() const @@ -453,4 +452,3 @@ public: } }; -#endif //NPP_SORTERS_H diff --git a/PowerEditor/src/MISC/Exception/Win32Exception.h b/PowerEditor/src/MISC/Exception/Win32Exception.h index 454eb5159..43de5e345 100644 --- a/PowerEditor/src/MISC/Exception/Win32Exception.h +++ b/PowerEditor/src/MISC/Exception/Win32Exception.h @@ -42,11 +42,11 @@ protected: static void translate(unsigned code, EXCEPTION_POINTERS * info); private: - const char * _event; + const char * _event = nullptr; ExceptionAddress _location; - unsigned int _code; + unsigned int _code = 0; - EXCEPTION_POINTERS * _info; + EXCEPTION_POINTERS * _info = nullptr; }; @@ -58,7 +58,7 @@ public: private: explicit Win32AccessViolation(EXCEPTION_POINTERS * info); - bool _isWrite; + bool _isWrite = false; ExceptionAddress _badAddress; friend void Win32Exception::translate(unsigned code, EXCEPTION_POINTERS* info); diff --git a/PowerEditor/src/MISC/PluginsManager/IDAllocator.h b/PowerEditor/src/MISC/PluginsManager/IDAllocator.h index 64678a7e9..d3e496690 100644 --- a/PowerEditor/src/MISC/PluginsManager/IDAllocator.h +++ b/PowerEditor/src/MISC/PluginsManager/IDAllocator.h @@ -30,8 +30,8 @@ public: bool isInRange(int id) { return (id >= _start && id < _nextID); } private: - int _start; - int _nextID; - int _maximumID; + int _start = 0; + int _nextID = 0; + int _maximumID = 0; }; diff --git a/PowerEditor/src/MISC/PluginsManager/PluginInterface.h b/PowerEditor/src/MISC/PluginsManager/PluginInterface.h index bf1196dfd..75664b8dd 100644 --- a/PowerEditor/src/MISC/PluginsManager/PluginInterface.h +++ b/PowerEditor/src/MISC/PluginsManager/PluginInterface.h @@ -26,9 +26,9 @@ typedef const TCHAR * (__cdecl * PFUNCGETNAME)(); struct NppData { - HWND _nppHandle; - HWND _scintillaMainHandle; - HWND _scintillaSecondHandle; + HWND _nppHandle = nullptr; + HWND _scintillaMainHandle = nullptr; + HWND _scintillaSecondHandle = nullptr; }; typedef void (__cdecl * PFUNCSETINFO)(NppData); @@ -39,19 +39,19 @@ typedef LRESULT (__cdecl * PMESSAGEPROC)(UINT Message, WPARAM wParam, LPARAM lPa struct ShortcutKey { - bool _isCtrl; - bool _isAlt; - bool _isShift; - UCHAR _key; + bool _isCtrl = false; + bool _isAlt = false; + bool _isShift = false; + UCHAR _key = 0; }; struct FuncItem { - TCHAR _itemName[nbChar]; - PFUNCPLUGINCMD _pFunc; - int _cmdID; - bool _init2Check; - ShortcutKey *_pShKey; + TCHAR _itemName[nbChar] = { '\0' }; + PFUNCPLUGINCMD _pFunc = nullptr; + int _cmdID = 0; + bool _init2Check = false; + ShortcutKey *_pShKey = nullptr; }; typedef FuncItem * (__cdecl * PFUNCGETFUNCSARRAY)(int *); diff --git a/PowerEditor/src/MISC/PluginsManager/PluginsManager.h b/PowerEditor/src/MISC/PluginsManager/PluginsManager.h index deaef4ded..d33ac96ac 100644 --- a/PowerEditor/src/MISC/PluginsManager/PluginsManager.h +++ b/PowerEditor/src/MISC/PluginsManager/PluginsManager.h @@ -27,8 +27,8 @@ typedef BOOL (__cdecl * PFUNCISUNICODE)(); struct PluginCommand { generic_string _pluginName; - int _funcID; - PFUNCPLUGINCMD _pFunc; + int _funcID = 0; + PFUNCPLUGINCMD _pFunc = nullptr; PluginCommand(const TCHAR *pluginName, int funcID, PFUNCPLUGINCMD pFunc): _funcID(funcID), _pFunc(pFunc), _pluginName(pluginName){}; }; diff --git a/PowerEditor/src/Notepad_plus.h b/PowerEditor/src/Notepad_plus.h index b13c162d2..e6b157ca6 100644 --- a/PowerEditor/src/Notepad_plus.h +++ b/PowerEditor/src/Notepad_plus.h @@ -94,16 +94,11 @@ struct VisibleGUIConf final bool _isStatusbarShown = true; //used by fullscreen - WINDOWPLACEMENT _winPlace; + WINDOWPLACEMENT _winPlace = {0}; //used by distractionFree bool _was2ViewModeOn = false; std::vector _pVisibleDockingContainers; - - VisibleGUIConf() - { - memset(&_winPlace, 0x0, sizeof(_winPlace)); - } }; struct QuoteParams @@ -267,8 +262,8 @@ public: void refreshDarkMode(bool resetStyle = false); private: - Notepad_plus_Window *_pPublicInterface = nullptr; - Window *_pMainWindow = nullptr; + Notepad_plus_Window* _pPublicInterface = nullptr; + Window* _pMainWindow = nullptr; DockingManager _dockingManager; std::vector _internalFuncIDs; @@ -331,8 +326,6 @@ private: LastRecentFileList _lastRecentFileList; - //vector _customIconVect; - WindowsMenu _windowsMenu; HMENU _mainMenuHandle = NULL; @@ -355,7 +348,7 @@ private: RunMacroDlg _runMacroDlg; // For conflict detection when saving Macros or RunCommands - ShortcutMapper * _pShortcutMapper = nullptr; + ShortcutMapper* _pShortcutMapper = nullptr; // For hotspot bool _linkTriggered = true; diff --git a/PowerEditor/src/ScintillaComponent/Buffer.h b/PowerEditor/src/ScintillaComponent/Buffer.h index 24635cca2..9f241d916 100644 --- a/PowerEditor/src/ScintillaComponent/Buffer.h +++ b/PowerEditor/src/ScintillaComponent/Buffer.h @@ -389,11 +389,11 @@ private: //document properties Document _doc; //invariable - LangType _lang; + LangType _lang = L_TEXT; generic_string _userLangExt; // it's useful if only (_lang == L_USER) bool _isDirty = false; EolType _eolFormat = EolType::osdefault; - UniMode _unicodeMode; + UniMode _unicodeMode = uniUTF8; int _encoding = -1; bool _isUserReadOnly = false; bool _needLexer = false; // new buffers do not need lexing, Scintilla takes care of that @@ -404,7 +404,7 @@ private: std::vector> _foldStates; //Environment properties - DocFileStatus _currentStatus; + DocFileStatus _currentStatus = DOC_REGULAR; FILETIME _timeStamp = {}; // 0 if it's a new doc bool _isFileReadOnly = false; diff --git a/PowerEditor/src/ScintillaComponent/DocTabView.h b/PowerEditor/src/ScintillaComponent/DocTabView.h index 3c53efb76..0f95f4974 100644 --- a/PowerEditor/src/ScintillaComponent/DocTabView.h +++ b/PowerEditor/src/ScintillaComponent/DocTabView.h @@ -91,7 +91,7 @@ public : }; private : - ScintillaEditView *_pView; + ScintillaEditView *_pView = nullptr; static bool _hideTabBarStatus; std::vector _pIconListVector; diff --git a/PowerEditor/src/ScintillaComponent/FindReplaceDlg.h b/PowerEditor/src/ScintillaComponent/FindReplaceDlg.h index 3e19873a1..327dc48dd 100644 --- a/PowerEditor/src/ScintillaComponent/FindReplaceDlg.h +++ b/PowerEditor/src/ScintillaComponent/FindReplaceDlg.h @@ -362,11 +362,11 @@ protected : void combo2ExtendedMode(int comboID); private : - RECT _initialWindowRect; + RECT _initialWindowRect = {0}; LONG _deltaWidth = 0; LONG _initialClientWidth = 0; - DIALOG_TYPE _currentStatus; + DIALOG_TYPE _currentStatus = FIND_DLG; RECT _findClosePos, _replaceClosePos, _findInFilesClosePos, _markClosePos; RECT _countInSelFramePos, _replaceInSelFramePos; RECT _countInSelCheckPos, _replaceInSelCheckPos; @@ -384,10 +384,10 @@ private : bool _isRTL = false; int _findAllResult; - TCHAR _findAllResultStr[1024]; + TCHAR _findAllResultStr[1024] = {'\0'}; int _fileNameLenMax = 1024; - char *_uniFileName; + char *_uniFileName = nullptr; TabBar _tab; winVer _winVer = winVer::WV_UNKNOWN; @@ -453,7 +453,7 @@ public : virtual void destroy(); virtual void display(bool toShow = true) const; - void setSearchText(const TCHAR * txt2find, bool) { + void setSearchText(const TCHAR* txt2find, bool) { ::SendDlgItemMessage(_hSelf, IDC_INCFINDTEXT, WM_SETTEXT, 0, reinterpret_cast(txt2find)); }; @@ -463,13 +463,13 @@ public : return _findStatus; } - void addToRebar(ReBar * rebar); + void addToRebar(ReBar* rebar); private : bool _isRTL = false; FindReplaceDlg *_pFRDlg = nullptr; FindStatus _findStatus = FSFound; - ReBar * _pRebar = nullptr; + ReBar* _pRebar = nullptr; REBARBANDINFO _rbBand; virtual INT_PTR CALLBACK run_dlgProc(UINT message, WPARAM wParam, LPARAM lParam); diff --git a/PowerEditor/src/ScintillaComponent/Printer.h b/PowerEditor/src/ScintillaComponent/Printer.h index f9f9c5e0c..f176042db 100644 --- a/PowerEditor/src/ScintillaComponent/Printer.h +++ b/PowerEditor/src/ScintillaComponent/Printer.h @@ -21,11 +21,11 @@ struct NPP_RangeToFormat { - HDC hdc; - HDC hdcTarget; - RECT rc; - RECT rcPage; - Sci_CharacterRange chrg; + HDC hdc = nullptr; + HDC hdcTarget = nullptr; + RECT rc = { 0 }; + RECT rcPage = { 0 }; + Sci_CharacterRange chrg = { 0 }; }; class Printer diff --git a/PowerEditor/src/ScintillaComponent/ScintillaCtrls.h b/PowerEditor/src/ScintillaComponent/ScintillaCtrls.h index b186bda05..d47c71a9d 100644 --- a/PowerEditor/src/ScintillaComponent/ScintillaCtrls.h +++ b/PowerEditor/src/ScintillaComponent/ScintillaCtrls.h @@ -38,6 +38,7 @@ private: std::vector _scintVector; HINSTANCE _hInst = nullptr; HWND _hParent = nullptr; + int getIndexFrom(HWND handle2Find); }; diff --git a/PowerEditor/src/ScintillaComponent/ScintillaEditView.h b/PowerEditor/src/ScintillaComponent/ScintillaEditView.h index 91cd15ff3..db45982ca 100644 --- a/PowerEditor/src/ScintillaComponent/ScintillaEditView.h +++ b/PowerEditor/src/ScintillaComponent/ScintillaEditView.h @@ -134,14 +134,13 @@ const bool L2R = true; const bool R2L = false; struct ColumnModeInfo { - int _selLpos; - int _selRpos; - int _order; // 0 based index - bool _direction; // L2R or R2L - int _nbVirtualCaretSpc; - int _nbVirtualAnchorSpc; + int _selLpos = 0; + int _selRpos = 0; + int _order = -1; // 0 based index + bool _direction = L2R; // L2R or R2L + int _nbVirtualCaretSpc = 0; + int _nbVirtualAnchorSpc = 0; - ColumnModeInfo() : _selLpos(0), _selRpos(0), _order(-1), _direction(L2R), _nbVirtualAnchorSpc(0), _nbVirtualCaretSpc(0){}; ColumnModeInfo(int lPos, int rPos, int order, bool dir = L2R, int vAnchorNbSpc = 0, int vCaretNbSpc = 0) : _selLpos(lPos), _selRpos(rPos), _order(order), _direction(dir), _nbVirtualAnchorSpc(vAnchorNbSpc), _nbVirtualCaretSpc(vCaretNbSpc){}; @@ -171,11 +170,11 @@ struct SortInPositionOrder { typedef std::vector ColumnModeInfos; struct LanguageName { - const TCHAR * lexerName; - const TCHAR * shortName; - const TCHAR * longName; - LangType LangID; - int lexerID; + const TCHAR * lexerName = nullptr; + const TCHAR * shortName = nullptr; + const TCHAR * longName = nullptr; + LangType LangID = L_TEXT; + int lexerID = 0; }; #define URL_INDIC 8 diff --git a/PowerEditor/src/ScintillaComponent/SmartHighlighter.h b/PowerEditor/src/ScintillaComponent/SmartHighlighter.h index fac8d7f70..1f6a6241d 100644 --- a/PowerEditor/src/ScintillaComponent/SmartHighlighter.h +++ b/PowerEditor/src/ScintillaComponent/SmartHighlighter.h @@ -28,5 +28,5 @@ public: void highlightViewWithWord(ScintillaEditView * pHighlightView, const generic_string & word2Hilite); private: - FindReplaceDlg * _pFRDlg; + FindReplaceDlg * _pFRDlg = nullptr; }; diff --git a/PowerEditor/src/ScintillaComponent/UserDefineDialog.h b/PowerEditor/src/ScintillaComponent/UserDefineDialog.h index 4918bbb22..09b6854b5 100644 --- a/PowerEditor/src/ScintillaComponent/UserDefineDialog.h +++ b/PowerEditor/src/ScintillaComponent/UserDefineDialog.h @@ -362,13 +362,13 @@ protected : private : ControlsTab _ctrlTab; WindowVector _wVector; - UserLangContainer *_pCurrentUserLang; + UserLangContainer *_pCurrentUserLang = nullptr; FolderStyleDialog _folderStyleDlg; KeyWordsStyleDialog _keyWordsStyleDlg; CommentStyleDialog _commentStyleDlg; SymbolsStyleDialog _symbolsStyleDlg; bool _status = UNDOCK; - RECT _dlgPos; + RECT _dlgPos = { 0 }; int _currentHight = 0; int _yScrollPos = 0; int _prevHightVal = 0; @@ -450,12 +450,12 @@ public: static INT_PTR CALLBACK dlgProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam); private: - HINSTANCE _hInst; - HWND _parent; - int _stylerIndex; - int _enabledNesters; - ColourPicker * _pFgColour; - ColourPicker * _pBgColour; + HINSTANCE _hInst = nullptr; + HWND _parent = nullptr; + int _stylerIndex = 0; + int _enabledNesters = 0; + ColourPicker * _pFgColour = nullptr; + ColourPicker * _pBgColour = nullptr; Style _initialStyle; void move2CtrlRight(HWND hwndDlg, int ctrlID, HWND handle2Move, int handle2MoveWidth, int handle2MoveHeight); diff --git a/PowerEditor/src/WinControls/AboutDlg/URLCtrl.h b/PowerEditor/src/WinControls/AboutDlg/URLCtrl.h index fef439b73..693d532f1 100644 --- a/PowerEditor/src/WinControls/AboutDlg/URLCtrl.h +++ b/PowerEditor/src/WinControls/AboutDlg/URLCtrl.h @@ -22,9 +22,6 @@ class URLCtrl : public Window { public: - URLCtrl():_hfUnderlined(0),_hCursor(0), _msgDest(NULL), _cmdID(0), _oldproc(NULL), \ - _linkColor(), _visitedColor(), _clicking(false), _URL(TEXT("")){}; - void create(HWND itemHandle, const TCHAR * link, COLORREF linkColor = RGB(0,0,255)); void create(HWND itemHandle, int cmd, HWND msgDest = NULL); void destroy(); @@ -32,16 +29,16 @@ private: void action(); protected : generic_string _URL; - HFONT _hfUnderlined; - HCURSOR _hCursor; + HFONT _hfUnderlined = nullptr; + HCURSOR _hCursor = nullptr; - HWND _msgDest; - unsigned long _cmdID; + HWND _msgDest = nullptr; + unsigned long _cmdID = 0; - WNDPROC _oldproc; - COLORREF _linkColor; - COLORREF _visitedColor; - bool _clicking; + WNDPROC _oldproc = nullptr; + COLORREF _linkColor = RGB(0xFF, 0xFF, 0xFF); + COLORREF _visitedColor = RGB(0xFF, 0xFF, 0xFF); + bool _clicking = false; static LRESULT CALLBACK URLCtrlProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam){ return ((URLCtrl *)(::GetWindowLongPtr(hwnd, GWLP_USERDATA)))->runProc(hwnd, Message, wParam, lParam); diff --git a/PowerEditor/src/WinControls/ClipboardHistory/clipboardHistoryPanel.h b/PowerEditor/src/WinControls/ClipboardHistory/clipboardHistoryPanel.h index 81203349a..4e6358346 100644 --- a/PowerEditor/src/WinControls/ClipboardHistory/clipboardHistoryPanel.h +++ b/PowerEditor/src/WinControls/ClipboardHistory/clipboardHistoryPanel.h @@ -29,19 +29,18 @@ class ScintillaEditView; class ByteArray { public: - ByteArray():_pBytes(NULL), _length(0) {}; + ByteArray() = default; explicit ByteArray(ClipboardData cd); ~ByteArray() { - delete [] _pBytes; - _pBytes = NULL; - _length = 0; + if (_pBytes) + delete [] _pBytes; }; const unsigned char * getPointer() const {return _pBytes;}; size_t getLength() const {return _length;}; protected: - unsigned char *_pBytes; - size_t _length; + unsigned char *_pBytes = nullptr; + size_t _length = 0; }; class StringArray : public ByteArray { @@ -79,11 +78,11 @@ protected: virtual INT_PTR CALLBACK run_dlgProc(UINT message, WPARAM wParam, LPARAM lParam); private: - ScintillaEditView **_ppEditView; + ScintillaEditView **_ppEditView = nullptr; std::vector _clipboardDataVector; - HWND _hwndNextCbViewer; - int _lbBgColor; - int _lbFgColor; + HWND _hwndNextCbViewer = nullptr; + int _lbBgColor = -1; + int _lbFgColor= -1; }; diff --git a/PowerEditor/src/WinControls/ColourPicker/ColourPopup.h b/PowerEditor/src/WinControls/ColourPicker/ColourPopup.h index 0f479ea4c..d2445dfba 100644 --- a/PowerEditor/src/WinControls/ColourPicker/ColourPopup.h +++ b/PowerEditor/src/WinControls/ColourPicker/ColourPopup.h @@ -58,9 +58,8 @@ public : COLORREF getSelColour(){return _colour;}; private : - RECT _rc; - COLORREF _colour; - //bool isColourChooserLaunched = false; + RECT _rc = {0}; + COLORREF _colour = RGB(0xFF, 0xFF, 0xFF); static INT_PTR CALLBACK dlgProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam); INT_PTR CALLBACK run_dlgProc(UINT message, WPARAM wParam, LPARAM lParam); diff --git a/PowerEditor/src/WinControls/ColourPicker/WordStyleDlg.h b/PowerEditor/src/WinControls/ColourPicker/WordStyleDlg.h index 625c0e236..d37b689a5 100644 --- a/PowerEditor/src/WinControls/ColourPicker/WordStyleDlg.h +++ b/PowerEditor/src/WinControls/ColourPicker/WordStyleDlg.h @@ -45,8 +45,8 @@ public : _oldProc = reinterpret_cast(::SetWindowLongPtr(staticHandle, GWLP_WNDPROC, reinterpret_cast(staticProc))); }; private : - COLORREF _colour; - WNDPROC _oldProc; + COLORREF _colour = RGB(0xFF, 0xFF, 0xFF); + WNDPROC _oldProc = nullptr; static LRESULT CALLBACK staticProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam){ ColourStaticTextHooker *pColourStaticTextHooker = reinterpret_cast(::GetWindowLongPtr(hwnd, GWLP_USERDATA)); diff --git a/PowerEditor/src/WinControls/DockingWnd/Docking.h b/PowerEditor/src/WinControls/DockingWnd/Docking.h index 2f8baeab7..e23a2c3c9 100644 --- a/PowerEditor/src/WinControls/DockingWnd/Docking.h +++ b/PowerEditor/src/WinControls/DockingWnd/Docking.h @@ -47,25 +47,25 @@ typedef struct { - HWND hClient; // client Window Handle - const TCHAR *pszName; // name of plugin (shown in window) - int dlgID; // a funcItem provides the function pointer to start a dialog. Please parse here these ID + HWND hClient = nullptr; // client Window Handle + const TCHAR* pszName = nullptr; // name of plugin (shown in window) + int dlgID = 0; // a funcItem provides the function pointer to start a dialog. Please parse here these ID // user modifications - UINT uMask; // mask params: look to above defines - HICON hIconTab; // icon for tabs - const TCHAR *pszAddInfo; // for plugin to display additional informations + UINT uMask = 0; // mask params: look to above defines + HICON hIconTab = nullptr; // icon for tabs + const TCHAR* pszAddInfo = nullptr; // for plugin to display additional informations // internal data, do not use !!! - RECT rcFloat; // floating position - int iPrevCont; // stores the privious container (toggling between float and dock) - const TCHAR* pszModuleName; // it's the plugin file name. It's used to identify the plugin + RECT rcFloat = {0}; // floating position + int iPrevCont = 0; // stores the privious container (toggling between float and dock) + const TCHAR* pszModuleName = nullptr; // it's the plugin file name. It's used to identify the plugin } tTbData; typedef struct { - HWND hWnd; // the docking manager wnd - RECT rcRegion[DOCKCONT_MAX]; // position of docked dialogs + HWND hWnd = nullptr; // the docking manager wnd + RECT rcRegion[DOCKCONT_MAX] = {{0}}; // position of docked dialogs } tDockMgr; diff --git a/PowerEditor/src/WinControls/DockingWnd/DockingCont.h b/PowerEditor/src/WinControls/DockingWnd/DockingCont.h index 0a86205d7..b10e64de6 100644 --- a/PowerEditor/src/WinControls/DockingWnd/DockingCont.h +++ b/PowerEditor/src/WinControls/DockingWnd/DockingCont.h @@ -172,55 +172,55 @@ protected : private: // handles - BOOL _isActive; - bool _isFloating; - HWND _hCaption; - HWND _hContTab; + BOOL _isActive = FALSE; + bool _isFloating = FALSE; + HWND _hCaption = nullptr; + HWND _hContTab = nullptr; // horizontal font for caption and tab - HFONT _hFont; + HFONT _hFont = nullptr; // caption params - BOOL _isTopCaption; - generic_string _pszCaption; + BOOL _isTopCaption = FALSE; + generic_string _pszCaption; - BOOL _isMouseDown; - BOOL _isMouseClose; - BOOL _isMouseOver; - RECT _rcCaption; + BOOL _isMouseDown = FALSE; + BOOL _isMouseClose = FALSE; + BOOL _isMouseOver = FALSE; + RECT _rcCaption = {0}; // tab style - BOOL _bDrawOgLine; + BOOL _bDrawOgLine = FALSE; // Important value for DlgMoving class - BOOL _dragFromTab; + BOOL _dragFromTab = FALSE; // subclassing handle for caption - WNDPROC _hDefaultCaptionProc; + WNDPROC _hDefaultCaptionProc = nullptr; // subclassing handle for tab - WNDPROC _hDefaultTabProc; + WNDPROC _hDefaultTabProc = nullptr; // for moving and reordering - UINT _prevItem; - BOOL _beginDrag; + UINT _prevItem = 0; + BOOL _beginDrag = FALSE; // Is tooltip - BOOL _bTabTTHover; - INT _iLastHovered; + BOOL _bTabTTHover = FALSE; + INT _iLastHovered = 0; - BOOL _bCaptionTT; - BOOL _bCapTTHover; - eMousePos _hoverMPos; + BOOL _bCaptionTT = FALSE; + BOOL _bCapTTHover = FALSE; + eMousePos _hoverMPos = posOutside; int _captionHeightDynamic = HIGH_CAPTION; int _captionGapDynamic = CAPTION_GAP; int _closeButtonPosLeftDynamic = CLOSEBTN_POS_LEFT; int _closeButtonPosTopDynamic = CLOSEBTN_POS_TOP; - int _closeButtonWidth; - int _closeButtonHeight; + int _closeButtonWidth = 12; + int _closeButtonHeight = 12; // data of added windows - std::vector _vTbData; + std::vector _vTbData; }; diff --git a/PowerEditor/src/WinControls/DockingWnd/DockingManager.h b/PowerEditor/src/WinControls/DockingWnd/DockingManager.h index 4c678a691..3a6655c33 100644 --- a/PowerEditor/src/WinControls/DockingWnd/DockingManager.h +++ b/PowerEditor/src/WinControls/DockingWnd/DockingManager.h @@ -85,8 +85,8 @@ public : private : Window **_ppWindow = nullptr; - RECT _rcWork; - RECT _rect; + RECT _rcWork = { 0 }; + RECT _rect = { 0 }; Window **_ppMainWindow = nullptr; std::vector _vImageList; HIMAGELIST _hImageList = nullptr; @@ -94,8 +94,8 @@ private : tDockMgr _dockData; static BOOL _isRegistered; BOOL _isInitialized = FALSE; - int _iContMap[CONT_MAP_MAX]; - std::vector _vSplitter; + int _iContMap[CONT_MAP_MAX] = { 0 }; + std::vector _vSplitter; static LRESULT CALLBACK staticWinProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam); diff --git a/PowerEditor/src/WinControls/DocumentMap/documentMap.h b/PowerEditor/src/WinControls/DocumentMap/documentMap.h index 0aa233fbb..fe060d477 100644 --- a/PowerEditor/src/WinControls/DocumentMap/documentMap.h +++ b/PowerEditor/src/WinControls/DocumentMap/documentMap.h @@ -87,8 +87,8 @@ private : HWND _viewZoneCanvas = nullptr; WNDPROC _canvasDefaultProc = nullptr; - long _higherY; - long _lowerY; + long _higherY = 0; + long _lowerY = 0; }; @@ -141,8 +141,8 @@ protected: bool needToRecomputeWith(const ScintillaEditView *editView = nullptr); private: - ScintillaEditView **_ppEditView = nullptr; - ScintillaEditView *_pMapView = nullptr; + ScintillaEditView**_ppEditView = nullptr; + ScintillaEditView*_pMapView = nullptr; ViewZoneDlg _vzDlg; HWND _hwndScintilla; bool _isTemporarilyShowing = false; diff --git a/PowerEditor/src/WinControls/FileBrowser/fileBrowser.h b/PowerEditor/src/WinControls/FileBrowser/fileBrowser.h index f5c345148..cbd66669a 100644 --- a/PowerEditor/src/WinControls/FileBrowser/fileBrowser.h +++ b/PowerEditor/src/WinControls/FileBrowser/fileBrowser.h @@ -79,7 +79,7 @@ public: private: std::vector _subFolders; std::vector _files; - FolderInfo *_parent = nullptr; + FolderInfo*_parent = nullptr; generic_string _name; generic_string _rootPath; // set only for root folder; empty for normal folder }; @@ -99,7 +99,7 @@ public: private: FolderInfo _rootFolder; - FileBrowser *_pFileBrowser = nullptr; + FileBrowser*_pFileBrowser = nullptr; HANDLE _watchThreadHandle = nullptr; HANDLE _EventHandle = nullptr; static DWORD WINAPI watching(void *param); diff --git a/PowerEditor/src/WinControls/FunctionList/functionListPanel.h b/PowerEditor/src/WinControls/FunctionList/functionListPanel.h index 877a1a8d4..5ddb3224d 100644 --- a/PowerEditor/src/WinControls/FunctionList/functionListPanel.h +++ b/PowerEditor/src/WinControls/FunctionList/functionListPanel.h @@ -50,10 +50,7 @@ root struct SearchParameters { generic_string _text2Find; - bool _doSort; - - SearchParameters(): _text2Find(TEXT("")), _doSort(false){ - }; + bool _doSort = false; bool hasParams()const{ return (_text2Find != TEXT("") || _doSort); @@ -113,7 +110,7 @@ private: SCROLLINFO si; long _findLine = -1; long _findEndLine = -1; - HTREEITEM _findItem; + HTREEITEM _findItem = nullptr; generic_string _sortTipStr = TEXT("Sort"); generic_string _reloadTipStr = TEXT("Reload"); @@ -126,7 +123,7 @@ private: FunctionParsersManager _funcParserMgr; std::vector< std::pair > _skipZones; std::vector _treeParams; - HIMAGELIST _hTreeViewImaLst; + HIMAGELIST _hTreeViewImaLst = nullptr; generic_string parseSubLevel(size_t begin, size_t end, std::vector< generic_string > dataToSearch, int & foundPos); size_t getBodyClosePos(size_t begin, const TCHAR *bodyOpenSymbol, const TCHAR *bodyCloseSymbol); diff --git a/PowerEditor/src/WinControls/Grid/BabyGrid.h b/PowerEditor/src/WinControls/Grid/BabyGrid.h index e76ae0448..2240d9839 100644 --- a/PowerEditor/src/WinControls/Grid/BabyGrid.h +++ b/PowerEditor/src/WinControls/Grid/BabyGrid.h @@ -97,8 +97,8 @@ #define BGM_SETHILIGHTCOLOR_PROTECT_NOFOCUS BABYGRID_USER + 50 struct _BGCELL { - int row; - int col; + int row = 0; + int col = 0; }; diff --git a/PowerEditor/src/WinControls/Grid/ShortcutMapper.h b/PowerEditor/src/WinControls/Grid/ShortcutMapper.h index 3c62e4133..9af427d0c 100644 --- a/PowerEditor/src/WinControls/Grid/ShortcutMapper.h +++ b/PowerEditor/src/WinControls/Grid/ShortcutMapper.h @@ -88,11 +88,11 @@ private: GFONT_ROWS, MAX_GRID_FONTS }; - LONG _clientWidth; - LONG _clientHeight; - LONG _initClientWidth; - LONG _initClientHeight; - bool _dialogInitDone; + LONG _clientWidth = 0; + LONG _clientHeight = 0; + LONG _initClientWidth = 0; + LONG _initClientHeight = 0; + bool _dialogInitDone = false; void initTabs(); void initBabyGrid(); diff --git a/PowerEditor/src/WinControls/PluginsAdmin/pluginsAdmin.h b/PowerEditor/src/WinControls/PluginsAdmin/pluginsAdmin.h index 408f06c69..e166d7e20 100644 --- a/PowerEditor/src/WinControls/PluginsAdmin/pluginsAdmin.h +++ b/PowerEditor/src/WinControls/PluginsAdmin/pluginsAdmin.h @@ -84,12 +84,12 @@ struct PluginUpdateInfo struct NppCurrentStatus { - bool _isAdminMode; // can launch gitup en Admin mode directly + bool _isAdminMode = false; // can launch gitup en Admin mode directly - bool _isInProgramFiles; // true: install/update/remove on "Program files" (ADMIN MODE) - // false: install/update/remove on NPP_INST or install on %APPDATA%, update/remove on %APPDATA% & NPP_INST (NORMAL MODE) + bool _isInProgramFiles = true; // true: install/update/remove on "Program files" (ADMIN MODE) + // false: install/update/remove on NPP_INST or install on %APPDATA%, update/remove on %APPDATA% & NPP_INST (NORMAL MODE) - bool _isAppDataPluginsAllowed; // true: install on %APPDATA%, update / remove on %APPDATA% & "Program files" or NPP_INST + bool _isAppDataPluginsAllowed = false; // true: install on %APPDATA%, update / remove on %APPDATA% & "Program files" or NPP_INST generic_string _nppInstallPath; generic_string _appdataPath; diff --git a/PowerEditor/src/WinControls/Preference/preferenceDlg.h b/PowerEditor/src/WinControls/Preference/preferenceDlg.h index f051b23cb..004efba63 100644 --- a/PowerEditor/src/WinControls/Preference/preferenceDlg.h +++ b/PowerEditor/src/WinControls/Preference/preferenceDlg.h @@ -88,7 +88,7 @@ private : struct LangID_Name { - LangType _id; + LangType _id = L_TEXT; generic_string _name; LangID_Name(LangType id, const generic_string& name) : _id(id), _name(name){}; }; @@ -224,7 +224,8 @@ public : private : POINT _singleLineModePoint, _multiLineModePoint; - RECT _closerRect, _closerLabelRect; + RECT _closerRect = { 0 }; + RECT _closerLabelRect = { 0 }; HWND _tip = nullptr; INT_PTR CALLBACK run_dlgProc(UINT message, WPARAM wParam, LPARAM lParam); diff --git a/PowerEditor/src/WinControls/ReadDirectoryChanges/ReadDirectoryChanges.h b/PowerEditor/src/WinControls/ReadDirectoryChanges/ReadDirectoryChanges.h index 9a548db9e..904ea2cea 100644 --- a/PowerEditor/src/WinControls/ReadDirectoryChanges/ReadDirectoryChanges.h +++ b/PowerEditor/src/WinControls/ReadDirectoryChanges/ReadDirectoryChanges.h @@ -145,11 +145,11 @@ public: unsigned int GetThreadId() { return m_dwThreadId; } protected: - ReadDirectoryChangesPrivate::CReadChangesServer* m_pServer; + ReadDirectoryChangesPrivate::CReadChangesServer* m_pServer = nullptr; - HANDLE m_hThread; + HANDLE m_hThread = nullptr; - unsigned int m_dwThreadId; + unsigned int m_dwThreadId = 0; CThreadSafeQueue m_Notifications; }; diff --git a/PowerEditor/src/WinControls/ReadDirectoryChanges/ReadDirectoryChangesPrivate.h b/PowerEditor/src/WinControls/ReadDirectoryChanges/ReadDirectoryChangesPrivate.h index 4a79ccd0c..f21b1a850 100644 --- a/PowerEditor/src/WinControls/ReadDirectoryChanges/ReadDirectoryChangesPrivate.h +++ b/PowerEditor/src/WinControls/ReadDirectoryChanges/ReadDirectoryChangesPrivate.h @@ -75,12 +75,12 @@ protected: LPOVERLAPPED lpOverlapped); // I/O information buffer // Parameters from the caller for ReadDirectoryChangesW(). - DWORD m_dwFilterFlags; - BOOL m_bIncludeChildren; + DWORD m_dwFilterFlags = 0; + BOOL m_bIncludeChildren = FALSE; std::wstring m_wstrDirectory; // Result of calling CreateFile(). - HANDLE m_hDirectory; + HANDLE m_hDirectory = nullptr; // Required parameter for ReadDirectoryChangesW(). OVERLAPPED m_Overlapped; @@ -130,7 +130,7 @@ public: pRequest->m_pServer->AddDirectory(pRequest); } - CReadDirectoryChanges* m_pBase; + CReadDirectoryChanges* m_pBase = nullptr; volatile DWORD m_nOutstandingRequests; @@ -171,7 +171,7 @@ protected: vector m_pBlocks; - bool m_bTerminate; + bool m_bTerminate = false; }; } diff --git a/PowerEditor/src/WinControls/ReadDirectoryChanges/ReadFileChanges.h b/PowerEditor/src/WinControls/ReadDirectoryChanges/ReadFileChanges.h index 272fa5dc1..6e24bc225 100644 --- a/PowerEditor/src/WinControls/ReadDirectoryChanges/ReadFileChanges.h +++ b/PowerEditor/src/WinControls/ReadDirectoryChanges/ReadFileChanges.h @@ -21,9 +21,9 @@ public: void Terminate(); private: - LPCTSTR _szFile; - DWORD _dwNotifyFilter; - WIN32_FILE_ATTRIBUTE_DATA _lastFileInfo; + LPCTSTR _szFile = nullptr; + DWORD _dwNotifyFilter = 0; + WIN32_FILE_ATTRIBUTE_DATA _lastFileInfo = { 0 }; }; diff --git a/PowerEditor/src/WinControls/ReadDirectoryChanges/ThreadSafeQueue.h b/PowerEditor/src/WinControls/ReadDirectoryChanges/ThreadSafeQueue.h index a74e1a65d..c94e1b153 100644 --- a/PowerEditor/src/WinControls/ReadDirectoryChanges/ThreadSafeQueue.h +++ b/PowerEditor/src/WinControls/ReadDirectoryChanges/ThreadSafeQueue.h @@ -79,6 +79,6 @@ public: HANDLE GetWaitHandle() { return m_hEvent; } protected: - HANDLE m_hEvent; + HANDLE m_hEvent = nullptr; std::mutex m_mutex; }; diff --git a/PowerEditor/src/WinControls/SplitterContainer/Splitter.h b/PowerEditor/src/WinControls/SplitterContainer/Splitter.h index 8f3746ed8..eced93f40 100644 --- a/PowerEditor/src/WinControls/SplitterContainer/Splitter.h +++ b/PowerEditor/src/WinControls/SplitterContainer/Splitter.h @@ -81,7 +81,8 @@ private: static bool _isHorizontalFixedRegistered; static bool _isVerticalFixedRegistered; - RECT _clickZone2TL, _clickZone2BR; + RECT _clickZone2TL = { 0 }; + RECT _clickZone2BR = { 0 }; static LRESULT CALLBACK staticWndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam); LRESULT CALLBACK spliterWndProc(UINT uMsg, WPARAM wParam, LPARAM lParam); diff --git a/PowerEditor/src/WinControls/StaticDialog/StaticDialog.h b/PowerEditor/src/WinControls/StaticDialog/StaticDialog.h index 9428c716e..e1ecab975 100644 --- a/PowerEditor/src/WinControls/StaticDialog/StaticDialog.h +++ b/PowerEditor/src/WinControls/StaticDialog/StaticDialog.h @@ -23,16 +23,16 @@ enum class PosAlign { left, right, top, bottom }; struct DLGTEMPLATEEX { - WORD dlgVer; - WORD signature; - DWORD helpID; - DWORD exStyle; - DWORD style; - WORD cDlgItems; - short x; - short y; - short cx; - short cy; + WORD dlgVer = 0; + WORD signature = 0; + DWORD helpID = 0; + DWORD exStyle = 0; + DWORD style = 0; + WORD cDlgItems = 0; + short x = 0; + short y = 0; + short cx = 0; + short cy = 0; // The structure has more fields but are variable length }; @@ -68,7 +68,7 @@ public : virtual void destroy() override; protected: - RECT _rc; + RECT _rc = { 0 }; static INT_PTR CALLBACK dlgProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam); virtual INT_PTR CALLBACK run_dlgProc(UINT message, WPARAM wParam, LPARAM lParam) = 0; diff --git a/PowerEditor/src/WinControls/TabBar/TabBar.h b/PowerEditor/src/WinControls/TabBar/TabBar.h index 7b1557c12..dbd434799 100644 --- a/PowerEditor/src/WinControls/TabBar/TabBar.h +++ b/PowerEditor/src/WinControls/TabBar/TabBar.h @@ -123,8 +123,8 @@ struct CloseButtonZone bool isHit(int x, int y, const RECT & tabRect, bool isVertical) const; RECT getButtonRectFrom(const RECT & tabRect, bool isVertical) const; - int _width; - int _height; + int _width = 0; + int _height = 0; }; diff --git a/PowerEditor/src/WinControls/TaskList/TaskList.h b/PowerEditor/src/WinControls/TaskList/TaskList.h index b60da6016..d98358973 100644 --- a/PowerEditor/src/WinControls/TaskList/TaskList.h +++ b/PowerEditor/src/WinControls/TaskList/TaskList.h @@ -51,7 +51,7 @@ public: protected: - WNDPROC _defaultProc; + WNDPROC _defaultProc = nullptr; LRESULT runProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam); static LRESULT CALLBACK staticProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam) { @@ -62,6 +62,6 @@ protected: HFONT _hFontSelected = nullptr; int _nbItem = 0; int _currentIndex = 0; - RECT _rc; + RECT _rc = { 0 }; }; diff --git a/PowerEditor/src/WinControls/ToolBar/ToolBar.h b/PowerEditor/src/WinControls/ToolBar/ToolBar.h index 62f783b0c..649feab06 100644 --- a/PowerEditor/src/WinControls/ToolBar/ToolBar.h +++ b/PowerEditor/src/WinControls/ToolBar/ToolBar.h @@ -34,8 +34,8 @@ enum toolBarStatusType {TB_SMALL, TB_LARGE, TB_SMALL2, TB_LARGE2, TB_STANDARD}; struct iconLocator { - int listIndex; - int iconIndex; + int listIndex = 0; + int iconIndex = 0; generic_string iconLocation; iconLocator(int iList, int iIcon, const generic_string& iconLoc) diff --git a/PowerEditor/src/WinControls/TrayIcon/trayIconControler.h b/PowerEditor/src/WinControls/TrayIcon/trayIconControler.h index f6f9b1274..0277b4c26 100644 --- a/PowerEditor/src/WinControls/TrayIcon/trayIconControler.h +++ b/PowerEditor/src/WinControls/TrayIcon/trayIconControler.h @@ -34,7 +34,7 @@ public: bool isInTray() const {return _isIconShowed;}; private: - NOTIFYICONDATA _nid; - bool _isIconShowed; + NOTIFYICONDATA _nid; + bool _isIconShowed = false; }; diff --git a/PowerEditor/src/WinControls/TreeView/TreeView.h b/PowerEditor/src/WinControls/TreeView/TreeView.h index e21e1387d..70c0f37a1 100644 --- a/PowerEditor/src/WinControls/TreeView/TreeView.h +++ b/PowerEditor/src/WinControls/TreeView/TreeView.h @@ -24,8 +24,8 @@ struct TreeStateNode { generic_string _label; generic_string _extraData; - bool _isExpanded; - bool _isSelected; + bool _isExpanded = false; + bool _isSelected = false; std::vector _children; }; @@ -118,7 +118,7 @@ public: void customSorting(HTREEITEM hTreeItem, PFNTVCOMPARE sortingCallbackFunc, LPARAM lParam, bool isRecursive); protected: - WNDPROC _defaultProc; + WNDPROC _defaultProc = nullptr; LRESULT runProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam); static LRESULT CALLBACK staticProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam) { @@ -129,8 +129,8 @@ protected: bool searchLeafRecusivelyAndBuildTree(HTREEITEM tree2Build, const generic_string & text2Search, int index2Search, HTREEITEM tree2Search); // Drag and Drop operations - HTREEITEM _draggedItem; - HIMAGELIST _draggedImageList; + HTREEITEM _draggedItem = nullptr; + HIMAGELIST _draggedImageList = nullptr; bool _isItemDragged = false; std::vector _canNotDragOutList; std::vector _canNotDropInList; diff --git a/PowerEditor/src/WinControls/VerticalFileSwitcher/VerticalFileSwitcher.h b/PowerEditor/src/WinControls/VerticalFileSwitcher/VerticalFileSwitcher.h index d1a8001d3..4ff944fb1 100644 --- a/PowerEditor/src/WinControls/VerticalFileSwitcher/VerticalFileSwitcher.h +++ b/PowerEditor/src/WinControls/VerticalFileSwitcher/VerticalFileSwitcher.h @@ -24,9 +24,9 @@ #define FS_PROJECTPANELTITLE TEXT("Document List") struct sortCompareData { - HWND hListView; - int columnIndex; - int sortDirection; + HWND hListView = nullptr; + int columnIndex = 0; + int sortDirection = 0; }; class VerticalFileSwitcher : public DockingDlgInterface { diff --git a/PowerEditor/src/WinControls/VerticalFileSwitcher/VerticalFileSwitcherListView.h b/PowerEditor/src/WinControls/VerticalFileSwitcher/VerticalFileSwitcherListView.h index ad4cec4d0..87c569515 100644 --- a/PowerEditor/src/WinControls/VerticalFileSwitcher/VerticalFileSwitcherListView.h +++ b/PowerEditor/src/WinControls/VerticalFileSwitcher/VerticalFileSwitcherListView.h @@ -33,8 +33,8 @@ typedef Buffer * BufferID; //each buffer has unique ID by which it can be retrie #define FS_CLMNPATH "ColumnPath" struct SwitcherFileInfo { - BufferID _bufID; - int _iView; + BufferID _bufID = 0; + int _iView = 0; SwitcherFileInfo() = delete; SwitcherFileInfo(BufferID buf, int view) : _bufID(buf), _iView(view){}; diff --git a/PowerEditor/src/WinControls/WindowsDlg/WindowsDlg.h b/PowerEditor/src/WinControls/WindowsDlg/WindowsDlg.h index fa6448991..8d875a10e 100644 --- a/PowerEditor/src/WinControls/WindowsDlg/WindowsDlg.h +++ b/PowerEditor/src/WinControls/WindowsDlg/WindowsDlg.h @@ -34,11 +34,11 @@ typedef enum { struct NMWINDLG : public NMHDR { - BOOL processed; - WinDlgNotifyType type; - UINT curSel; - UINT nItems; - UINT *Items; + BOOL processed = FALSE; + WinDlgNotifyType type = WDT_ACTIVATE; + UINT curSel = 0; + UINT nItems = 0; + UINT *Items = 0; // ctor: initialize to zeroes NMWINDLG() { memset(this,0,sizeof(NMWINDLG)); } @@ -83,8 +83,8 @@ protected : HWND _hList = nullptr; static RECT _lastKnownLocation; - SIZE _szMinButton; - SIZE _szMinListCtrl; + SIZE _szMinButton = { 0 }; + SIZE _szMinListCtrl = { 0 }; DocTabView *_pTab = nullptr; std::vector _idxMap; int _currentColumn = -1; diff --git a/PowerEditor/src/WinControls/shortcut/shortcut.h b/PowerEditor/src/WinControls/shortcut/shortcut.h index 50aaea7db..8e0194354 100644 --- a/PowerEditor/src/WinControls/shortcut/shortcut.h +++ b/PowerEditor/src/WinControls/shortcut/shortcut.h @@ -58,10 +58,10 @@ static size_t keyTranslate(size_t keyIn) { }; struct KeyCombo { - bool _isCtrl; - bool _isAlt; - bool _isShift; - UCHAR _key; + bool _isCtrl = false; + bool _isAlt = false; + bool _isShift = false; + UCHAR _key = 0; }; class Shortcut : public StaticDialog { @@ -175,9 +175,9 @@ public: protected : KeyCombo _keyCombo; virtual INT_PTR CALLBACK run_dlgProc(UINT Message, WPARAM wParam, LPARAM lParam); - bool _canModifyName; - TCHAR _name[nameLenMax]; //normal name is plain text (for display purposes) - TCHAR _menuName[nameLenMax]; //menu name has ampersands for quick keys + bool _canModifyName = false; + TCHAR _name[nameLenMax] = {'\0'}; //normal name is plain text (for display purposes) + TCHAR _menuName[nameLenMax] = { '\0' }; //menu name has ampersands for quick keys void updateConflictState(const bool endSession = false) const; };