From 25be5dd3b615ec93624b3c15ee8f609a68d215a7 Mon Sep 17 00:00:00 2001 From: Don Ho Date: Mon, 6 Mar 2023 19:33:36 +0100 Subject: [PATCH] Code enhancement: remove some MSVS analysis warning (Part 2) --- PowerEditor/src/ScintillaComponent/DocTabView.cpp | 2 +- PowerEditor/src/ScintillaComponent/DocTabView.h | 4 ++-- PowerEditor/src/ScintillaComponent/ScintillaEditView.cpp | 2 +- PowerEditor/src/ScintillaComponent/ScintillaEditView.h | 2 +- PowerEditor/src/WinControls/DocumentMap/documentSnapshot.cpp | 4 ++-- PowerEditor/src/WinControls/DocumentMap/documentSnapshot.h | 4 ++-- PowerEditor/src/WinControls/FunctionList/functionParser.cpp | 4 ++-- PowerEditor/src/WinControls/FunctionList/functionParser.h | 4 ++-- PowerEditor/src/WinControls/SplitterContainer/Splitter.h | 2 +- PowerEditor/src/WinControls/StatusBar/StatusBar.h | 4 ++-- PowerEditor/src/WinControls/TreeView/TreeView.cpp | 2 +- PowerEditor/src/WinControls/TreeView/TreeView.h | 2 +- PowerEditor/src/winmain.cpp | 2 +- 13 files changed, 19 insertions(+), 19 deletions(-) diff --git a/PowerEditor/src/ScintillaComponent/DocTabView.cpp b/PowerEditor/src/ScintillaComponent/DocTabView.cpp index ffae54b24..1d71d8870 100644 --- a/PowerEditor/src/ScintillaComponent/DocTabView.cpp +++ b/PowerEditor/src/ScintillaComponent/DocTabView.cpp @@ -160,7 +160,7 @@ void DocTabView::bufferUpdated(Buffer * buffer, int mask) if (mask & BufferChangeFilename) { tie.mask |= TCIF_TEXT; - tie.pszText = const_cast(encodedLabel); + tie.pszText = encodedLabel; { const TCHAR* in = buffer->getFileName(); diff --git a/PowerEditor/src/ScintillaComponent/DocTabView.h b/PowerEditor/src/ScintillaComponent/DocTabView.h index 324152796..0c9231eda 100644 --- a/PowerEditor/src/ScintillaComponent/DocTabView.h +++ b/PowerEditor/src/ScintillaComponent/DocTabView.h @@ -30,7 +30,7 @@ public : DocTabView():TabBarPlus(), _pView(NULL) {}; virtual ~DocTabView(){}; - virtual void destroy() override { + void destroy() override { TabBarPlus::destroy(); }; @@ -84,7 +84,7 @@ public : return _hideTabBarStatus; }; - virtual void reSizeTo(RECT & rc) override; + void reSizeTo(RECT & rc) override; const ScintillaEditView* getScintillaEditView() const { return _pView; diff --git a/PowerEditor/src/ScintillaComponent/ScintillaEditView.cpp b/PowerEditor/src/ScintillaComponent/ScintillaEditView.cpp index 32bc02776..358b2f1a8 100644 --- a/PowerEditor/src/ScintillaComponent/ScintillaEditView.cpp +++ b/PowerEditor/src/ScintillaComponent/ScintillaEditView.cpp @@ -551,7 +551,7 @@ void ScintillaEditView::setSpecialStyle(const Style & styleToSet) execute(SCI_STYLESETSIZE, styleID, styleToSet._fontSize); } -void ScintillaEditView::setHotspotStyle(Style& styleToSet) +void ScintillaEditView::setHotspotStyle(const Style& styleToSet) { StyleMap* styleMap; if ( _hotspotStyles.find(_currentBuffer) == _hotspotStyles.end() ) diff --git a/PowerEditor/src/ScintillaComponent/ScintillaEditView.h b/PowerEditor/src/ScintillaComponent/ScintillaEditView.h index 7112ba7bb..1a8fefe06 100644 --- a/PowerEditor/src/ScintillaComponent/ScintillaEditView.h +++ b/PowerEditor/src/ScintillaComponent/ScintillaEditView.h @@ -665,7 +665,7 @@ public: scintillaNew_Proc(_hSelf, WM_MOUSEWHEEL, wParam, lParam); }; - void setHotspotStyle(Style& styleToSet); + void setHotspotStyle(const Style& styleToSet); void setTabSettings(Lang *lang); bool isWrapRestoreNeeded() const {return _wrapRestoreNeeded;}; void setWrapRestoreNeeded(bool isWrapRestoredNeeded) {_wrapRestoreNeeded = isWrapRestoredNeeded;}; diff --git a/PowerEditor/src/WinControls/DocumentMap/documentSnapshot.cpp b/PowerEditor/src/WinControls/DocumentMap/documentSnapshot.cpp index 7f95bacc0..4ed1783b8 100644 --- a/PowerEditor/src/WinControls/DocumentMap/documentSnapshot.cpp +++ b/PowerEditor/src/WinControls/DocumentMap/documentSnapshot.cpp @@ -40,7 +40,7 @@ intptr_t CALLBACK DocumentPeeker::run_dlgProc(UINT message, WPARAM /*wParam*/, L return FALSE; } -void DocumentPeeker::doDialog(POINT p, Buffer *pBuf, ScintillaEditView & scintSource) +void DocumentPeeker::doDialog(POINT p, Buffer *pBuf, const ScintillaEditView & scintSource) { if (!isCreated()) { @@ -58,7 +58,7 @@ void DocumentPeeker::goTo(POINT p) } -void DocumentPeeker::syncDisplay(Buffer *buf, ScintillaEditView & scintSource) +void DocumentPeeker::syncDisplay(Buffer *buf, const ScintillaEditView & scintSource) { if (_pPeekerView) { diff --git a/PowerEditor/src/WinControls/DocumentMap/documentSnapshot.h b/PowerEditor/src/WinControls/DocumentMap/documentSnapshot.h index 6dbcc653a..d0fefcd66 100644 --- a/PowerEditor/src/WinControls/DocumentMap/documentSnapshot.h +++ b/PowerEditor/src/WinControls/DocumentMap/documentSnapshot.h @@ -33,8 +33,8 @@ public: Window::init(hInst, hPere); }; - void doDialog(POINT p, Buffer *buf, ScintillaEditView & scintSource); - void syncDisplay(Buffer *buf, ScintillaEditView & scintSource); + void doDialog(POINT p, Buffer *buf, const ScintillaEditView & scintSource); + void syncDisplay(Buffer *buf, const ScintillaEditView & scintSource); void setParent(HWND parent2set){ _hParent = parent2set; diff --git a/PowerEditor/src/WinControls/FunctionList/functionParser.cpp b/PowerEditor/src/WinControls/FunctionList/functionParser.cpp index 806a2dd36..64795385e 100644 --- a/PowerEditor/src/WinControls/FunctionList/functionParser.cpp +++ b/PowerEditor/src/WinControls/FunctionList/functionParser.cpp @@ -139,7 +139,7 @@ bool FunctionParsersManager::getUnitPaserParameters(TiXmlNode *functionParser, g } -bool FunctionParsersManager::loadFuncListFromXmlTree(generic_string & xmlDirPath, LangType lType, const generic_string& overrideId, int udlIndex) +bool FunctionParsersManager::loadFuncListFromXmlTree(const generic_string & xmlDirPath, LangType lType, const generic_string& overrideId, int udlIndex) { generic_string funcListRulePath = xmlDirPath; funcListRulePath += TEXT("\\"); @@ -241,7 +241,7 @@ bool FunctionParsersManager::loadFuncListFromXmlTree(generic_string & xmlDirPath return true; } -bool FunctionParsersManager::getOverrideMapFromXmlTree(generic_string & xmlDirPath) +bool FunctionParsersManager::getOverrideMapFromXmlTree(const generic_string & xmlDirPath) { generic_string funcListRulePath = xmlDirPath; funcListRulePath += TEXT("\\overrideMap.xml"); diff --git a/PowerEditor/src/WinControls/FunctionList/functionParser.h b/PowerEditor/src/WinControls/FunctionList/functionParser.h index 5344ec6ae..b1adda269 100644 --- a/PowerEditor/src/WinControls/FunctionList/functionParser.h +++ b/PowerEditor/src/WinControls/FunctionList/functionParser.h @@ -159,8 +159,8 @@ private: ParserInfo* _parsers[L_EXTERNAL + nbMaxUserDefined] = {nullptr}; int _currentUDIndex = L_EXTERNAL; - bool getOverrideMapFromXmlTree(generic_string & xmlDirPath); - bool loadFuncListFromXmlTree(generic_string & xmlDirPath, LangType lType, const generic_string& overrideId, int udlIndex = -1); + bool getOverrideMapFromXmlTree(const generic_string & xmlDirPath); + bool loadFuncListFromXmlTree(const generic_string & xmlDirPath, LangType lType, const generic_string& overrideId, int udlIndex = -1); bool getZonePaserParameters(TiXmlNode *classRangeParser, generic_string &mainExprStr, generic_string &openSymboleStr, generic_string &closeSymboleStr, std::vector &classNameExprArray, generic_string &functionExprStr, std::vector &functionNameExprArray); bool getUnitPaserParameters(TiXmlNode *functionParser, generic_string &mainExprStr, std::vector &functionNameExprArray, std::vector &classNameExprArray); FunctionParser * getParser(const AssociationInfo & assoInfo); diff --git a/PowerEditor/src/WinControls/SplitterContainer/Splitter.h b/PowerEditor/src/WinControls/SplitterContainer/Splitter.h index eb2a24760..e906e453e 100644 --- a/PowerEditor/src/WinControls/SplitterContainer/Splitter.h +++ b/PowerEditor/src/WinControls/SplitterContainer/Splitter.h @@ -56,7 +56,7 @@ public: Splitter() = default; virtual ~Splitter() = default; - virtual void destroy() override; + void destroy() override; void resizeSpliter(RECT *pRect = NULL); void init(HINSTANCE hInst, HWND hPere, int splitterSize, double iSplitRatio, DWORD dwFlags); diff --git a/PowerEditor/src/WinControls/StatusBar/StatusBar.h b/PowerEditor/src/WinControls/StatusBar/StatusBar.h index f31cc6769..4ba68299b 100644 --- a/PowerEditor/src/WinControls/StatusBar/StatusBar.h +++ b/PowerEditor/src/WinControls/StatusBar/StatusBar.h @@ -35,7 +35,7 @@ public: bool setPartWidth(int whichPart, int width); - virtual void destroy() override; + void destroy() override; virtual void reSizeTo(const RECT& rc); int getHeight() const override; @@ -46,7 +46,7 @@ public: private: - virtual void init(HINSTANCE hInst, HWND hPere) override; + void init(HINSTANCE hInst, HWND hPere) override; private: std::vector _partWidthArray; diff --git a/PowerEditor/src/WinControls/TreeView/TreeView.cpp b/PowerEditor/src/WinControls/TreeView/TreeView.cpp index 97175b48e..55f961735 100644 --- a/PowerEditor/src/WinControls/TreeView/TreeView.cpp +++ b/PowerEditor/src/WinControls/TreeView/TreeView.cpp @@ -618,7 +618,7 @@ bool TreeView::canDragOut(HTREEITEM targetItem) -bool TreeView::searchLeafAndBuildTree(TreeView & tree2Build, const generic_string & text2Search, int index2Search) +bool TreeView::searchLeafAndBuildTree(const TreeView & tree2Build, const generic_string & text2Search, int index2Search) { //tree2Build.removeAllItems(); //HTREEITEM root = getRoot(); diff --git a/PowerEditor/src/WinControls/TreeView/TreeView.h b/PowerEditor/src/WinControls/TreeView/TreeView.h index 741812303..e63373709 100644 --- a/PowerEditor/src/WinControls/TreeView/TreeView.h +++ b/PowerEditor/src/WinControls/TreeView/TreeView.h @@ -116,7 +116,7 @@ public: bool swapTreeViewItem(HTREEITEM itemGoDown, HTREEITEM itemGoUp); bool restoreFoldingStateFrom(const TreeStateNode & treeState2Compare, HTREEITEM treeviewNode); bool retrieveFoldingStateTo(TreeStateNode & treeState2Construct, HTREEITEM treeviewNode); - bool searchLeafAndBuildTree(TreeView & tree2Build, const generic_string & text2Search, int index2Search); + bool searchLeafAndBuildTree(const TreeView & tree2Build, const generic_string & text2Search, int index2Search); void sort(HTREEITEM hTreeItem, bool isRecusive); void customSorting(HTREEITEM hTreeItem, PFNTVCOMPARE sortingCallbackFunc, LPARAM lParam, bool isRecursive); BOOL setImageList(int w, int h, int nbImage, int image_id, ...); diff --git a/PowerEditor/src/winmain.cpp b/PowerEditor/src/winmain.cpp index 9ec48c417..48bf90d7d 100644 --- a/PowerEditor/src/winmain.cpp +++ b/PowerEditor/src/winmain.cpp @@ -29,7 +29,7 @@ namespace { -void allowPrivilegeMessages(Notepad_plus_Window& notepad_plus_plus, winVer winVer) +void allowPrivilegeMessages(const Notepad_plus_Window& notepad_plus_plus, winVer winVer) { #ifndef MSGFLT_ADD const DWORD MSGFLT_ADD = 1;