Skip to content

Commit a195477

Browse files
scottfurrydanmar
authored andcommitted
Correct Zero/Null as pointer constant (cppcheck-opensource#1938)
Building with enhanced clang warnings indicated a large number of instances with the warning: `warning: zero as null pointer constant` Recommended practice in C++11 is to use `nullptr` as value for a NULL or empty pointer value. All instances where this warning was encountered were corrected in this commit. Where warning was encountered in dependency code (i.e. external library) no chnages were made. Patching will be offered upstream.
1 parent 7fe0211 commit a195477

43 files changed

Lines changed: 130 additions & 128 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

cli/cppcheckexecutor.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ static void print_stacktrace(FILE* output, bool demangling, int maxdepth, bool l
227227
// 32 vs. 64bit
228228
#define ADDRESSDISPLAYLENGTH ((sizeof(long)==8)?12:8)
229229
const int fd = fileno(output);
230-
void *callstackArray[32]= {0}; // the less resources the better...
230+
void *callstackArray[32]= {nullptr}; // the less resources the better...
231231
const int currentdepth = backtrace(callstackArray, (int)GetArrayLength(callstackArray));
232232
const int offset=2; // some entries on top are within our own exception handling code or libc
233233
if (maxdepth<0)

gui/aboutdialog.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,9 @@ class QWidget;
3535
class AboutDialog : public QDialog {
3636
Q_OBJECT
3737
public:
38-
AboutDialog(const QString &version, const QString &extraVersion,
39-
QWidget *parent = 0);
38+
AboutDialog(const QString &version,
39+
const QString &extraVersion,
40+
QWidget *parent = nullptr);
4041

4142
private:
4243
Ui::About mUI;

gui/applicationdialog.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,9 @@ class ApplicationDialog : public QDialog {
4545
* @param app Application definition.
4646
* @param parent Parent widget.
4747
*/
48-
ApplicationDialog(const QString &title, Application &app,
49-
QWidget *parent = 0);
48+
ApplicationDialog(const QString &title,
49+
Application &app,
50+
QWidget *parent = nullptr);
5051
virtual ~ApplicationDialog();
5152

5253
protected slots:

gui/applicationlist.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ class ApplicationList : public QObject {
3333
Q_OBJECT
3434
public:
3535

36-
explicit ApplicationList(QObject *parent = 0);
36+
explicit ApplicationList(QObject *parent = nullptr);
3737
virtual ~ApplicationList();
3838

3939
/**

gui/checkstatistics.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
*/
3131
class CheckStatistics : public QObject {
3232
public:
33-
explicit CheckStatistics(QObject *parent = NULL);
33+
explicit CheckStatistics(QObject *parent = nullptr);
3434

3535
/**
3636
* @brief Add new checked item to statistics.

gui/fileviewdialog.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ class FileViewDialog : public QDialog {
4141
public:
4242
FileViewDialog(const QString &file,
4343
const QString &title,
44-
QWidget *parent = 0);
44+
QWidget *parent = nullptr);
4545

4646

4747
protected:

gui/libraryaddfunctiondialog.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ class LibraryAddFunctionDialog : public QDialog {
1515
Q_OBJECT
1616

1717
public:
18-
explicit LibraryAddFunctionDialog(QWidget *parent = 0);
18+
explicit LibraryAddFunctionDialog(QWidget *parent = nullptr);
1919
LibraryAddFunctionDialog(const LibraryAddFunctionDialog &) = delete;
2020
~LibraryAddFunctionDialog();
2121
LibraryAddFunctionDialog &operator=(const LibraryAddFunctionDialog &) = delete;

gui/librarydialog.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ class LibraryDialog : public QDialog {
3434
Q_OBJECT
3535

3636
public:
37-
explicit LibraryDialog(QWidget *parent = 0);
37+
explicit LibraryDialog(QWidget *parent = nullptr);
3838
LibraryDialog(const LibraryDialog &) = delete;
3939
~LibraryDialog();
4040
LibraryDialog &operator=(const LibraryDialog &) = delete;

gui/newsuppressiondialog.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ class NewSuppressionDialog : public QDialog {
1212
Q_OBJECT
1313

1414
public:
15-
explicit NewSuppressionDialog(QWidget *parent = 0);
15+
explicit NewSuppressionDialog(QWidget *parent = nullptr);
1616
NewSuppressionDialog(const NewSuppressionDialog &) = delete;
1717
~NewSuppressionDialog();
1818
NewSuppressionDialog &operator=(const NewSuppressionDialog &) = delete;

gui/platforms.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ class Platforms : public QObject {
4444
Q_OBJECT
4545

4646
public:
47-
explicit Platforms(QObject *parent = NULL);
47+
explicit Platforms(QObject *parent = nullptr);
4848
void add(const QString &title, Settings::PlatformType platform);
4949
int getCount() const;
5050
void init();

0 commit comments

Comments
 (0)