Code enhancement: Initialize variable member's value of struct/class

Close #10545
This commit is contained in:
Don Ho 2021-09-13 21:19:44 +02:00
parent 049ededf9f
commit a3116818e0
44 changed files with 209 additions and 224 deletions

View File

@ -18,8 +18,8 @@
#pragma once #pragma once
struct EncodingUnit { struct EncodingUnit {
int _codePage; int _codePage = 0;
const char *_aliasList; const char *_aliasList = nullptr;
}; };
class EncodingMapper { class EncodingMapper {

View File

@ -14,9 +14,7 @@
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>. // along with this program. If not, see <https://www.gnu.org/licenses/>.
#pragma once
#ifndef NPP_SORTERS_H
#define NPP_SORTERS_H
#include <algorithm> #include <algorithm>
#include <utility> #include <utility>
@ -26,8 +24,9 @@
class ISorter class ISorter
{ {
private: private:
bool _isDescending; bool _isDescending = true;
size_t _fromColumn, _toColumn; size_t _fromColumn = 0;
size_t _toColumn = 0;
protected: protected:
bool isDescending() const bool isDescending() const
@ -453,4 +452,3 @@ public:
} }
}; };
#endif //NPP_SORTERS_H

View File

@ -42,11 +42,11 @@ protected:
static void translate(unsigned code, EXCEPTION_POINTERS * info); static void translate(unsigned code, EXCEPTION_POINTERS * info);
private: private:
const char * _event; const char * _event = nullptr;
ExceptionAddress _location; ExceptionAddress _location;
unsigned int _code; unsigned int _code = 0;
EXCEPTION_POINTERS * _info; EXCEPTION_POINTERS * _info = nullptr;
}; };
@ -58,7 +58,7 @@ public:
private: private:
explicit Win32AccessViolation(EXCEPTION_POINTERS * info); explicit Win32AccessViolation(EXCEPTION_POINTERS * info);
bool _isWrite; bool _isWrite = false;
ExceptionAddress _badAddress; ExceptionAddress _badAddress;
friend void Win32Exception::translate(unsigned code, EXCEPTION_POINTERS* info); friend void Win32Exception::translate(unsigned code, EXCEPTION_POINTERS* info);

View File

@ -30,8 +30,8 @@ public:
bool isInRange(int id) { return (id >= _start && id < _nextID); } bool isInRange(int id) { return (id >= _start && id < _nextID); }
private: private:
int _start; int _start = 0;
int _nextID; int _nextID = 0;
int _maximumID; int _maximumID = 0;
}; };

View File

@ -26,9 +26,9 @@ typedef const TCHAR * (__cdecl * PFUNCGETNAME)();
struct NppData struct NppData
{ {
HWND _nppHandle; HWND _nppHandle = nullptr;
HWND _scintillaMainHandle; HWND _scintillaMainHandle = nullptr;
HWND _scintillaSecondHandle; HWND _scintillaSecondHandle = nullptr;
}; };
typedef void (__cdecl * PFUNCSETINFO)(NppData); typedef void (__cdecl * PFUNCSETINFO)(NppData);
@ -39,19 +39,19 @@ typedef LRESULT (__cdecl * PMESSAGEPROC)(UINT Message, WPARAM wParam, LPARAM lPa
struct ShortcutKey struct ShortcutKey
{ {
bool _isCtrl; bool _isCtrl = false;
bool _isAlt; bool _isAlt = false;
bool _isShift; bool _isShift = false;
UCHAR _key; UCHAR _key = 0;
}; };
struct FuncItem struct FuncItem
{ {
TCHAR _itemName[nbChar]; TCHAR _itemName[nbChar] = { '\0' };
PFUNCPLUGINCMD _pFunc; PFUNCPLUGINCMD _pFunc = nullptr;
int _cmdID; int _cmdID = 0;
bool _init2Check; bool _init2Check = false;
ShortcutKey *_pShKey; ShortcutKey *_pShKey = nullptr;
}; };
typedef FuncItem * (__cdecl * PFUNCGETFUNCSARRAY)(int *); typedef FuncItem * (__cdecl * PFUNCGETFUNCSARRAY)(int *);

View File

@ -27,8 +27,8 @@ typedef BOOL (__cdecl * PFUNCISUNICODE)();
struct PluginCommand struct PluginCommand
{ {
generic_string _pluginName; generic_string _pluginName;
int _funcID; int _funcID = 0;
PFUNCPLUGINCMD _pFunc; PFUNCPLUGINCMD _pFunc = nullptr;
PluginCommand(const TCHAR *pluginName, int funcID, PFUNCPLUGINCMD pFunc): _funcID(funcID), _pFunc(pFunc), _pluginName(pluginName){}; PluginCommand(const TCHAR *pluginName, int funcID, PFUNCPLUGINCMD pFunc): _funcID(funcID), _pFunc(pFunc), _pluginName(pluginName){};
}; };

View File

@ -94,16 +94,11 @@ struct VisibleGUIConf final
bool _isStatusbarShown = true; bool _isStatusbarShown = true;
//used by fullscreen //used by fullscreen
WINDOWPLACEMENT _winPlace; WINDOWPLACEMENT _winPlace = {0};
//used by distractionFree //used by distractionFree
bool _was2ViewModeOn = false; bool _was2ViewModeOn = false;
std::vector<DockingCont*> _pVisibleDockingContainers; std::vector<DockingCont*> _pVisibleDockingContainers;
VisibleGUIConf()
{
memset(&_winPlace, 0x0, sizeof(_winPlace));
}
}; };
struct QuoteParams struct QuoteParams
@ -267,8 +262,8 @@ public:
void refreshDarkMode(bool resetStyle = false); void refreshDarkMode(bool resetStyle = false);
private: private:
Notepad_plus_Window *_pPublicInterface = nullptr; Notepad_plus_Window* _pPublicInterface = nullptr;
Window *_pMainWindow = nullptr; Window* _pMainWindow = nullptr;
DockingManager _dockingManager; DockingManager _dockingManager;
std::vector<int> _internalFuncIDs; std::vector<int> _internalFuncIDs;
@ -331,8 +326,6 @@ private:
LastRecentFileList _lastRecentFileList; LastRecentFileList _lastRecentFileList;
//vector<iconLocator> _customIconVect;
WindowsMenu _windowsMenu; WindowsMenu _windowsMenu;
HMENU _mainMenuHandle = NULL; HMENU _mainMenuHandle = NULL;
@ -355,7 +348,7 @@ private:
RunMacroDlg _runMacroDlg; RunMacroDlg _runMacroDlg;
// For conflict detection when saving Macros or RunCommands // For conflict detection when saving Macros or RunCommands
ShortcutMapper * _pShortcutMapper = nullptr; ShortcutMapper* _pShortcutMapper = nullptr;
// For hotspot // For hotspot
bool _linkTriggered = true; bool _linkTriggered = true;

