From d8fc126cf08e89ec2d5e3b97de3da1ab339b6b6b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Marjam=C3=A4ki?= Date: Sun, 3 Mar 2013 07:32:14 +0100 Subject: [PATCH] Fixed #4612 (Adding file extensions to Cppcheck analysis) --- cli/filelister.cpp | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/cli/filelister.cpp b/cli/filelister.cpp index e71429663..8e0c477d1 100644 --- a/cli/filelister.cpp +++ b/cli/filelister.cpp @@ -78,7 +78,10 @@ void FileLister::recursiveAddFiles(std::map &files, co // searchPattern is the search string passed into FindFirst and FindNext. std::string searchPattern = cleanedPath; - if (MyIsDirectory(cleanedPath)) { + // The user wants to check all files in a dir + const bool checkAllFilesInDir = (MyIsDirectory(cleanedPath) != FALSE); + + if (checkAllFilesInDir) { char c = cleanedPath[ cleanedPath.size()-1 ]; switch (c) { case '\\': @@ -120,12 +123,14 @@ void FileLister::recursiveAddFiles(std::map &files, co // File const std::string nativename = Path::fromNativeSeparators(fname); - // Limitation: file sizes are assumed to fit in a 'size_t' + if (!checkAllFilesInDir || Path::acceptFile(fname)) { + // Limitation: file sizes are assumed to fit in a 'size_t' #ifdef _WIN64 - files[nativename] = (static_cast(ffd.nFileSizeHigh) << 32) | ffd.nFileSizeLow; + files[nativename] = (static_cast(ffd.nFileSizeHigh) << 32) | ffd.nFileSizeLow; #else - files[nativename] = ffd.nFileSizeLow; + files[nativename] = ffd.nFileSizeLow; #endif + } } else { // Directory FileLister::recursiveAddFiles(files, fname);