Fix compiler warnings

Optimize codes.
This commit is contained in:
Tindy X committed 2020-03-21 17:47:53 +08:00
1 parent 5d2bae1b32
commit f736a2e8b3
3 files changed
+8 -7

No files matched your search

+4 -4
View File
@@ -75,11 +75,11 @@ std::shared_future<std::string> fetchFileAsync(const std::string &path, const st
{
std::shared_future<std::string> retVal;
if(fileExist(path))
retVal = std::move(std::async(std::launch::async, [path](){return fileGet(path, true);}));
else if(startsWith(path, "https://") || startsWith(path, "http://"))
retVal = std::move(std::async(std::launch::async, [path, proxy, cache_ttl](){return webGet(path, proxy, cache_ttl);}));
retVal = std::async(std::launch::async, [path](){return fileGet(path, true);});
else if(startsWith(path, "https://") || startsWith(path, "http://") || startsWith(path, "data:"))
retVal = std::async(std::launch::async, [path, proxy, cache_ttl](){return webGet(path, proxy, cache_ttl);});
else
return std::move(std::async(std::launch::async, [](){return std::string();}));
return std::async(std::launch::async, [](){return std::string();});
if(!async)
retVal.wait();
return retVal;