View File

@ -389,11 +389,11 @@ private:
//document properties //document properties
Document _doc; //invariable Document _doc; //invariable
LangType _lang; LangType _lang = L_TEXT;
generic_string _userLangExt; // it's useful if only (_lang == L_USER) generic_string _userLangExt; // it's useful if only (_lang == L_USER)
bool _isDirty = false; bool _isDirty = false;
EolType _eolFormat = EolType::osdefault; EolType _eolFormat = EolType::osdefault;
UniMode _unicodeMode; UniMode _unicodeMode = uniUTF8;
int _encoding = -1; int _encoding = -1;
bool _isUserReadOnly = false; bool _isUserReadOnly = false;
bool _needLexer = false; // new buffers do not need lexing, Scintilla takes care of that bool _needLexer = false; // new buffers do not need lexing, Scintilla takes care of that
@ -404,7 +404,7 @@ private:
std::vector<std::vector<size_t>> _foldStates; std::vector<std::vector<size_t>> _foldStates;
//Environment properties //Environment properties
DocFileStatus _currentStatus; DocFileStatus _currentStatus = DOC_REGULAR;
FILETIME _timeStamp = {}; // 0 if it's a new doc FILETIME _timeStamp = {}; // 0 if it's a new doc
bool _isFileReadOnly = false; bool _isFileReadOnly = false;

View File

@ -91,7 +91,7 @@ public :
}; };
private : private :
ScintillaEditView *_pView; ScintillaEditView *_pView = nullptr;
static bool _hideTabBarStatus; static bool _hideTabBarStatus;
std::vector<IconList *> _pIconListVector; std::vector<IconList *> _pIconListVector;

View File

@ -362,11 +362,11 @@ protected :
void combo2ExtendedMode(int comboID); void combo2ExtendedMode(int comboID);
private : private :
RECT _initialWindowRect; RECT _initialWindowRect = {0};
LONG _deltaWidth = 0; LONG _deltaWidth = 0;
LONG _initialClientWidth = 0; LONG _initialClientWidth = 0;
DIALOG_TYPE _currentStatus; DIALOG_TYPE _currentStatus = FIND_DLG;
RECT _findClosePos, _replaceClosePos, _findInFilesClosePos, _markClosePos; RECT _findClosePos, _replaceClosePos, _findInFilesClosePos, _markClosePos;
RECT _countInSelFramePos, _replaceInSelFramePos; RECT _countInSelFramePos, _replaceInSelFramePos;
RECT _countInSelCheckPos, _replaceInSelCheckPos; RECT _countInSelCheckPos, _replaceInSelCheckPos;
@ -384,10 +384,10 @@ private :
bool _isRTL = false; bool _isRTL = false;
int _findAllResult; int _findAllResult;
TCHAR _findAllResultStr[1024]; TCHAR _findAllResultStr[1024] = {'\0'};
int _fileNameLenMax = 1024; int _fileNameLenMax = 1024;
char *_uniFileName; char *_uniFileName = nullptr;
TabBar _tab; TabBar _tab;
winVer _winVer = winVer::WV_UNKNOWN; winVer _winVer = winVer::WV_UNKNOWN;
@ -453,7 +453,7 @@ public :
virtual void destroy(); virtual void destroy();
virtual void display(bool toShow = true) const; 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<LPARAM>(txt2find)); ::SendDlgItemMessage(_hSelf, IDC_INCFINDTEXT, WM_SETTEXT, 0, reinterpret_cast<LPARAM>(txt2find));
}; };
@ -463,13 +463,13 @@ public :
return _findStatus; return _findStatus;
} }
void addToRebar(ReBar * rebar); void addToRebar(ReBar* rebar);
private : private :
bool _isRTL = false; bool _isRTL = false;
FindReplaceDlg *_pFRDlg = nullptr; FindReplaceDlg *_pFRDlg = nullptr;
FindStatus _findStatus = FSFound; FindStatus _findStatus = FSFound;
ReBar * _pRebar = nullptr; ReBar* _pRebar = nullptr;
REBARBANDINFO _rbBand; REBARBANDINFO _rbBand;
virtual INT_PTR CALLBACK run_dlgProc(UINT message, WPARAM wParam, LPARAM lParam); virtual INT_PTR CALLBACK run_dlgProc(UINT message, WPARAM wParam, LPARAM lParam);

