Skip to content

Commit fc62be8

Browse files
committed
fixes
1 parent 4524397 commit fc62be8

File tree

3 files changed

+6
-4
lines changed

3 files changed

+6
-4
lines changed

lib/cppcheck.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -331,7 +331,7 @@ static std::vector<std::string> split(const std::string &str, const std::string
331331
return ret;
332332
}
333333

334-
static std::string getDumpFileName(const Settings& settings, const std::string& filename, std::string cfgHash = "")
334+
static std::string getDumpFileName(const Settings& settings, const std::string& filename, const std::string &cfgHash = "")
335335
{
336336
std::string extension;
337337
if ((settings.dump || !settings.buildDir.empty()) && !cfgHash.empty())
@@ -353,7 +353,7 @@ static void createDumpFile(const Settings& settings,
353353
const FileWithDetails& file,
354354
std::ofstream& fdump,
355355
std::string& dumpFile,
356-
std::string cfgHash = "")
356+
const std::string &cfgHash = "")
357357
{
358358
if (!settings.dump && settings.addons.empty())
359359
return;
@@ -849,7 +849,7 @@ static std::size_t calculateHash(const Preprocessor& preprocessor, const simplec
849849
return preprocessor.calculateHash(tokens, toolinfo.str());
850850
}
851851

852-
unsigned int CppCheck::checkFile(const FileWithDetails& file, const std::string &cfgname, std::string cfgHash, std::istream* fileStream)
852+
unsigned int CppCheck::checkFile(const FileWithDetails& file, const std::string &cfgname, const std::string &cfgHash, std::istream* fileStream)
853853
{
854854
// TODO: move to constructor when CppCheck no longer owns the settings
855855
if (mSettings.checks.isEnabled(Checks::unusedFunction) && !mUnusedFunctionsCheck)

lib/cppcheck.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ class CPPCHECKLIB CppCheck {
174174
* @param fileStream stream the file content can be read from
175175
* @return number of errors found
176176
*/
177-
unsigned int checkFile(const FileWithDetails& file, const std::string &cfgname, std::string cfgHash = "", std::istream* fileStream = nullptr);
177+
unsigned int checkFile(const FileWithDetails& file, const std::string &cfgname, const std::string &cfgHash = "", std::istream* fileStream = nullptr);
178178

179179
/**
180180
* @brief Check normal tokens

lib/filesettings.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,10 +83,12 @@ class FileWithDetails
8383
struct CPPCHECKLIB FileSettings {
8484
explicit FileSettings(std::string path)
8585
: file(std::move(path))
86+
, hash(0)
8687
{}
8788

8889
FileSettings(std::string path, Standards::Language lang, std::size_t size)
8990
: file(std::move(path), lang, size)
91+
, hash(0)
9092
{}
9193

9294
void computeHash() {

0 commit comments

Comments
 (0)