From 0140bc21056b4c7f6ede16cdbf0563b0af566dbf Mon Sep 17 00:00:00 2001 From: Attila Molnar Date: Tue, 2 Sep 2014 16:27:12 +0200 Subject: Replace stringstream with a std::string in ModeParser::Process() There is no benefit in using a stringstream here --- src/mode.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/mode.cpp b/src/mode.cpp index 3fcfcbd51..d24346e59 100644 --- a/src/mode.cpp +++ b/src/mode.cpp @@ -406,7 +406,7 @@ void ModeParser::Process(const std::vector& parameters, User* user, std::string mode_sequence = parameters[1]; std::string output_mode; - std::ostringstream output_parameters; + std::string output_parameters; LastParseParams.push_back(output_mode); LastParseTranslate.push_back(TR_TEXT); @@ -469,12 +469,13 @@ void ModeParser::Process(const std::vector& parameters, User* user, if (pcnt) { - output_parameters << " " << parameter; + output_parameters.push_back(' '); + output_parameters.append(parameter); LastParseParams.push_back(parameter); LastParseTranslate.push_back(mh->GetTranslateType()); } - if ( (output_mode.length() + output_parameters.str().length() > 450) + if ((output_mode.length() + output_parameters.length() > 450) || (output_mode.length() > 100) || (LastParseParams.size() > ServerInstance->Config->Limits.MaxModes)) { @@ -490,7 +491,7 @@ void ModeParser::Process(const std::vector& parameters, User* user, LastParse = targetchannel ? targetchannel->name : targetuser->nick; LastParse.append(" "); LastParse.append(output_mode); - LastParse.append(output_parameters.str()); + LastParse.append(output_parameters); if (!(flags & MODE_LOCALONLY)) ServerInstance->PI->SendMode(user, targetuser, targetchannel, LastParseParams, LastParseTranslate); -- cgit v1.2.3