View File

@ -21,11 +21,11 @@
struct NPP_RangeToFormat { struct NPP_RangeToFormat {
HDC hdc; HDC hdc = nullptr;
HDC hdcTarget; HDC hdcTarget = nullptr;
RECT rc; RECT rc = { 0 };
RECT rcPage; RECT rcPage = { 0 };
Sci_CharacterRange chrg; Sci_CharacterRange chrg = { 0 };
}; };
class Printer class Printer

View File

@ -38,6 +38,7 @@ private:
std::vector<ScintillaEditView *> _scintVector; std::vector<ScintillaEditView *> _scintVector;
HINSTANCE _hInst = nullptr; HINSTANCE _hInst = nullptr;
HWND _hParent = nullptr; HWND _hParent = nullptr;
int getIndexFrom(HWND handle2Find); int getIndexFrom(HWND handle2Find);
}; };

View File

@ -134,14 +134,13 @@ const bool L2R = true;
const bool R2L = false; const bool R2L = false;
struct ColumnModeInfo { struct ColumnModeInfo {
int _selLpos; int _selLpos = 0;
int _selRpos; int _selRpos = 0;
int _order; // 0 based index int _order = -1; // 0 based index
bool _direction; // L2R or R2L bool _direction = L2R; // L2R or R2L
int _nbVirtualCaretSpc; int _nbVirtualCaretSpc = 0;
int _nbVirtualAnchorSpc; 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) 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){}; : _selLpos(lPos), _selRpos(rPos), _order(order), _direction(dir), _nbVirtualAnchorSpc(vAnchorNbSpc), _nbVirtualCaretSpc(vCaretNbSpc){};
@ -171,11 +170,11 @@ struct SortInPositionOrder {
typedef std::vector<ColumnModeInfo> ColumnModeInfos; typedef std::vector<ColumnModeInfo> ColumnModeInfos;
struct LanguageName { struct LanguageName {
const TCHAR * lexerName; const TCHAR * lexerName = nullptr;
const TCHAR * shortName; const TCHAR * shortName = nullptr;
const TCHAR * longName; const TCHAR * longName = nullptr;
LangType LangID; LangType LangID = L_TEXT;
int lexerID; int lexerID = 0;
}; };
#define URL_INDIC 8 #define URL_INDIC 8

View File

@ -28,5 +28,5 @@ public:
void highlightViewWithWord(ScintillaEditView * pHighlightView, const generic_string & word2Hilite); void highlightViewWithWord(ScintillaEditView * pHighlightView, const generic_string & word2Hilite);
private: private:
FindReplaceDlg * _pFRDlg; FindReplaceDlg * _pFRDlg = nullptr;
}; };

View File

@ -362,13 +362,13 @@ protected :
private : private :
ControlsTab _ctrlTab; ControlsTab _ctrlTab;
WindowVector _wVector; WindowVector _wVector;
UserLangContainer *_pCurrentUserLang; UserLangContainer *_pCurrentUserLang = nullptr;
FolderStyleDialog _folderStyleDlg; FolderStyleDialog _folderStyleDlg;
KeyWordsStyleDialog _keyWordsStyleDlg; KeyWordsStyleDialog _keyWordsStyleDlg;
CommentStyleDialog _commentStyleDlg; CommentStyleDialog _commentStyleDlg;
SymbolsStyleDialog _symbolsStyleDlg; SymbolsStyleDialog _symbolsStyleDlg;
bool _status = UNDOCK; bool _status = UNDOCK;
RECT _dlgPos; RECT _dlgPos = { 0 };
int _currentHight = 0; int _currentHight = 0;
int _yScrollPos = 0; int _yScrollPos = 0;
int _prevHightVal = 0; int _prevHightVal = 0;
@ -450,12 +450,12 @@ public:
static INT_PTR CALLBACK dlgProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam); static INT_PTR CALLBACK dlgProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam);
private: private:
HINSTANCE _hInst; HINSTANCE _hInst = nullptr;
HWND _parent; HWND _parent = nullptr;
int _stylerIndex; int _stylerIndex = 0;
int _enabledNesters; int _enabledNesters = 0;
ColourPicker * _pFgColour; ColourPicker * _pFgColour = nullptr;
ColourPicker * _pBgColour; ColourPicker * _pBgColour = nullptr;
Style _initialStyle; Style _initialStyle;
void move2CtrlRight(HWND hwndDlg, int ctrlID, HWND handle2Move, int handle2MoveWidth, int handle2MoveHeight); void move2CtrlRight(HWND hwndDlg, int ctrlID, HWND handle2Move, int handle2MoveWidth, int handle2MoveHeight);

View File

