diff --git a/cli/filelister.cpp b/cli/filelister.cpp index ad958ab87..c68645950 100644 --- a/cli/filelister.cpp +++ b/cli/filelister.cpp @@ -231,19 +231,13 @@ void FileLister::addFiles(std::map &files, const std:: bool FileLister::isDirectory(const std::string &path) { struct stat file_stat; - if (stat(path.c_str(), &file_stat) != -1) - return ((file_stat.st_mode & S_IFMT) == S_IFDIR); - - return false; + return (stat(path.c_str(), &file_stat) != -1 && (file_stat.st_mode & S_IFMT) == S_IFDIR); } bool FileLister::fileExists(const std::string &path) { struct stat file_stat; - if (stat(path.c_str(), &file_stat) != -1) - return ((file_stat.st_mode & S_IFMT) == S_IFREG); - - return false; + return (stat(path.c_str(), &file_stat) != -1 && (file_stat.st_mode & S_IFMT) == S_IFREG); } #endif diff --git a/gui/test/data/benchmark/simple.cpp b/gui/test/data/benchmark/simple.cpp index b0370de7f..80bbb346a 100644 --- a/gui/test/data/benchmark/simple.cpp +++ b/gui/test/data/benchmark/simple.cpp @@ -1064,7 +1064,7 @@ public: /** is variable unused? */ bool unused() const { - return (_read == false && _write == false); + return (!_read && !_write); } const Token *_name; diff --git a/lib/path.cpp b/lib/path.cpp index 57aaf8ba2..f498cd467 100644 --- a/lib/path.cpp +++ b/lib/path.cpp @@ -251,7 +251,7 @@ bool Path::isC(const std::string &path) bool Path::isCPP(const std::string &path) { const std::string extension = getFilenameExtensionInLowerCase(path); - if (extension == ".cpp" || + return extension == ".cpp" || extension == ".cxx" || extension == ".cc" || extension == ".c++" || @@ -259,12 +259,9 @@ bool Path::isCPP(const std::string &path) extension == ".hxx" || extension == ".hh" || extension == ".tpp" || - extension == ".txx") { - return true; - } - + extension == ".txx" || + getFilenameExtension(path) == ".C"; // In unix, ".C" is considered C++ file - return (getFilenameExtension(path) == ".C"); } bool Path::acceptFile(const std::string &path, const std::set &extra)