remove the calls to trim

This commit is contained in:
DarthArgus
2018-07-15 01:22:32 +00:00
parent 3e73bb804d
commit a1475af550
4 changed files with 1 additions and 29 deletions
@@ -338,6 +338,7 @@ void ClientConnection::handleClientIdMessage(const ClientIdMsg &msg) {
if (apiUser.length() > MAX_ACCOUNT_NAME_LENGTH) {
apiUser.resize(MAX_ACCOUNT_NAME_LENGTH);
}
apiSuid = std::hash < std::string > {}(apiUser.c_str());
}
@@ -379,7 +380,6 @@ void ClientConnection::handleClientIdMessage(const ClientIdMsg &msg) {
account.resize(15);
}
account = trim(account);
m_suid = std::hash < std::string > {}(account.c_str());
}
}
@@ -196,18 +196,6 @@ private:
bool sendToGameServer(GameConnection *c);
};
// stolen from http://www.codeproject.com/Articles/10880/A-trim-implementation-for-std-string
// i'm rusty and haven't gotten to lambdas yet
inline const std::string trim(std::string str)
{
str.erase(str.begin(), std::find_if(str.begin(), str.end(),
[](char& ch)->bool { return !isspace(ch); }));
str.erase(std::find_if(str.rbegin(), str.rend(),
[](char& ch)->bool { return !isspace(ch); }).base(), str.end());
return str;
}
//-----------------------------------------------------------------------
inline const std::string & ClientConnection::getAccountName() const
@@ -176,7 +176,6 @@ void ClientConnection::validateClient(const std::string &id, const std::string &
uname.resize(MAX_ACCOUNT_NAME_LENGTH);
}
uname = trim(uname);
user_id = std::hash < std::string > {}(uname.c_str());
}
@@ -258,7 +257,6 @@ void ClientConnection::validateClient(const std::string &id, const std::string &
uname.resize(MAX_ACCOUNT_NAME_LENGTH);
}
uname = trim(uname);
user_id = std::hash < std::string > {}(uname.c_str());
}
@@ -74,20 +74,6 @@ private:
//-----------------------------------------------------------------------
// stolen from http://www.codeproject.com/Articles/10880/A-trim-implementation-for-std-string
// i'm rusty and haven't gotten to lambdas yet
inline const std::string trim(std::string str)
{
str.erase(str.begin(), std::find_if(str.begin(), str.end(),
[](char& ch)->bool { return !isspace(ch); }));
str.erase(std::find_if(str.rbegin(), str.rend(),
[](char& ch)->bool { return !isspace(ch); }).base(), str.end());
return str;
}
//-----------------------------------------------------------------------
inline const StationId ClientConnection::getStationId() const
{
return m_stationId;