@ -22,9 +22,6 @@
class URLCtrl : public Window { class URLCtrl : public Window {
public: 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, const TCHAR * link, COLORREF linkColor = RGB(0,0,255));
void create(HWND itemHandle, int cmd, HWND msgDest = NULL); void create(HWND itemHandle, int cmd, HWND msgDest = NULL);
void destroy(); void destroy();
@ -32,16 +29,16 @@ private:
void action(); void action();
protected : protected :
generic_string _URL; generic_string _URL;
HFONT _hfUnderlined; HFONT _hfUnderlined = nullptr;
HCURSOR _hCursor; HCURSOR _hCursor = nullptr;
HWND _msgDest; HWND _msgDest = nullptr;
unsigned long _cmdID; unsigned long _cmdID = 0;
WNDPROC _oldproc; WNDPROC _oldproc = nullptr;
COLORREF _linkColor; COLORREF _linkColor = RGB(0xFF, 0xFF, 0xFF);
COLORREF _visitedColor; COLORREF _visitedColor = RGB(0xFF, 0xFF, 0xFF);
bool _clicking; bool _clicking = false;
static LRESULT CALLBACK URLCtrlProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam){ static LRESULT CALLBACK URLCtrlProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam){
return ((URLCtrl *)(::GetWindowLongPtr(hwnd, GWLP_USERDATA)))->runProc(hwnd, Message, wParam, lParam); return ((URLCtrl *)(::GetWindowLongPtr(hwnd, GWLP_USERDATA)))->runProc(hwnd, Message, wParam, lParam);

View File

@ -29,19 +29,18 @@ class ScintillaEditView;
class ByteArray { class ByteArray {
public: public:
ByteArray():_pBytes(NULL), _length(0) {}; ByteArray() = default;
explicit ByteArray(ClipboardData cd); explicit ByteArray(ClipboardData cd);
~ByteArray() { ~ByteArray() {
if (_pBytes)
delete [] _pBytes; delete [] _pBytes;
_pBytes = NULL;
_length = 0;
}; };
const unsigned char * getPointer() const {return _pBytes;}; const unsigned char * getPointer() const {return _pBytes;};
size_t getLength() const {return _length;}; size_t getLength() const {return _length;};
protected: protected:
unsigned char *_pBytes; unsigned char *_pBytes = nullptr;
size_t _length; size_t _length = 0;
}; };
class StringArray : public ByteArray { class StringArray : public ByteArray {
@ -79,11 +78,11 @@ protected:
virtual INT_PTR CALLBACK run_dlgProc(UINT message, WPARAM wParam, LPARAM lParam); virtual INT_PTR CALLBACK run_dlgProc(UINT message, WPARAM wParam, LPARAM lParam);
private: private:
ScintillaEditView **_ppEditView; ScintillaEditView **_ppEditView = nullptr;
std::vector<ClipboardData> _clipboardDataVector; std::vector<ClipboardData> _clipboardDataVector;
HWND _hwndNextCbViewer; HWND _hwndNextCbViewer = nullptr;
int _lbBgColor; int _lbBgColor = -1;
int _lbFgColor; int _lbFgColor= -1;
}; };

View File

@ -58,9 +58,8 @@ public :
COLORREF getSelColour(){return _colour;}; COLORREF getSelColour(){return _colour;};
private : private :
RECT _rc; RECT _rc = {0};
COLORREF _colour; COLORREF _colour = RGB(0xFF, 0xFF, 0xFF);
//bool isColourChooserLaunched = false;
static INT_PTR CALLBACK dlgProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam); static INT_PTR CALLBACK dlgProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam);
INT_PTR CALLBACK run_dlgProc(UINT message, WPARAM wParam, LPARAM lParam); INT_PTR CALLBACK run_dlgProc(UINT message, WPARAM wParam, LPARAM lParam);

View File

