p2p: pass strings to NetPermissions::TryParse functions by const ref

pull/826/head
Jon Atack 4 years ago
parent d4c409cf09
commit 39393479c5
No known key found for this signature in database
GPG Key ID: 4F5721B3D0E3921D

@ -20,8 +20,8 @@ const std::vector<std::string> NET_PERMISSIONS_DOC{
namespace { namespace {
// The parse the following format "perm1,perm2@xxxxxx" // Parse the following format: "perm1,perm2@xxxxxx"
bool TryParsePermissionFlags(const std::string str, NetPermissionFlags& output, size_t& readen, bilingual_str& error) bool TryParsePermissionFlags(const std::string& str, NetPermissionFlags& output, size_t& readen, bilingual_str& error)
{ {
NetPermissionFlags flags = NetPermissionFlags::None; NetPermissionFlags flags = NetPermissionFlags::None;
const auto atSeparator = str.find('@'); const auto atSeparator = str.find('@');
@ -81,7 +81,7 @@ std::vector<std::string> NetPermissions::ToStrings(NetPermissionFlags flags)
return strings; return strings;
} }
bool NetWhitebindPermissions::TryParse(const std::string str, NetWhitebindPermissions& output, bilingual_str& error) bool NetWhitebindPermissions::TryParse(const std::string& str, NetWhitebindPermissions& output, bilingual_str& error)
{ {
NetPermissionFlags flags; NetPermissionFlags flags;
size_t offset; size_t offset;
@ -104,7 +104,7 @@ bool NetWhitebindPermissions::TryParse(const std::string str, NetWhitebindPermis
return true; return true;
} }
bool NetWhitelistPermissions::TryParse(const std::string str, NetWhitelistPermissions& output, bilingual_str& error) bool NetWhitelistPermissions::TryParse(const std::string& str, NetWhitelistPermissions& output, bilingual_str& error)
{ {
NetPermissionFlags flags; NetPermissionFlags flags;
size_t offset; size_t offset;

@ -74,14 +74,14 @@ public:
class NetWhitebindPermissions : public NetPermissions class NetWhitebindPermissions : public NetPermissions
{ {
public: public:
static bool TryParse(const std::string str, NetWhitebindPermissions& output, bilingual_str& error); static bool TryParse(const std::string& str, NetWhitebindPermissions& output, bilingual_str& error);
CService m_service; CService m_service;
}; };
class NetWhitelistPermissions : public NetPermissions class NetWhitelistPermissions : public NetPermissions
{ {
public: public:
static bool TryParse(const std::string str, NetWhitelistPermissions& output, bilingual_str& error); static bool TryParse(const std::string& str, NetWhitelistPermissions& output, bilingual_str& error);
CSubNet m_subnet; CSubNet m_subnet;
}; };

Loading…
Cancel
Save