summaryrefslogtreecommitdiff
path: root/src/fs/files.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2017-06-06 23:34:34 +0300
committerAndrei Karas <akaras@inbox.ru>2017-06-07 19:23:40 +0300
commit36ba43d6ea38062b17f7e63ef659962bfc51c64d (patch)
tree190156cb88b13a38a6d13c69ee0742cc078065a1 /src/fs/files.cpp
parentf1518dd8476c968a43fa57cfb06198e290a4f77a (diff)
downloadmv-36ba43d6ea38062b17f7e63ef659962bfc51c64d.tar.gz
mv-36ba43d6ea38062b17f7e63ef659962bfc51c64d.tar.bz2
mv-36ba43d6ea38062b17f7e63ef659962bfc51c64d.tar.xz
mv-36ba43d6ea38062b17f7e63ef659962bfc51c64d.zip
Fix clang-tidy check readability-implicit-bool-cast.
Diffstat (limited to 'src/fs/files.cpp')
-rw-r--r--src/fs/files.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/fs/files.cpp b/src/fs/files.cpp
index 9d7bfd125..d1f36cbdc 100644
--- a/src/fs/files.cpp
+++ b/src/fs/files.cpp
@@ -183,7 +183,7 @@ int Files::copyFile(const std::string &restrict srcName,
const int chunkSize = 512000;
char *buf = new char[chunkSize];
size_t sz = 0;
- while ((sz = fread(buf, 1, chunkSize, srcFile)))
+ while ((sz = fread(buf, 1, chunkSize, srcFile)) != 0u)
{
if (fwrite(buf, 1, sz, dstFile) != sz)
{
@@ -245,7 +245,7 @@ void Files::saveTextFile(const std::string &path,
const std::string &restrict name,
const std::string &restrict text)
{
- if (!mkdir_r(path.c_str()))
+ if (mkdir_r(path.c_str()) == 0)
{
std::ofstream file;
std::string fileName = pathJoin(path, name);
@@ -269,9 +269,9 @@ void Files::deleteFilesInDirectory(std::string path)
const struct dirent *next_file = nullptr;
DIR *const dir = opendir(path.c_str());
- if (dir)
+ if (dir != nullptr)
{
- while ((next_file = readdir(dir)))
+ while ((next_file = readdir(dir)) != nullptr)
{
const std::string file = next_file->d_name;
if (file != "." && file != "..")
@@ -289,10 +289,10 @@ void Files::enumFiles(StringVect &files,
path += dirSeparator;
DIR *const dir = opendir(path.c_str());
- if (dir)
+ if (dir != nullptr)
{
const struct dirent *next_file = nullptr;
- while ((next_file = readdir(dir)))
+ while ((next_file = readdir(dir)) != nullptr)
{
const std::string file = next_file->d_name;
if (file == "." || file == "..")