diff options
| author | 2015-01-10 15:16:03 +0100 | |
|---|---|---|
| committer | 2015-01-10 15:16:03 +0100 | |
| commit | 47dda4f61512f6047f2b1dcccd1943aab74726e3 (patch) | |
| tree | a1425a9dbff58b97ef5dcdf169e0d65439513527 /src/modules/m_httpd.cpp | |
| parent | Remove the unused OnGlobalOper hook (diff) | |
| download | inspircd++-47dda4f61512f6047f2b1dcccd1943aab74726e3.tar.gz inspircd++-47dda4f61512f6047f2b1dcccd1943aab74726e3.tar.bz2 inspircd++-47dda4f61512f6047f2b1dcccd1943aab74726e3.zip | |
Reduce std::string::substr() usage
substr() returns a new string while erase() and assign() modify the existing one
Diffstat (limited to 'src/modules/m_httpd.cpp')
| -rw-r--r-- | src/modules/m_httpd.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/modules/m_httpd.cpp b/src/modules/m_httpd.cpp index a4452c9c0..bbd9f1275 100644 --- a/src/modules/m_httpd.cpp +++ b/src/modules/m_httpd.cpp @@ -269,7 +269,7 @@ class HttpServerSocket : public BufferedSocket, public Timer, public insp::intru continue; } - std::string cheader = reqbuffer.substr(hbegin, hend - hbegin); + std::string cheader(reqbuffer, hbegin, hend - hbegin); std::string::size_type fieldsep = cheader.find(':'); if ((fieldsep == std::string::npos) || (fieldsep == 0) || (fieldsep == cheader.length() - 1)) @@ -300,7 +300,7 @@ class HttpServerSocket : public BufferedSocket, public Timer, public insp::intru if (reqbuffer.length() >= postsize) { - postdata = reqbuffer.substr(0, postsize); + postdata.assign(reqbuffer, 0, postsize); reqbuffer.erase(0, postsize); } else if (!reqbuffer.empty()) |