@ -45,8 +45,8 @@ public :
_oldProc = reinterpret_cast<WNDPROC>(::SetWindowLongPtr(staticHandle, GWLP_WNDPROC, reinterpret_cast<LONG_PTR>(staticProc))); _oldProc = reinterpret_cast<WNDPROC>(::SetWindowLongPtr(staticHandle, GWLP_WNDPROC, reinterpret_cast<LONG_PTR>(staticProc)));
}; };
private : private :
COLORREF _colour; COLORREF _colour = RGB(0xFF, 0xFF, 0xFF);
WNDPROC _oldProc; WNDPROC _oldProc = nullptr;
static LRESULT CALLBACK staticProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam){ static LRESULT CALLBACK staticProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam){
ColourStaticTextHooker *pColourStaticTextHooker = reinterpret_cast<ColourStaticTextHooker *>(::GetWindowLongPtr(hwnd, GWLP_USERDATA)); ColourStaticTextHooker *pColourStaticTextHooker = reinterpret_cast<ColourStaticTextHooker *>(::GetWindowLongPtr(hwnd, GWLP_USERDATA));

View File

@ -47,25 +47,25 @@
typedef struct { typedef struct {
HWND hClient; // client Window Handle HWND hClient = nullptr; // client Window Handle
const TCHAR *pszName; // name of plugin (shown in window) const TCHAR* pszName = nullptr; // name of plugin (shown in window)
int dlgID; // a funcItem provides the function pointer to start a dialog. Please parse here these ID int dlgID = 0; // a funcItem provides the function pointer to start a dialog. Please parse here these ID
// user modifications // user modifications
UINT uMask; // mask params: look to above defines UINT uMask = 0; // mask params: look to above defines
HICON hIconTab; // icon for tabs HICON hIconTab = nullptr; // icon for tabs
const TCHAR *pszAddInfo; // for plugin to display additional informations const TCHAR* pszAddInfo = nullptr; // for plugin to display additional informations
// internal data, do not use !!! // internal data, do not use !!!
RECT rcFloat; // floating position RECT rcFloat = {0}; // floating position
int iPrevCont; // stores the privious container (toggling between float and dock) int iPrevCont = 0; // 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 const TCHAR* pszModuleName = nullptr; // it's the plugin file name. It's used to identify the plugin
} tTbData; } tTbData;
typedef struct { typedef struct {
HWND hWnd; // the docking manager wnd HWND hWnd = nullptr; // the docking manager wnd
RECT rcRegion[DOCKCONT_MAX]; // position of docked dialogs RECT rcRegion[DOCKCONT_MAX] = {{0}}; // position of docked dialogs
} tDockMgr; } tDockMgr;

View File

@ -172,53 +172,53 @@ protected :
private: private:
// handles // handles
BOOL _isActive; BOOL _isActive = FALSE;
bool _isFloating; bool _isFloating = FALSE;
HWND _hCaption; HWND _hCaption = nullptr;
HWND _hContTab; HWND _hContTab = nullptr;
// horizontal font for caption and tab // horizontal font for caption and tab
HFONT _hFont; HFONT _hFont = nullptr;
// caption params // caption params
BOOL _isTopCaption; BOOL _isTopCaption = FALSE;
generic_string _pszCaption; generic_string _pszCaption;
BOOL _isMouseDown; BOOL _isMouseDown = FALSE;
BOOL _isMouseClose; BOOL _isMouseClose = FALSE;
BOOL _isMouseOver; BOOL _isMouseOver = FALSE;
RECT _rcCaption; RECT _rcCaption = {0};
// tab style // tab style
BOOL _bDrawOgLine; BOOL _bDrawOgLine = FALSE;
// Important value for DlgMoving class // Important value for DlgMoving class
BOOL _dragFromTab; BOOL _dragFromTab = FALSE;
// subclassing handle for caption // subclassing handle for caption
WNDPROC _hDefaultCaptionProc; WNDPROC _hDefaultCaptionProc = nullptr;
// subclassing handle for tab // subclassing handle for tab
WNDPROC _hDefaultTabProc; WNDPROC _hDefaultTabProc = nullptr;
// for moving and reordering // for moving and reordering
UINT _prevItem; UINT _prevItem = 0;
BOOL _beginDrag; BOOL _beginDrag = FALSE;
// Is tooltip // Is tooltip
BOOL _bTabTTHover; BOOL _bTabTTHover = FALSE;
INT _iLastHovered; INT _iLastHovered = 0;
BOOL _bCaptionTT; BOOL _bCaptionTT = FALSE;
BOOL _bCapTTHover; BOOL _bCapTTHover = FALSE;
eMousePos _hoverMPos; eMousePos _hoverMPos = posOutside;
int _captionHeightDynamic = HIGH_CAPTION; int _captionHeightDynamic = HIGH_CAPTION;
int _captionGapDynamic = CAPTION_GAP; int _captionGapDynamic = CAPTION_GAP;
int _closeButtonPosLeftDynamic = CLOSEBTN_POS_LEFT; int _closeButtonPosLeftDynamic = CLOSEBTN_POS_LEFT;
int _closeButtonPosTopDynamic = CLOSEBTN_POS_TOP; int _closeButtonPosTopDynamic = CLOSEBTN_POS_TOP;
int _closeButtonWidth; int _closeButtonWidth = 12;
int _closeButtonHeight; int _closeButtonHeight = 12;
// data of added windows // data of added windows
std::vector<tTbData *> _vTbData; std::vector<tTbData *> _vTbData;

View File

@ -85,8 +85,8 @@ public :
private : private :
Window **_ppWindow = nullptr; Window **_ppWindow = nullptr;
RECT _rcWork; RECT _rcWork = { 0 };
RECT _rect; RECT _rect = { 0 };
Window **_ppMainWindow = nullptr; Window **_ppMainWindow = nullptr;
std::vector<HWND> _vImageList; std::vector<HWND> _vImageList;
HIMAGELIST _hImageList = nullptr; HIMAGELIST _hImageList = nullptr;
@ -94,8 +94,8 @@ private :
tDockMgr _dockData; tDockMgr _dockData;
static BOOL _isRegistered; static BOOL _isRegistered;
BOOL _isInitialized = FALSE; BOOL _isInitialized = FALSE;
int _iContMap[CONT_MAP_MAX]; int _iContMap[CONT_MAP_MAX] = { 0 };
std::vector<DockingSplitter *> _vSplitter; std::vector<DockingSplitter*> _vSplitter;
static LRESULT CALLBACK staticWinProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam); static LRESULT CALLBACK staticWinProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam);

View File

@ -87,8 +87,8 @@ private :
HWND _viewZoneCanvas = nullptr; HWND _viewZoneCanvas = nullptr;
WNDPROC _canvasDefaultProc = nullptr; WNDPROC _canvasDefaultProc = nullptr;
long _higherY; long _higherY = 0;
long _lowerY; long _lowerY = 0;
}; };
@ -141,8 +141,8 @@ protected:
bool needToRecomputeWith(const ScintillaEditView *editView = nullptr); bool needToRecomputeWith(const ScintillaEditView *editView = nullptr);
private: private:
ScintillaEditView **_ppEditView = nullptr; ScintillaEditView**_ppEditView = nullptr;
ScintillaEditView *_pMapView = nullptr; ScintillaEditView*_pMapView = nullptr;
ViewZoneDlg _vzDlg; ViewZoneDlg _vzDlg;
HWND _hwndScintilla; HWND _hwndScintilla;
bool _isTemporarilyShowing = false; bool _isTemporarilyShowing = false;

