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

+1 -1
View File
@@ -344,7 +344,7 @@ void refreshRulesets(string_array &ruleset_list, std::vector<ruleset_content> &r
{
writeLog(0, "Adding rule '" + rule_url.substr(2) + "," + rule_group + "'.", LOG_LEVEL_INFO);
//std::cerr<<"Adding rule '"<<rule_url.substr(2)<<","<<rule_group<<"'."<<std::endl;
rc = {rule_group, "", std::move(std::async(std::launch::async, [rule_url](){return rule_url;}))};
rc = {rule_group, "", std::async(std::launch::async, [rule_url](){return rule_url;})};
rca.emplace_back(rc);
continue;
}
+3 -2
View File
@@ -262,9 +262,10 @@ std::string base64_decode(const std::string &encoded_string, bool accept_urlsafe
dtable[uchar] = k; // decode (find)
itable[uchar] = 1; // is_base64
}
const unsigned char dash = '-', add = '+', under = '_', slash = '/';
// Add urlsafe table
dtable['-'] = dtable['+']; itable['-'] = 2;
dtable['_'] = dtable['/']; itable['_'] = 2;
dtable[dash] = dtable[add]; itable[dash] = 2;
dtable[under] = dtable[slash]; itable[under] = 2;
table_ready = 1;
}
+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;