Fix various explicitness, laziness, hard codes

This commit is contained in:
sampletext32 2020-04-10 21:48:32 +03:00 committed by Ivan
parent 5524cd1e75
commit c69691f19b
6 changed files with 26 additions and 24 deletions

View file

@ -1603,15 +1603,14 @@ bool fs::remove_all(const std::string& path, bool remove_root)
continue;
}
if (entry.is_directory == false)
if (!entry.is_directory)
{
if (!remove_file(path_append(path, entry.name)))
{
return false;
}
}
if (entry.is_directory == true)
else
{
if (!remove_all(path_append(path, entry.name)))
{
@ -1651,12 +1650,11 @@ u64 fs::get_dir_size(const std::string& path, u64 rounding_alignment)
continue;
}
if (entry.is_directory == false)
if (!entry.is_directory)
{
result += ::align(entry.size, rounding_alignment);
}
if (entry.is_directory == true)
else
{
const u64 size = get_dir_size(path_append(path, entry.name), rounding_alignment);

View file

@ -81,7 +81,7 @@ namespace fmt
template <typename T>
std::string merge(const T& source, const std::string& separator)
{
if (!source.size())
if (source.empty())
{
return {};
}

View file

@ -154,7 +154,7 @@ namespace utils
#else
while ((m_file = ::shm_open("/rpcs3-mem1", O_RDWR | O_CREAT | O_EXCL, S_IWUSR | S_IRUSR)) == -1)
{
if (m_file == -1 && errno == EMFILE)
if (errno == EMFILE)
{
fmt::throw_exception("Too many open files. Raise the limit and try again.");
}