View File

@ -79,7 +79,7 @@ public:
private: private:
std::vector<FolderInfo> _subFolders; std::vector<FolderInfo> _subFolders;
std::vector<FileInfo> _files; std::vector<FileInfo> _files;
FolderInfo *_parent = nullptr; FolderInfo*_parent = nullptr;
generic_string _name; generic_string _name;
generic_string _rootPath; // set only for root folder; empty for normal folder generic_string _rootPath; // set only for root folder; empty for normal folder
}; };
@ -99,7 +99,7 @@ public:
private: private:
FolderInfo _rootFolder; FolderInfo _rootFolder;
FileBrowser *_pFileBrowser = nullptr; FileBrowser*_pFileBrowser = nullptr;
HANDLE _watchThreadHandle = nullptr; HANDLE _watchThreadHandle = nullptr;
HANDLE _EventHandle = nullptr; HANDLE _EventHandle = nullptr;
static DWORD WINAPI watching(void *param); static DWORD WINAPI watching(void *param);

View File

@ -50,10 +50,7 @@ root
struct SearchParameters { struct SearchParameters {
generic_string _text2Find; generic_string _text2Find;
bool _doSort; bool _doSort = false;
SearchParameters(): _text2Find(TEXT("")), _doSort(false){
};
bool hasParams()const{ bool hasParams()const{
return (_text2Find != TEXT("") || _doSort); return (_text2Find != TEXT("") || _doSort);
@ -113,7 +110,7 @@ private:
SCROLLINFO si; SCROLLINFO si;
long _findLine = -1; long _findLine = -1;
long _findEndLine = -1; long _findEndLine = -1;
HTREEITEM _findItem; HTREEITEM _findItem = nullptr;
generic_string _sortTipStr = TEXT("Sort"); generic_string _sortTipStr = TEXT("Sort");
generic_string _reloadTipStr = TEXT("Reload"); generic_string _reloadTipStr = TEXT("Reload");
@ -126,7 +123,7 @@ private:
FunctionParsersManager _funcParserMgr; FunctionParsersManager _funcParserMgr;
std::vector< std::pair<int, int> > _skipZones; std::vector< std::pair<int, int> > _skipZones;
std::vector<TreeParams> _treeParams; std::vector<TreeParams> _treeParams;
HIMAGELIST _hTreeViewImaLst; HIMAGELIST _hTreeViewImaLst = nullptr;
generic_string parseSubLevel(size_t begin, size_t end, std::vector< generic_string > dataToSearch, int & foundPos); 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); size_t getBodyClosePos(size_t begin, const TCHAR *bodyOpenSymbol, const TCHAR *bodyCloseSymbol);

View File

@ -97,8 +97,8 @@
#define BGM_SETHILIGHTCOLOR_PROTECT_NOFOCUS BABYGRID_USER + 50 #define BGM_SETHILIGHTCOLOR_PROTECT_NOFOCUS BABYGRID_USER + 50
struct _BGCELL { struct _BGCELL {
int row; int row = 0;
int col; int col = 0;
}; };

View File

@ -88,11 +88,11 @@ private:
GFONT_ROWS, GFONT_ROWS,
MAX_GRID_FONTS MAX_GRID_FONTS
}; };
LONG _clientWidth; LONG _clientWidth = 0;
LONG _clientHeight; LONG _clientHeight = 0;
LONG _initClientWidth; LONG _initClientWidth = 0;
LONG _initClientHeight; LONG _initClientHeight = 0;
bool _dialogInitDone; bool _dialogInitDone = false;
void initTabs(); void initTabs();
void initBabyGrid(); void initBabyGrid();

View File

@ -84,12 +84,12 @@ struct PluginUpdateInfo
struct NppCurrentStatus 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) 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) // 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 _nppInstallPath;
generic_string _appdataPath; generic_string _appdataPath;

View File

@ -88,7 +88,7 @@ private :
struct LangID_Name struct LangID_Name
{ {
LangType _id; LangType _id = L_TEXT;
generic_string _name; generic_string _name;
LangID_Name(LangType id, const generic_string& name) : _id(id), _name(name){}; LangID_Name(LangType id, const generic_string& name) : _id(id), _name(name){};
}; };
@ -224,7 +224,8 @@ public :
private : private :
POINT _singleLineModePoint, _multiLineModePoint; POINT _singleLineModePoint, _multiLineModePoint;
RECT _closerRect, _closerLabelRect; RECT _closerRect = { 0 };
RECT _closerLabelRect = { 0 };
HWND _tip = nullptr; HWND _tip = nullptr;
INT_PTR CALLBACK run_dlgProc(UINT message, WPARAM wParam, LPARAM lParam); INT_PTR CALLBACK run_dlgProc(UINT message, WPARAM wParam, LPARAM lParam);

View File

@ -145,11 +145,11 @@ public:
unsigned int GetThreadId() { return m_dwThreadId; } unsigned int GetThreadId() { return m_dwThreadId; }
protected: 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<TDirectoryChangeNotification> m_Notifications; CThreadSafeQueue<TDirectoryChangeNotification> m_Notifications;
}; };

View File

