summaryrefslogtreecommitdiff
path: root/src/clientmedia.cpp
diff options
context:
space:
mode:
authorLoïc Blot <nerzhul@users.noreply.github.com>2017-04-21 10:06:08 +0200
committerGitHub <noreply@github.com>2017-04-21 10:06:08 +0200
commit370354cc87937bbfb6f24aa062966af8e039cec0 (patch)
treee0400c3b3c63d3e8e8b22c81e40a9cabe2d1b5b1 /src/clientmedia.cpp
parentde5ecc9fa31d557e2d0ca638b1c98435707046b9 (diff)
downloadminetest-370354cc87937bbfb6f24aa062966af8e039cec0.tar.gz
minetest-370354cc87937bbfb6f24aa062966af8e039cec0.tar.bz2
minetest-370354cc87937bbfb6f24aa062966af8e039cec0.zip
Fix various performance issues reported by cppcheck (#5628)
* Also remove 1 non declared but defined functions
Diffstat (limited to 'src/clientmedia.cpp')
-rw-r--r--src/clientmedia.cpp14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/clientmedia.cpp b/src/clientmedia.cpp
index bca3f67c2..14a38ca66 100644
--- a/src/clientmedia.cpp
+++ b/src/clientmedia.cpp
@@ -42,12 +42,12 @@ static std::string getMediaCacheDir()
*/
ClientMediaDownloader::ClientMediaDownloader():
- m_media_cache(getMediaCacheDir())
+ m_media_cache(getMediaCacheDir()),
+ m_initial_step_done(false),
+ m_uncached_count(0),
+ m_uncached_received_count(0),
+ m_name_bound("")
{
- m_initial_step_done = false;
- m_name_bound = ""; // works because "" is an invalid file name
- m_uncached_count = 0;
- m_uncached_received_count = 0;
m_httpfetch_caller = HTTPFETCH_DISCARD;
m_httpfetch_active = 0;
m_httpfetch_active_limit = 0;
@@ -69,7 +69,7 @@ ClientMediaDownloader::~ClientMediaDownloader()
delete m_remotes[i];
}
-void ClientMediaDownloader::addFile(std::string name, std::string sha1)
+void ClientMediaDownloader::addFile(const std::string &name, const std::string &sha1)
{
assert(!m_initial_step_done); // pre-condition
@@ -104,7 +104,7 @@ void ClientMediaDownloader::addFile(std::string name, std::string sha1)
m_files.insert(std::make_pair(name, filestatus));
}
-void ClientMediaDownloader::addRemoteServer(std::string baseurl)
+void ClientMediaDownloader::addRemoteServer(const std::string &baseurl)
{
assert(!m_initial_step_done); // pre-condition