Enhancements

Add support for specifying node rename pattern in URL argument.
Optimize codes.
This commit is contained in:
Tindy X committed 2020-05-05 22:40:32 +08:00
1 parent af7d7fae05
commit 40d3b36f92
3 files changed
+10 -4

No files matched your search

+4 -2
View File
@@ -2125,14 +2125,16 @@ static inline unsigned long long streamToInt(const std::string &stream)
return 0;
double streamval = 1.0;
std::vector<std::string> units = {"B", "KB", "MB", "GB", "TB", "PB", "EB"};
for(size_t index = units.size() - 1; index >= 0; index--)
size_t index = units.size();
do
{
index--;
if(endsWith(stream, units[index]))
{
streamval = std::pow(1024, index) * to_number<float>(stream.substr(0, stream.size() - units[index].size()), 0.0);
break;
}
}
} while(index != 0);
return (unsigned long long)streamval;
}