Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cli/cppcheckexecutor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ static void print_stacktrace(FILE* output, bool demangling, int maxdepth, bool l
// 32 vs. 64bit
#define ADDRESSDISPLAYLENGTH ((sizeof(long)==8)?12:8)
const int fd = fileno(output);
void *callstackArray[32]= {0}; // the less resources the better...
void *callstackArray[32]= {nullptr}; // the less resources the better...
const int currentdepth = backtrace(callstackArray, (int)GetArrayLength(callstackArray));
const int offset=2; // some entries on top are within our own exception handling code or libc
if (maxdepth<0)
Expand Down
5 changes: 3 additions & 2 deletions gui/aboutdialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,9 @@ class QWidget;
class AboutDialog : public QDialog {
Q_OBJECT
public:
AboutDialog(const QString &version, const QString &extraVersion,
QWidget *parent = 0);
AboutDialog(const QString &version,
const QString &extraVersion,
QWidget *parent = nullptr);

private:
Ui::About mUI;
Expand Down
5 changes: 3 additions & 2 deletions gui/applicationdialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,9 @@ class ApplicationDialog : public QDialog {
* @param app Application definition.
* @param parent Parent widget.
*/
ApplicationDialog(const QString &title, Application &app,
QWidget *parent = 0);
ApplicationDialog(const QString &title,
Application &app,
QWidget *parent = nullptr);
virtual ~ApplicationDialog();

protected slots:
Expand Down
2 changes: 1 addition & 1 deletion gui/applicationlist.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class ApplicationList : public QObject {
Q_OBJECT
public:

explicit ApplicationList(QObject *parent = 0);
explicit ApplicationList(QObject *parent = nullptr);
virtual ~ApplicationList();

/**
Expand Down
2 changes: 1 addition & 1 deletion gui/checkstatistics.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
*/
class CheckStatistics : public QObject {
public:
explicit CheckStatistics(QObject *parent = NULL);
explicit CheckStatistics(QObject *parent = nullptr);

/**
* @brief Add new checked item to statistics.
Expand Down
2 changes: 1 addition & 1 deletion gui/fileviewdialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class FileViewDialog : public QDialog {
public:
FileViewDialog(const QString &file,
const QString &title,
QWidget *parent = 0);
QWidget *parent = nullptr);


protected:
Expand Down
2 changes: 1 addition & 1 deletion gui/libraryaddfunctiondialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class LibraryAddFunctionDialog : public QDialog {
Q_OBJECT

public:
explicit LibraryAddFunctionDialog(QWidget *parent = 0);
explicit LibraryAddFunctionDialog(QWidget *parent = nullptr);
LibraryAddFunctionDialog(const LibraryAddFunctionDialog &) = delete;
~LibraryAddFunctionDialog();
LibraryAddFunctionDialog &operator=(const LibraryAddFunctionDialog &) = delete;
Expand Down
2 changes: 1 addition & 1 deletion gui/librarydialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class LibraryDialog : public QDialog {
Q_OBJECT

public:
explicit LibraryDialog(QWidget *parent = 0);
explicit LibraryDialog(QWidget *parent = nullptr);
LibraryDialog(const LibraryDialog &) = delete;
~LibraryDialog();
LibraryDialog &operator=(const LibraryDialog &) = delete;
Expand Down
2 changes: 1 addition & 1 deletion gui/newsuppressiondialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class NewSuppressionDialog : public QDialog {
Q_OBJECT

public:
explicit NewSuppressionDialog(QWidget *parent = 0);
explicit NewSuppressionDialog(QWidget *parent = nullptr);
NewSuppressionDialog(const NewSuppressionDialog &) = delete;
~NewSuppressionDialog();
NewSuppressionDialog &operator=(const NewSuppressionDialog &) = delete;
Expand Down
2 changes: 1 addition & 1 deletion gui/platforms.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class Platforms : public QObject {
Q_OBJECT

public:
explicit Platforms(QObject *parent = NULL);
explicit Platforms(QObject *parent = nullptr);
void add(const QString &title, Settings::PlatformType platform);
int getCount() const;
void init();
Expand Down
4 changes: 2 additions & 2 deletions gui/projectfile.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ class ProjectFile : public QObject {
Q_OBJECT

public:
explicit ProjectFile(QObject *parent = 0);
explicit ProjectFile(const QString &filename, QObject *parent = 0);
explicit ProjectFile(QObject *parent = nullptr);
explicit ProjectFile(const QString &filename, QObject *parent = nullptr);

/**
* @brief Read the project file.
Expand Down
2 changes: 1 addition & 1 deletion gui/projectfiledialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class ProjectFile;
class ProjectFileDialog : public QDialog {
Q_OBJECT
public:
explicit ProjectFileDialog(ProjectFile *projectFile, QWidget *parent = 0);
explicit ProjectFileDialog(ProjectFile *projectFile, QWidget *parent = nullptr);
virtual ~ProjectFileDialog();

private:
Expand Down
6 changes: 3 additions & 3 deletions gui/resultstree.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,13 @@ ResultsTree::ResultsTree(QWidget * parent) :
QTreeView(parent),
mSettings(nullptr),
mApplications(nullptr),
mContextItem(0),
mContextItem(nullptr),
mShowFullPath(false),
mSaveFullPath(false),
mSaveAllErrors(true),
mShowErrorId(false),
mVisibleErrors(false),
mSelectionModel(0),
mSelectionModel(nullptr),
mThread(nullptr),
mShowCppcheck(true),
mShowClang(true)
Expand Down Expand Up @@ -330,7 +330,7 @@ QStandardItem *ResultsTree::findFileItem(const QString &name) const
#endif
return mModel.item(i, 0);
}
return 0;
return nullptr;
}

void ResultsTree::clear()
Expand Down
2 changes: 1 addition & 1 deletion gui/resultstree.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ class ThreadHandler;
class ResultsTree : public QTreeView {
Q_OBJECT
public:
explicit ResultsTree(QWidget * parent = 0);
explicit ResultsTree(QWidget * parent = nullptr);
virtual ~ResultsTree();
void initialize(QSettings *settings, ApplicationList *list, ThreadHandler *checkThreadHandler);

Expand Down
4 changes: 2 additions & 2 deletions gui/resultsview.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ void ResultsView::save(const QString &filename, Report::Type type) const
msgBox.exec();
}

Report *report = NULL;
Report *report = nullptr;

switch (type) {
case Report::CSV:
Expand All @@ -185,7 +185,7 @@ void ResultsView::save(const QString &filename, Report::Type type) const
msgBox.exec();
}
delete report;
report = NULL;
report = nullptr;
} else {
QMessageBox msgBox;
msgBox.setText(tr("Failed to save the report."));
Expand Down
2 changes: 1 addition & 1 deletion gui/resultsview.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class ResultsView : public QWidget {
Q_OBJECT
public:

explicit ResultsView(QWidget * parent = 0);
explicit ResultsView(QWidget * parent = nullptr);
void initialize(QSettings *settings, ApplicationList *list, ThreadHandler *checkThreadHandler);
ResultsView(const ResultsView &) = delete;
virtual ~ResultsView();
Expand Down
2 changes: 1 addition & 1 deletion gui/settingsdialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ void SettingsDialog::removeApplication()
void SettingsDialog::editApplication()
{
QList<QListWidgetItem *> selected = mUI.mListWidget->selectedItems();
QListWidgetItem *item = 0;
QListWidgetItem *item = nullptr;
foreach (item, selected) {
int row = mUI.mListWidget->row(item);
Application& app = mTempApplications->getApplication(row);
Expand Down
2 changes: 1 addition & 1 deletion gui/settingsdialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class SettingsDialog : public QDialog {
public:
SettingsDialog(ApplicationList *list,
TranslationHandler *translator,
QWidget *parent = 0);
QWidget *parent = nullptr);
SettingsDialog(const SettingsDialog &) = delete;
virtual ~SettingsDialog();
SettingsDialog &operator=(const SettingsDialog &) = delete;
Expand Down
2 changes: 1 addition & 1 deletion gui/statsdialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ void StatsDialog::pdfExport()
.arg(tr("Information messages"))
.arg(mStatistics->getCount(CPPCHECK,ShowTypes::ShowInformation));

QString fileName = QFileDialog::getSaveFileName((QWidget*)0, tr("Export PDF"), QString(), "*.pdf");
QString fileName = QFileDialog::getSaveFileName((QWidget*)nullptr, tr("Export PDF"), QString(), "*.pdf");
if (QFileInfo(fileName).suffix().isEmpty()) {
fileName.append(".pdf");
}
Expand Down
2 changes: 1 addition & 1 deletion gui/statsdialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class CheckStatistics;
class StatsDialog : public QDialog {
Q_OBJECT
public:
explicit StatsDialog(QWidget *parent = 0);
explicit StatsDialog(QWidget *parent = nullptr);

/**
* @brief Sets the project to extract statistics from
Expand Down
2 changes: 1 addition & 1 deletion gui/threadhandler.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class Settings;
class ThreadHandler : public QObject {
Q_OBJECT
public:
explicit ThreadHandler(QObject *parent = 0);
explicit ThreadHandler(QObject *parent = nullptr);
virtual ~ThreadHandler();

/**
Expand Down
4 changes: 2 additions & 2 deletions gui/translationhandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ static void unused()
TranslationHandler::TranslationHandler(QObject *parent) :
QObject(parent),
mCurrentLanguage("en"),
mTranslator(NULL)
mTranslator(nullptr)
{
// Add our available languages
// Keep this list sorted
Expand Down Expand Up @@ -90,7 +90,7 @@ bool TranslationHandler::setLanguage(const QString &code)
if (mTranslator) {
qApp->removeTranslator(mTranslator);
delete mTranslator;
mTranslator = NULL;
mTranslator = nullptr;
}

mCurrentLanguage = code;
Expand Down
2 changes: 1 addition & 1 deletion gui/translationhandler.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ struct TranslationInfo {
class TranslationHandler : QObject {
Q_OBJECT
public:
explicit TranslationHandler(QObject *parent = 0);
explicit TranslationHandler(QObject *parent = nullptr);
virtual ~TranslationHandler();

/**
Expand Down
4 changes: 2 additions & 2 deletions gui/xmlreportv2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ static const QString VerboseAttribute = "verbose";

XmlReportV2::XmlReportV2(const QString &filename) :
XmlReport(filename),
mXmlReader(NULL),
mXmlWriter(NULL)
mXmlReader(nullptr),
mXmlWriter(nullptr)
{
}

Expand Down
2 changes: 1 addition & 1 deletion lib/ctu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -522,7 +522,7 @@ std::list<ErrorLogger::ErrorMessage::FileLocation> CTU::FileInfo::getErrorPath(I
{
std::list<ErrorLogger::ErrorMessage::FileLocation> locationList;

const CTU::FileInfo::CallBase *path[10] = {0};
const CTU::FileInfo::CallBase *path[10] = {nullptr};

if (!findPath(unsafeUsage.myId, unsafeUsage.myArgNr, unsafeUsage.value, invalidValue, callsMap, path, 0, warning))
return locationList;
Expand Down
2 changes: 1 addition & 1 deletion lib/mathlib.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,7 @@ MathLib::bigint MathLib::characterLiteralToLongNumber(const std::string& str)

// '\123'
if (str.size() == 4 && str[0] == '\\' && isoctal(str[1]) && isoctal(str[2]) && isoctal(str[3])) {
return (char)std::strtoul(str.substr(1).c_str(), NULL, 8);
return (char)std::strtoul(str.substr(1).c_str(), nullptr, 8);
}

// C99 6.4.4.4
Expand Down
2 changes: 1 addition & 1 deletion lib/symboldatabase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -967,7 +967,7 @@ void SymbolDatabase::createSymbolDatabaseVariableSymbolTable()
(tok->next()->str() == "." ||
(tok->next()->str() == "[" && tok->linkAt(1)->strAt(1) == "."))) {
const Token *tok1 = tok->next()->str() == "." ? tok->tokAt(2) : tok->linkAt(1)->tokAt(2);
if (tok1 && tok1->varId() && mVariableList[tok1->varId()] == 0) {
if (tok1 && tok1->varId() && mVariableList[tok1->varId()] == nullptr) {
const Variable *var = mVariableList[tok->varId()];
if (var && var->typeScope()) {
// find the member variable of this variable
Expand Down
6 changes: 3 additions & 3 deletions lib/valueflow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3579,7 +3579,7 @@ static void valueFlowForwardAssign(Token * const tok,
if (it->isIntValue())
it->intvalue = (it->intvalue != 0);
if (it->isTokValue())
it ->intvalue = (it->tokvalue != 0);
it ->intvalue = (it->tokvalue != nullptr);
}
}

Expand Down Expand Up @@ -5432,9 +5432,9 @@ void ValueFlow::setValues(TokenList *tokenlist, SymbolDatabase* symboldatabase,
valueFlowFwdAnalysis(tokenlist, settings);

// Temporary hack.. run valueflow until there is nothing to update or timeout expires
const std::time_t timeout = std::time(0) + TIMEOUT;
const std::time_t timeout = std::time(nullptr) + TIMEOUT;
std::size_t values = 0;
while (std::time(0) < timeout && values < getTotalValues(tokenlist)) {
while (std::time(nullptr) < timeout && values < getTotalValues(tokenlist)) {
values = getTotalValues(tokenlist);
valueFlowArrayBool(tokenlist);
valueFlowRightShift(tokenlist, settings);
Expand Down
2 changes: 1 addition & 1 deletion test/testbufferoverrun.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3918,7 +3918,7 @@ class TestBufferOverrun : public TestFixture {
void getErrorMessages() {
// Ticket #2292: segmentation fault when using --errorlist
CheckBufferOverrun c;
c.getErrorMessages(this, 0);
c.getErrorMessages(this, nullptr);
}

void arrayIndexThenCheck() {
Expand Down
6 changes: 3 additions & 3 deletions test/testclass.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3320,7 +3320,7 @@ class TestClass : public TestFixture {
"[test.cpp:3]: (warning) Suspicious pointer subtraction. Did you intend to write '->'?\n", errout.str());
}

void checkConst(const char code[], Settings *s = 0, bool inconclusive = true) {
void checkConst(const char code[], Settings *s = nullptr, bool inconclusive = true) {
// Clear the error log
errout.str("");

Expand Down Expand Up @@ -5552,7 +5552,7 @@ class TestClass : public TestFixture {
" void set(const Key& key) {\n"
" inherited::set(inherited::Key(key));\n"
" }\n"
"};\n", 0, false);
"};\n", nullptr, false);
ASSERT_EQUALS("", errout.str());
}

Expand Down Expand Up @@ -6774,7 +6774,7 @@ class TestClass : public TestFixture {
ASSERT_EQUALS("", errout.str());
}

void checkVirtualFunctionCall(const char code[], Settings *s = 0, bool inconclusive = true) {
void checkVirtualFunctionCall(const char code[], Settings *s = nullptr, bool inconclusive = true) {
// Clear the error log
errout.str("");

Expand Down
2 changes: 1 addition & 1 deletion test/testgarbage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ class TestGarbage : public TestFixture {

tokenizer.simplifyTokenList2();

return tokenizer.tokens()->stringifyList(false, false, false, true, false, 0, 0);
return tokenizer.tokens()->stringifyList(false, false, false, true, false, nullptr, nullptr);
}

std::string getSyntaxError(const char code[]) {
Expand Down
2 changes: 1 addition & 1 deletion test/testmemleak.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ class TestMemleak : private TestFixture {

// there is no allocation
const Token *tok = Token::findsimplematch(tokenizer.tokens(), "ret =");
const CheckMemoryLeak check(&tokenizer, 0, &settings);
const CheckMemoryLeak check(&tokenizer, nullptr, &settings);
ASSERT_EQUALS(CheckMemoryLeak::No, check.getAllocationType(tok->tokAt(2), 1));
}
};
Expand Down
4 changes: 2 additions & 2 deletions test/testother.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1875,7 +1875,7 @@ class TestOther : public TestFixture {
" case 3:\n"
" strcpy(str, \"b'\");\n"
" }\n"
"}", 0, false, false, false);
"}", nullptr, false, false, false);
// TODO ASSERT_EQUALS("[test.cpp:6] -> [test.cpp:8]: (warning) Buffer 'str' is being written before its old content has been used. 'break;' missing?\n", errout.str());

check("void foo(int a) {\n"
Expand Down Expand Up @@ -3346,7 +3346,7 @@ class TestOther : public TestFixture {

check("void f(char c) {\n"
" printf(\"%i\", 1 + 1 ? 1 : 2);\n" // "1+1" is simplified away
"}",0,false,false,false);
"}",nullptr,false,false,false);
ASSERT_EQUALS("[test.cpp:2]: (style) Clarify calculation precedence for '+' and '?'.\n", errout.str());

check("void f() {\n"
Expand Down
4 changes: 2 additions & 2 deletions test/testpreprocessor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ class TestPreprocessor : public TestFixture {
class OurPreprocessor : public Preprocessor {
public:

static std::string expandMacros(const char code[], ErrorLogger *errorLogger = 0) {
static std::string expandMacros(const char code[], ErrorLogger *errorLogger = nullptr) {
std::istringstream istr(code);
simplecpp::OutputList outputList;
std::vector<std::string> files;
Expand Down Expand Up @@ -269,7 +269,7 @@ class TestPreprocessor : public TestFixture {
}
}

std::string getConfigsStr(const char filedata[], const char *arg=NULL) {
std::string getConfigsStr(const char filedata[], const char *arg = nullptr) {
Settings settings;
if (arg && std::strncmp(arg,"-D",2)==0)
settings.userDefines = arg + 2;
Expand Down
Loading