Patch #3285 2012-04-28 15:11

alpha0010

Fix bug #18546: CPPCheck filter
Download
3285-Fix_bug_18546.patch (1.3 KB)
Category
Plugin::Bugfix
Status
Accepted
Close date
2012-05-18 22:53
Assigned to
tpetrov
Index: src/plugins/contrib/CppCheck/CppCheck.cpp
===================================================================
--- src/plugins/contrib/CppCheck/CppCheck.cpp    (revision 7965)
+++ src/plugins/contrib/CppCheck/CppCheck.cpp    (working copy)
@@ -31,6 +31,7 @@
 #include <wx/utils.h>
 
 #include "tinyxml/tinyxml.h"
+#include "filefilters.h"
 #include "loggers.h"
 
 #include "CppCheck.h"
@@ -215,11 +216,11 @@
     {
         ProjectFile* pf = *it;
         // filter to avoid including non C/C++ files
-        if (pf->relativeFilename.Mid(2).Lower() == wxT(".c")   ||
-            pf->relativeFilename.Mid(4).Lower() == wxT(".cpp") ||
-            pf->relativeFilename.Mid(3).Lower() == wxT(".cc")  ||
-            pf->relativeFilename.Mid(3).Lower() == wxT(".c++") ||
-            pf->relativeFilename.Mid(4).Lower() == wxT(".cxx") ||
+        if (pf->relativeFilename.EndsWith(FileFilters::C_DOT_EXT)   ||
+            pf->relativeFilename.EndsWith(FileFilters::CPP_DOT_EXT) ||
+            pf->relativeFilename.EndsWith(FileFilters::CC_DOT_EXT)  ||
+            pf->relativeFilename.EndsWith(FileFilters::CXX_DOT_EXT) ||
+            pf->relativeFilename.EndsWith(_T(".c++")) ||
             FileTypeOf(pf->relativeFilename) == ftHeader)
         {
             Input.Write(pf->relativeFilename + _T("\n"));
alpha0010 2012-05-12 17:22

Switched to wxString::EndsWith()