@@ -62,15 +62,12 @@ const char * CppCheck::extraVersion()
6262
6363unsigned int CppCheck::check (const std::string &path)
6464{
65- return processFile (path);
65+ return processFile (path, " " );
6666}
6767
6868unsigned int CppCheck::check (const std::string &path, const std::string &content)
6969{
70- _fileContent = content;
71- const unsigned int retval = processFile (path);
72- _fileContent.clear ();
73- return retval;
70+ return processFile (path, content);
7471}
7572
7673void CppCheck::replaceAll (std::string& code, const std::string &from, const std::string &to)
@@ -129,7 +126,7 @@ bool CppCheck::findError(std::string code, const char FileName[])
129126 return true ;
130127}
131128
132- unsigned int CppCheck::processFile (const std::string& filename)
129+ unsigned int CppCheck::processFile (const std::string& filename, const std::string& fileContent )
133130{
134131 exitcode = 0 ;
135132
@@ -151,9 +148,9 @@ unsigned int CppCheck::processFile(const std::string& filename)
151148 std::list<std::string> configurations;
152149 std::string filedata = " " ;
153150
154- if (!_fileContent .empty ()) {
155- // File content was given as a string
156- std::istringstream iss (_fileContent );
151+ if (!fileContent .empty ()) {
152+ // File content was given as a string (democlient)
153+ std::istringstream iss (fileContent );
157154 preprocessor.preprocess (iss, filedata, configurations, filename, _settings._includePaths );
158155 } else {
159156 // Only file name was given, read the content from file
0 commit comments