X-Git-Url: https://git.librecmc.org/?a=blobdiff_plain;f=src%2Fclientmedia.cpp;h=ca6f3d563ca57911b07e380ff381bb5b244bbd03;hb=3caad3f3c9e319ca67d63231e8c64b2ace855fff;hp=ea11ad239ec6210683b0aadd73863bb3aa974f37;hpb=9527984dbcfc0a6cc7aa0470430cb6c3aa4103ba;p=oweals%2Fminetest.git diff --git a/src/clientmedia.cpp b/src/clientmedia.cpp index ea11ad239..ca6f3d563 100644 --- a/src/clientmedia.cpp +++ b/src/clientmedia.cpp @@ -34,7 +34,7 @@ with this program; if not, write to the Free Software Foundation, Inc., static std::string getMediaCacheDir() { - return porting::path_user + DIR_DELIM + "cache" + DIR_DELIM + "media"; + return porting::path_cache + DIR_DELIM + "media"; } /* @@ -42,18 +42,9 @@ static std::string getMediaCacheDir() */ ClientMediaDownloader::ClientMediaDownloader(): - m_media_cache(getMediaCacheDir()) + m_media_cache(getMediaCacheDir()), + m_httpfetch_caller(HTTPFETCH_DISCARD) { - 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; - m_httpfetch_next_id = 0; - m_httpfetch_timeout = 0; - m_outstanding_hash_sets = 0; } ClientMediaDownloader::~ClientMediaDownloader() @@ -69,7 +60,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 +95,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 @@ -348,7 +339,7 @@ void ClientMediaDownloader::remoteMediaReceived( std::string name; { - std::map::iterator it = + std::unordered_map::iterator it = m_remote_file_transfers.find(fetch_result.request_id); assert(it != m_remote_file_transfers.end()); name = it->second;