Code enhancement: Function arguments pass by reference

Close #6063
This commit is contained in:
Rajendra Singh 2019-08-16 07:41:17 +05:30 committed by Don HO
parent 0bf3eea08a
commit 3a1244177c
No known key found for this signature in database
GPG Key ID: 6C429F1D8D84F46E
4 changed files with 6 additions and 8 deletions

View File

@ -264,7 +264,7 @@ int PluginsManager::loadPlugin(const TCHAR *pluginFilePath)
pluginExceptionAlert(pluginFileName, e); pluginExceptionAlert(pluginFileName, e);
return -1; return -1;
} }
catch (generic_string s) catch (generic_string& s)
{ {
s += TEXT("\n\n"); s += TEXT("\n\n");
s += pluginFileName; s += pluginFileName;
@ -326,7 +326,6 @@ bool PluginsManager::loadPluginsV2(const TCHAR* dir)
{ {
generic_string pluginsFullPathFilter = pluginsFolder; generic_string pluginsFullPathFilter = pluginsFolder;
PathAppend(pluginsFullPathFilter, foundFileName); PathAppend(pluginsFullPathFilter, foundFileName);
generic_string pluginsFolderPath = pluginsFullPathFilter;
generic_string dllName = foundFileName; generic_string dllName = foundFileName;
dllName += TEXT(".dll"); dllName += TEXT(".dll");
PathAppend(pluginsFullPathFilter, dllName); PathAppend(pluginsFullPathFilter, dllName);

View File

@ -616,7 +616,6 @@ LRESULT Notepad_plus::process(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa
case NPPM_INTERNAL_SAVECURRENTSESSION: case NPPM_INTERNAL_SAVECURRENTSESSION:
{ {
NppParameters& nppParam = NppParameters::getInstance();
const NppGUI& nppGui = nppParam.getNppGUI(); const NppGUI& nppGui = nppParam.getNppGUI();
if (nppGui._rememberLastSession && !nppGui._isCmdlineNosessionActivated) if (nppGui._rememberLastSession && !nppGui._isCmdlineNosessionActivated)

View File

@ -1139,7 +1139,7 @@ HTREEITEM FileBrowser::findInTree(const generic_string& rootPath, HTREEITEM node
} }
} }
bool FileBrowser::deleteFromTree(const generic_string& rootPath, HTREEITEM node, std::vector<generic_string> linarPathArray) bool FileBrowser::deleteFromTree(const generic_string& rootPath, HTREEITEM node, const std::vector<generic_string>& linarPathArray)
{ {
HTREEITEM foundItem = findInTree(rootPath, node, linarPathArray); HTREEITEM foundItem = findInTree(rootPath, node, linarPathArray);
if (foundItem == nullptr) if (foundItem == nullptr)
@ -1150,7 +1150,7 @@ bool FileBrowser::deleteFromTree(const generic_string& rootPath, HTREEITEM node,
return true; return true;
} }
bool FileBrowser::renameInTree(const generic_string& rootPath, HTREEITEM node, std::vector<generic_string> linarPathArrayFrom, const generic_string & renameTo) bool FileBrowser::renameInTree(const generic_string& rootPath, HTREEITEM node, const std::vector<generic_string>& linarPathArrayFrom, const generic_string & renameTo)
{ {
HTREEITEM foundItem = findInTree(rootPath, node, linarPathArrayFrom); HTREEITEM foundItem = findInTree(rootPath, node, linarPathArrayFrom);
if (foundItem == nullptr) if (foundItem == nullptr)

View File

@ -103,7 +103,7 @@ enum BrowserNodeType {
class FolderUpdater { class FolderUpdater {
friend class FileBrowser; friend class FileBrowser;
public: public:
FolderUpdater(FolderInfo fi, FileBrowser *pFileBrowser) : _rootFolder(fi), _pFileBrowser(pFileBrowser) {}; FolderUpdater(const FolderInfo& fi, FileBrowser *pFileBrowser) : _rootFolder(fi), _pFileBrowser(pFileBrowser) {};
~FolderUpdater() {}; ~FolderUpdater() {};
//bool updateTree(DWORD action, const std::vector<generic_string> & file2Change); // postMessage to FileBrowser to upgrade GUI //bool updateTree(DWORD action, const std::vector<generic_string> & 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<generic_string> linarPathArray); bool addInTree(const generic_string& rootPath, const generic_string& addItemFullPath, HTREEITEM node, std::vector<generic_string> linarPathArray);
HTREEITEM findInTree(const generic_string& rootPath, HTREEITEM node, std::vector<generic_string> linarPathArray); HTREEITEM findInTree(const generic_string& rootPath, HTREEITEM node, std::vector<generic_string> linarPathArray);
bool deleteFromTree(const generic_string& rootPath, HTREEITEM node, std::vector<generic_string> linarPathArray); bool deleteFromTree(const generic_string& rootPath, HTREEITEM node, const std::vector<generic_string>& linarPathArray);
void deleteAllFromTree() { void deleteAllFromTree() {
popupMenuCmd(IDM_FILEBROWSER_REMOVEALLROOTS); popupMenuCmd(IDM_FILEBROWSER_REMOVEALLROOTS);
}; };
bool renameInTree(const generic_string& rootPath, HTREEITEM node, std::vector<generic_string> linarPathArrayFrom, const generic_string & renameTo); bool renameInTree(const generic_string& rootPath, HTREEITEM node, const std::vector<generic_string>& linarPathArrayFrom, const generic_string & renameTo);
std::vector<generic_string> getRoots() const; std::vector<generic_string> getRoots() const;
generic_string getSelectedItemPath() const; generic_string getSelectedItemPath() const;