From 3a1244177c0680e0c3f32bca9bcdca8a63fc2d18 Mon Sep 17 00:00:00 2001 From: Rajendra Singh Date: Fri, 16 Aug 2019 07:41:17 +0530 Subject: [PATCH] Code enhancement: Function arguments pass by reference Close #6063 --- PowerEditor/src/MISC/PluginsManager/PluginsManager.cpp | 3 +-- PowerEditor/src/NppBigSwitch.cpp | 1 - PowerEditor/src/WinControls/FileBrowser/fileBrowser.cpp | 4 ++-- PowerEditor/src/WinControls/FileBrowser/fileBrowser.h | 6 +++--- 4 files changed, 6 insertions(+), 8 deletions(-) diff --git a/PowerEditor/src/MISC/PluginsManager/PluginsManager.cpp b/PowerEditor/src/MISC/PluginsManager/PluginsManager.cpp index 2fb0c5e9..41418f98 100644 --- a/PowerEditor/src/MISC/PluginsManager/PluginsManager.cpp +++ b/PowerEditor/src/MISC/PluginsManager/PluginsManager.cpp @@ -264,7 +264,7 @@ int PluginsManager::loadPlugin(const TCHAR *pluginFilePath) pluginExceptionAlert(pluginFileName, e); return -1; } - catch (generic_string s) + catch (generic_string& s) { s += TEXT("\n\n"); s += pluginFileName; @@ -326,7 +326,6 @@ bool PluginsManager::loadPluginsV2(const TCHAR* dir) { generic_string pluginsFullPathFilter = pluginsFolder; PathAppend(pluginsFullPathFilter, foundFileName); - generic_string pluginsFolderPath = pluginsFullPathFilter; generic_string dllName = foundFileName; dllName += TEXT(".dll"); PathAppend(pluginsFullPathFilter, dllName); diff --git a/PowerEditor/src/NppBigSwitch.cpp b/PowerEditor/src/NppBigSwitch.cpp index cf9e92c1..56f15172 100644 --- a/PowerEditor/src/NppBigSwitch.cpp +++ b/PowerEditor/src/NppBigSwitch.cpp @@ -616,7 +616,6 @@ LRESULT Notepad_plus::process(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa case NPPM_INTERNAL_SAVECURRENTSESSION: { - NppParameters& nppParam = NppParameters::getInstance(); const NppGUI& nppGui = nppParam.getNppGUI(); if (nppGui._rememberLastSession && !nppGui._isCmdlineNosessionActivated) diff --git a/PowerEditor/src/WinControls/FileBrowser/fileBrowser.cpp b/PowerEditor/src/WinControls/FileBrowser/fileBrowser.cpp index 3008eb3e..a53b0a0c 100644 --- a/PowerEditor/src/WinControls/FileBrowser/fileBrowser.cpp +++ b/PowerEditor/src/WinControls/FileBrowser/fileBrowser.cpp @@ -1139,7 +1139,7 @@ HTREEITEM FileBrowser::findInTree(const generic_string& rootPath, HTREEITEM node } } -bool FileBrowser::deleteFromTree(const generic_string& rootPath, HTREEITEM node, std::vector linarPathArray) +bool FileBrowser::deleteFromTree(const generic_string& rootPath, HTREEITEM node, const std::vector& linarPathArray) { HTREEITEM foundItem = findInTree(rootPath, node, linarPathArray); if (foundItem == nullptr) @@ -1150,7 +1150,7 @@ bool FileBrowser::deleteFromTree(const generic_string& rootPath, HTREEITEM node, return true; } -bool FileBrowser::renameInTree(const generic_string& rootPath, HTREEITEM node, std::vector linarPathArrayFrom, const generic_string & renameTo) +bool FileBrowser::renameInTree(const generic_string& rootPath, HTREEITEM node, const std::vector& linarPathArrayFrom, const generic_string & renameTo) { HTREEITEM foundItem = findInTree(rootPath, node, linarPathArrayFrom); if (foundItem == nullptr) diff --git a/PowerEditor/src/WinControls/FileBrowser/fileBrowser.h b/PowerEditor/src/WinControls/FileBrowser/fileBrowser.h index df3bfd1d..3ca9d127 100644 --- a/PowerEditor/src/WinControls/FileBrowser/fileBrowser.h +++ b/PowerEditor/src/WinControls/FileBrowser/fileBrowser.h @@ -103,7 +103,7 @@ enum BrowserNodeType { class FolderUpdater { friend class FileBrowser; public: - FolderUpdater(FolderInfo fi, FileBrowser *pFileBrowser) : _rootFolder(fi), _pFileBrowser(pFileBrowser) {}; + FolderUpdater(const FolderInfo& fi, FileBrowser *pFileBrowser) : _rootFolder(fi), _pFileBrowser(pFileBrowser) {}; ~FolderUpdater() {}; //bool updateTree(DWORD action, const std::vector & file2Change); // postMessage to FileBrowser to upgrade GUI @@ -151,12 +151,12 @@ public: bool addInTree(const generic_string& rootPath, const generic_string& addItemFullPath, HTREEITEM node, std::vector linarPathArray); HTREEITEM findInTree(const generic_string& rootPath, HTREEITEM node, std::vector linarPathArray); - bool deleteFromTree(const generic_string& rootPath, HTREEITEM node, std::vector linarPathArray); + bool deleteFromTree(const generic_string& rootPath, HTREEITEM node, const std::vector& linarPathArray); void deleteAllFromTree() { popupMenuCmd(IDM_FILEBROWSER_REMOVEALLROOTS); }; - bool renameInTree(const generic_string& rootPath, HTREEITEM node, std::vector linarPathArrayFrom, const generic_string & renameTo); + bool renameInTree(const generic_string& rootPath, HTREEITEM node, const std::vector& linarPathArrayFrom, const generic_string & renameTo); std::vector getRoots() const; generic_string getSelectedItemPath() const;