mirror of
https://github.com/SWG-Source/src.git
synced 2026-08-01 01:16:03 -04:00
remove the calls to trim
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user