@ -75,12 +75,12 @@ protected:
LPOVERLAPPED lpOverlapped); // I/O information buffer LPOVERLAPPED lpOverlapped); // I/O information buffer
// Parameters from the caller for ReadDirectoryChangesW(). // Parameters from the caller for ReadDirectoryChangesW().
DWORD m_dwFilterFlags; DWORD m_dwFilterFlags = 0;
BOOL m_bIncludeChildren; BOOL m_bIncludeChildren = FALSE;
std::wstring m_wstrDirectory; std::wstring m_wstrDirectory;
// Result of calling CreateFile(). // Result of calling CreateFile().
HANDLE m_hDirectory; HANDLE m_hDirectory = nullptr;
// Required parameter for ReadDirectoryChangesW(). // Required parameter for ReadDirectoryChangesW().
OVERLAPPED m_Overlapped; OVERLAPPED m_Overlapped;
@ -130,7 +130,7 @@ public:
pRequest->m_pServer->AddDirectory(pRequest); pRequest->m_pServer->AddDirectory(pRequest);
} }
CReadDirectoryChanges* m_pBase; CReadDirectoryChanges* m_pBase = nullptr;
volatile DWORD m_nOutstandingRequests; volatile DWORD m_nOutstandingRequests;
@ -171,7 +171,7 @@ protected:
vector<CReadChangesRequest*> m_pBlocks; vector<CReadChangesRequest*> m_pBlocks;
bool m_bTerminate; bool m_bTerminate = false;
}; };
} }

View File

@ -21,9 +21,9 @@ public:
void Terminate(); void Terminate();
private: private:
LPCTSTR _szFile; LPCTSTR _szFile = nullptr;
DWORD _dwNotifyFilter; DWORD _dwNotifyFilter = 0;
WIN32_FILE_ATTRIBUTE_DATA _lastFileInfo; WIN32_FILE_ATTRIBUTE_DATA _lastFileInfo = { 0 };
}; };

View File

@ -79,6 +79,6 @@ public:
HANDLE GetWaitHandle() { return m_hEvent; } HANDLE GetWaitHandle() { return m_hEvent; }
protected: protected:
HANDLE m_hEvent; HANDLE m_hEvent = nullptr;
std::mutex m_mutex; std::mutex m_mutex;
}; };

View File

@ -81,7 +81,8 @@ private:
static bool _isHorizontalFixedRegistered; static bool _isHorizontalFixedRegistered;
static bool _isVerticalFixedRegistered; static bool _isVerticalFixedRegistered;
RECT _clickZone2TL, _clickZone2BR; RECT _clickZone2TL = { 0 };
RECT _clickZone2BR = { 0 };
static LRESULT CALLBACK staticWndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam); static LRESULT CALLBACK staticWndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
LRESULT CALLBACK spliterWndProc(UINT uMsg, WPARAM wParam, LPARAM lParam); LRESULT CALLBACK spliterWndProc(UINT uMsg, WPARAM wParam, LPARAM lParam);

View File

@ -23,16 +23,16 @@ enum class PosAlign { left, right, top, bottom };
struct DLGTEMPLATEEX struct DLGTEMPLATEEX
{ {
WORD dlgVer; WORD dlgVer = 0;
WORD signature; WORD signature = 0;
DWORD helpID; DWORD helpID = 0;
DWORD exStyle; DWORD exStyle = 0;
DWORD style; DWORD style = 0;
WORD cDlgItems; WORD cDlgItems = 0;
short x; short x = 0;
short y; short y = 0;
short cx; short cx = 0;
short cy; short cy = 0;
// The structure has more fields but are variable length // The structure has more fields but are variable length
}; };
@ -68,7 +68,7 @@ public :
virtual void destroy() override; virtual void destroy() override;
protected: protected:
RECT _rc; RECT _rc = { 0 };
static INT_PTR CALLBACK dlgProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam); 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; virtual INT_PTR CALLBACK run_dlgProc(UINT message, WPARAM wParam, LPARAM lParam) = 0;

View File

@ -123,8 +123,8 @@ struct CloseButtonZone
bool isHit(int x, int y, const RECT & tabRect, bool isVertical) const; bool isHit(int x, int y, const RECT & tabRect, bool isVertical) const;
RECT getButtonRectFrom(const RECT & tabRect, bool isVertical) const; RECT getButtonRectFrom(const RECT & tabRect, bool isVertical) const;
int _width; int _width = 0;
int _height; int _height = 0;
}; };

View File

@ -51,7 +51,7 @@ public:
protected: protected:
WNDPROC _defaultProc; WNDPROC _defaultProc = nullptr;
LRESULT runProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam); LRESULT runProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam);
static LRESULT CALLBACK staticProc(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; HFONT _hFontSelected = nullptr;
int _nbItem = 0; int _nbItem = 0;
int _currentIndex = 0; int _currentIndex = 0;
RECT _rc; RECT _rc = { 0 };
}; };

View File

@ -34,8 +34,8 @@ enum toolBarStatusType {TB_SMALL, TB_LARGE, TB_SMALL2, TB_LARGE2, TB_STANDARD};
struct iconLocator { struct iconLocator {
int listIndex; int listIndex = 0;
int iconIndex; int iconIndex = 0;
generic_string iconLocation; generic_string iconLocation;
iconLocator(int iList, int iIcon, const generic_string& iconLoc) iconLocator(int iList, int iIcon, const generic_string& iconLoc)

View File

@ -35,6 +35,6 @@ public:
private: private:
NOTIFYICONDATA _nid; NOTIFYICONDATA _nid;
bool _isIconShowed; bool _isIconShowed = false;
}; };

