From 36ba43d6ea38062b17f7e63ef659962bfc51c64d Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Tue, 6 Jun 2017 23:34:34 +0300 Subject: Fix clang-tidy check readability-implicit-bool-cast. --- src/fs/files.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src/fs/files.cpp') 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 == "..") -- cgit v1.2.3-70-g09d2