Use the reference parameter instead of copy parameter and some clean up

Close #5360
This commit is contained in:
Rajendra Singh 2019-03-01 19:12:26 +05:30 committed by Don HO
parent 5423b50635
commit 50e9e87e44
7 changed files with 12 additions and 16 deletions

View File

@ -1155,7 +1155,7 @@ bool isCertificateValidated(const generic_string & fullFilePath, const generic_s
isOK = true;
}
catch (generic_string s)
catch (const generic_string& s)
{
// display error message
MessageBox(NULL, s.c_str(), TEXT("Certificate checking"), MB_OK);

View File

@ -57,7 +57,7 @@ SecurityGard::SecurityGard()
_pluginListSha256.push_back(TEXT("3ecd7f9c56bcd659a4126c659eb69b354789c78574a82390749ac751ae539bc6")); // v1.0.7 64 bit (unsigned)
}
bool SecurityGard::checkModule(std::wstring filePath, NppModule module2check)
bool SecurityGard::checkModule(const std::wstring& filePath, NppModule module2check)
{
if (_securityMode == sm_certif)
return verifySignedLibrary(filePath, module2check);
@ -67,7 +67,7 @@ bool SecurityGard::checkModule(std::wstring filePath, NppModule module2check)
return false;
}
bool SecurityGard::checkSha256(std::wstring filePath, NppModule module2check)
bool SecurityGard::checkSha256(const std::wstring& filePath, NppModule module2check)
{
std::string content = getFileContent(filePath.c_str());
uint8_t sha2hash[32];

View File

@ -66,7 +66,7 @@ class SecurityGard final
{
public:
SecurityGard();
bool checkModule(std::wstring filePath, NppModule module2check);
bool checkModule(const std::wstring& filePath, NppModule module2check);
private:
// SHA256
@ -75,7 +75,7 @@ private:
std::vector<std::wstring> _gupSha256;
std::vector<std::wstring> _pluginListSha256;
bool checkSha256(std::wstring filePath, NppModule module2check);
bool checkSha256(const std::wstring& filePath, NppModule module2check);
// Code signing certificate
std::wstring _signer_display_name = TEXT("Notepad++");

View File

@ -2652,7 +2652,9 @@ std::pair<unsigned char, unsigned char> NppParameters::feedUserLang(TiXmlNode *n
_userLangArray[_nbUserLang - 1]->_styleArray.addStyler(i, globalMappper().styleNameMapper[i].c_str());
}
} catch (std::exception e) {
}
catch (const std::exception& /*e*/)
{
delete _userLangArray[--_nbUserLang];
}
}

View File

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

View File

@ -60,12 +60,6 @@ class WindowsDlg : public SizeableDlg
{
typedef SizeableDlg MyBaseClass;
class CachedValue
{
generic_string fullname;
int index;
};
public :
WindowsDlg();
int doDialog();

View File

@ -321,7 +321,7 @@ private:
class UserCommand : public CommandShortcut {
friend class NppParameters;
public:
UserCommand(Shortcut sc, const TCHAR *cmd, int id) : CommandShortcut(sc, id), _cmd(cmd) {_canModifyName = true;};
UserCommand(const Shortcut& sc, const TCHAR *cmd, int id) : CommandShortcut(sc, id), _cmd(cmd) {_canModifyName = true;};
const TCHAR* getCmd() const {return _cmd.c_str();};
private:
generic_string _cmd;
@ -330,7 +330,7 @@ private:
class PluginCmdShortcut : public CommandShortcut {
//friend class NppParameters;
public:
PluginCmdShortcut(Shortcut sc, int id, const TCHAR *moduleName, unsigned short internalID) :\
PluginCmdShortcut(const Shortcut& sc, int id, const TCHAR *moduleName, unsigned short internalID) :\
CommandShortcut(sc, id), _id(id), _moduleName(moduleName), _internalID(internalID) {};
bool isValid() const {
if (!Shortcut::isValid())