View File

@ -24,8 +24,8 @@
struct TreeStateNode { struct TreeStateNode {
generic_string _label; generic_string _label;
generic_string _extraData; generic_string _extraData;
bool _isExpanded; bool _isExpanded = false;
bool _isSelected; bool _isSelected = false;
std::vector<TreeStateNode> _children; std::vector<TreeStateNode> _children;
}; };
@ -118,7 +118,7 @@ public:
void customSorting(HTREEITEM hTreeItem, PFNTVCOMPARE sortingCallbackFunc, LPARAM lParam, bool isRecursive); void customSorting(HTREEITEM hTreeItem, PFNTVCOMPARE sortingCallbackFunc, LPARAM lParam, bool isRecursive);
protected: protected:
WNDPROC _defaultProc; WNDPROC _defaultProc = nullptr;
LRESULT runProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam); LRESULT runProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam);
static LRESULT CALLBACK staticProc(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); bool searchLeafRecusivelyAndBuildTree(HTREEITEM tree2Build, const generic_string & text2Search, int index2Search, HTREEITEM tree2Search);
// Drag and Drop operations // Drag and Drop operations
HTREEITEM _draggedItem; HTREEITEM _draggedItem = nullptr;
HIMAGELIST _draggedImageList; HIMAGELIST _draggedImageList = nullptr;
bool _isItemDragged = false; bool _isItemDragged = false;
std::vector<int> _canNotDragOutList; std::vector<int> _canNotDragOutList;
std::vector<int> _canNotDropInList; std::vector<int> _canNotDropInList;

View File

@ -24,9 +24,9 @@
#define FS_PROJECTPANELTITLE TEXT("Document List") #define FS_PROJECTPANELTITLE TEXT("Document List")
struct sortCompareData { struct sortCompareData {
HWND hListView; HWND hListView = nullptr;
int columnIndex; int columnIndex = 0;
int sortDirection; int sortDirection = 0;
}; };
class VerticalFileSwitcher : public DockingDlgInterface { class VerticalFileSwitcher : public DockingDlgInterface {

View File

@ -33,8 +33,8 @@ typedef Buffer * BufferID; //each buffer has unique ID by which it can be retrie
#define FS_CLMNPATH "ColumnPath" #define FS_CLMNPATH "ColumnPath"
struct SwitcherFileInfo { struct SwitcherFileInfo {
BufferID _bufID; BufferID _bufID = 0;
int _iView; int _iView = 0;
SwitcherFileInfo() = delete; SwitcherFileInfo() = delete;
SwitcherFileInfo(BufferID buf, int view) : _bufID(buf), _iView(view){}; SwitcherFileInfo(BufferID buf, int view) : _bufID(buf), _iView(view){};

View File

@ -34,11 +34,11 @@ typedef enum {
struct NMWINDLG : public NMHDR { struct NMWINDLG : public NMHDR {
BOOL processed; BOOL processed = FALSE;
WinDlgNotifyType type; WinDlgNotifyType type = WDT_ACTIVATE;
UINT curSel; UINT curSel = 0;
UINT nItems; UINT nItems = 0;
UINT *Items; UINT *Items = 0;
// ctor: initialize to zeroes // ctor: initialize to zeroes
NMWINDLG() { memset(this,0,sizeof(NMWINDLG)); } NMWINDLG() { memset(this,0,sizeof(NMWINDLG)); }
@ -83,8 +83,8 @@ protected :
HWND _hList = nullptr; HWND _hList = nullptr;
static RECT _lastKnownLocation; static RECT _lastKnownLocation;
SIZE _szMinButton; SIZE _szMinButton = { 0 };
SIZE _szMinListCtrl; SIZE _szMinListCtrl = { 0 };
DocTabView *_pTab = nullptr; DocTabView *_pTab = nullptr;
std::vector<int> _idxMap; std::vector<int> _idxMap;
int _currentColumn = -1; int _currentColumn = -1;

View File

@ -58,10 +58,10 @@ static size_t keyTranslate(size_t keyIn) {
}; };
struct KeyCombo { struct KeyCombo {
bool _isCtrl; bool _isCtrl = false;
bool _isAlt; bool _isAlt = false;
bool _isShift; bool _isShift = false;
UCHAR _key; UCHAR _key = 0;
}; };
class Shortcut : public StaticDialog { class Shortcut : public StaticDialog {
@ -175,9 +175,9 @@ public:
protected : protected :
KeyCombo _keyCombo; KeyCombo _keyCombo;
virtual INT_PTR CALLBACK run_dlgProc(UINT Message, WPARAM wParam, LPARAM lParam); virtual INT_PTR CALLBACK run_dlgProc(UINT Message, WPARAM wParam, LPARAM lParam);
bool _canModifyName; bool _canModifyName = false;
TCHAR _name[nameLenMax]; //normal name is plain text (for display purposes) TCHAR _name[nameLenMax] = {'\0'}; //normal name is plain text (for display purposes)
TCHAR _menuName[nameLenMax]; //menu name has ampersands for quick keys TCHAR _menuName[nameLenMax] = { '\0' }; //menu name has ampersands for quick keys
void updateConflictState(const bool endSession = false) const; void updateConflictState(const bool endSession = false) const;
}; };