Use the reference parameter instead of copy parameter and some clean up
Close #5360
This commit is contained in:
parent
5423b50635
commit
50e9e87e44
@ -1155,7 +1155,7 @@ bool isCertificateValidated(const generic_string & fullFilePath, const generic_s
|
|||||||
|
|
||||||
isOK = true;
|
isOK = true;
|
||||||
}
|
}
|
||||||
catch (generic_string s)
|
catch (const generic_string& s)
|
||||||
{
|
{
|
||||||
// display error message
|
// display error message
|
||||||
MessageBox(NULL, s.c_str(), TEXT("Certificate checking"), MB_OK);
|
MessageBox(NULL, s.c_str(), TEXT("Certificate checking"), MB_OK);
|
||||||
|
@ -57,7 +57,7 @@ SecurityGard::SecurityGard()
|
|||||||
_pluginListSha256.push_back(TEXT("3ecd7f9c56bcd659a4126c659eb69b354789c78574a82390749ac751ae539bc6")); // v1.0.7 64 bit (unsigned)
|
_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)
|
if (_securityMode == sm_certif)
|
||||||
return verifySignedLibrary(filePath, module2check);
|
return verifySignedLibrary(filePath, module2check);
|
||||||
@ -67,7 +67,7 @@ bool SecurityGard::checkModule(std::wstring filePath, NppModule module2check)
|
|||||||
return false;
|
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());
|
std::string content = getFileContent(filePath.c_str());
|
||||||
uint8_t sha2hash[32];
|
uint8_t sha2hash[32];
|
||||||
|
@ -66,7 +66,7 @@ class SecurityGard final
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
SecurityGard();
|
SecurityGard();
|
||||||
bool checkModule(std::wstring filePath, NppModule module2check);
|
bool checkModule(const std::wstring& filePath, NppModule module2check);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// SHA256
|
// SHA256
|
||||||
@ -75,7 +75,7 @@ private:
|
|||||||
std::vector<std::wstring> _gupSha256;
|
std::vector<std::wstring> _gupSha256;
|
||||||
std::vector<std::wstring> _pluginListSha256;
|
std::vector<std::wstring> _pluginListSha256;
|
||||||
|
|
||||||
bool checkSha256(std::wstring filePath, NppModule module2check);
|
bool checkSha256(const std::wstring& filePath, NppModule module2check);
|
||||||
|
|
||||||
// Code signing certificate
|
// Code signing certificate
|
||||||
std::wstring _signer_display_name = TEXT("Notepad++");
|
std::wstring _signer_display_name = TEXT("Notepad++");
|
||||||
|
@ -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());
|
_userLangArray[_nbUserLang - 1]->_styleArray.addStyler(i, globalMappper().styleNameMapper[i].c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
} catch (std::exception e) {
|
}
|
||||||
|
catch (const std::exception& /*e*/)
|
||||||
|
{
|
||||||
delete _userLangArray[--_nbUserLang];
|
delete _userLangArray[--_nbUserLang];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -48,8 +48,8 @@ public :
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
std::vector<ScintillaEditView *> _scintVector;
|
std::vector<ScintillaEditView *> _scintVector;
|
||||||
HINSTANCE _hInst;
|
HINSTANCE _hInst = nullptr;
|
||||||
HWND _hParent;
|
HWND _hParent = nullptr;
|
||||||
int getIndexFrom(HWND handle2Find);
|
int getIndexFrom(HWND handle2Find);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -60,12 +60,6 @@ class WindowsDlg : public SizeableDlg
|
|||||||
{
|
{
|
||||||
typedef SizeableDlg MyBaseClass;
|
typedef SizeableDlg MyBaseClass;
|
||||||
|
|
||||||
class CachedValue
|
|
||||||
{
|
|
||||||
generic_string fullname;
|
|
||||||
int index;
|
|
||||||
};
|
|
||||||
|
|
||||||
public :
|
public :
|
||||||
WindowsDlg();
|
WindowsDlg();
|
||||||
int doDialog();
|
int doDialog();
|
||||||
|
@ -321,7 +321,7 @@ private:
|
|||||||
class UserCommand : public CommandShortcut {
|
class UserCommand : public CommandShortcut {
|
||||||
friend class NppParameters;
|
friend class NppParameters;
|
||||||
public:
|
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();};
|
const TCHAR* getCmd() const {return _cmd.c_str();};
|
||||||
private:
|
private:
|
||||||
generic_string _cmd;
|
generic_string _cmd;
|
||||||
@ -330,7 +330,7 @@ private:
|
|||||||
class PluginCmdShortcut : public CommandShortcut {
|
class PluginCmdShortcut : public CommandShortcut {
|
||||||
//friend class NppParameters;
|
//friend class NppParameters;
|
||||||
public:
|
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) {};
|
CommandShortcut(sc, id), _id(id), _moduleName(moduleName), _internalID(internalID) {};
|
||||||
bool isValid() const {
|
bool isValid() const {
|
||||||
if (!Shortcut::isValid())
|
if (!Shortcut::isValid())
|
||||||
|
Loading…
Reference in New Issue
Block a user