Skip to content

Commit

Permalink
fix: cppcheck错误警告修改
Browse files Browse the repository at this point in the history
单参数构造函数添加explicit关键字,局部变量声明

Log: 修复cppcheck错误及警告
Change-Id: I187ec230376c3f72488e13509b87bcfdb5dd90c5
(cherry picked from commit 3ccc478)
(cherry picked from commit f6c6854)
  • Loading branch information
wangfei authored and kegechen committed Jul 2, 2021
1 parent 118cf1d commit a0d4c79
Show file tree
Hide file tree
Showing 12 changed files with 14 additions and 14 deletions.
6 changes: 3 additions & 3 deletions examples/dnd-example/dnd-test-client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class DropArea : public QFrame
{
Q_OBJECT
public:
DropArea(QString s)
explicit DropArea(QString s)
: lb(new QLabel(s, this))
, le(new QLineEdit(this))
{
Expand Down Expand Up @@ -76,8 +76,8 @@ int main(int argc, char **argv)
lo->addWidget(new DropArea("area 51"));
lo->addWidget(new DropArea("area 61"));

QProgressBar pp;
p = &pp;
QScopedPointer<QProgressBar> pp = new QProgressBar();
p = pp.data();
p->setMinimum(0);
p->setMaximum(100);

Expand Down
2 changes: 1 addition & 1 deletion examples/test-taskbar/testtaskbarwindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class TestTaskbarWindow : public QWidget
Q_OBJECT

public:
TestTaskbarWindow(QWidget *parent = nullptr);
explicit TestTaskbarWindow(QWidget *parent = nullptr);
~TestTaskbarWindow();

protected:
Expand Down
2 changes: 1 addition & 1 deletion src/filedrag/dfiledragclient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public Q_SLOTS:

class DFileDragClientPrivate : DCORE_NAMESPACE::DObjectPrivate
{
DFileDragClientPrivate(DFileDragClient *q)
explicit DFileDragClientPrivate(DFileDragClient *q)
: DCORE_NAMESPACE::DObjectPrivate(q) {}
QUuid uuid;
QString service;
Expand Down
2 changes: 1 addition & 1 deletion src/filedrag/dfiledragserver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class DFileDragServerPrivate : public DCORE_NAMESPACE::DObjectPrivate
QMap<QString, QVariant> data;
QUuid uuid;

DFileDragServerPrivate(DFileDragServer *q);
explicit DFileDragServerPrivate(DFileDragServer *q);
~DFileDragServerPrivate();

void writeMimeData(QMimeData *dest);
Expand Down
2 changes: 1 addition & 1 deletion src/kernel/dforeignwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ DEFINE_CONST_CHAR(ProcessId);
class DForeignWindowPrivate : public DTK_CORE_NAMESPACE::DObjectPrivate
{
public:
DForeignWindowPrivate(DForeignWindow *qq)
explicit DForeignWindowPrivate(DForeignWindow *qq)
: DObjectPrivate(qq) {}
};

Expand Down
2 changes: 1 addition & 1 deletion src/kernel/dpalette.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ struct DPaletteData : public QSharedData
class DPalettePrivate
{
public:
DPalettePrivate(const QSharedDataPointer<DPaletteData> &d)
explicit DPalettePrivate(const QSharedDataPointer<DPaletteData> &d)
: data(d)
{

Expand Down
2 changes: 1 addition & 1 deletion src/kernel/dwindowgroupleader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ DEFINE_CONST_CHAR(clientLeader);
class DWindowGroupLeaderPrivate
{
public:
DWindowGroupLeaderPrivate(quint32 groupLeader)
explicit DWindowGroupLeaderPrivate(quint32 groupLeader)
: groupLeader(groupLeader) {
QFunctionPointer clientLeaderFun = qApp->platformFunction(_clientLeader);

Expand Down
2 changes: 1 addition & 1 deletion src/kernel/dwindowmanagerhelper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ static bool connectWindowMotifWMHintsChanged(QObject *object, std::function<void
class DWindowManagerHelperPrivate : public DTK_CORE_NAMESPACE::DObjectPrivate
{
public:
DWindowManagerHelperPrivate(DWindowManagerHelper *qq)
explicit DWindowManagerHelperPrivate(DWindowManagerHelper *qq)
: DObjectPrivate(qq) {}

mutable QList<DForeignWindow *> windowList;
Expand Down
2 changes: 1 addition & 1 deletion src/util/dsvgrenderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ class RSvg
class DSvgRendererPrivate : public DObjectPrivate
{
public:
DSvgRendererPrivate(DObject *qq);
explicit DSvgRendererPrivate(DObject *qq);

QImage getImage(const QSize &size, const QString &elementId) const;

Expand Down
2 changes: 1 addition & 1 deletion src/util/dsvgrenderer.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class DSvgRenderer : public QObject, public DTK_CORE_NAMESPACE::DObject
{
Q_PROPERTY(QRectF viewBox READ viewBoxF WRITE setViewBox)
public:
DSvgRenderer(QObject *parent = Q_NULLPTR);
explicit DSvgRenderer(QObject *parent = Q_NULLPTR);
DSvgRenderer(const QString &filename, QObject *parent = Q_NULLPTR);
DSvgRenderer(const QByteArray &contents, QObject *parent = Q_NULLPTR);
~DSvgRenderer();
Expand Down
2 changes: 1 addition & 1 deletion src/util/dtaskbarcontrol.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class DTaskbarControl : public QObject, public DTK_CORE_NAMESPACE::DObject
Q_OBJECT

public:
DTaskbarControl(QObject *parent = nullptr);
explicit DTaskbarControl(QObject *parent = nullptr);
~DTaskbarControl();

void setProgress(bool progressVisible, double progress);
Expand Down
2 changes: 1 addition & 1 deletion src/util/dthumbnailprovider.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ inline QByteArray dataToMd5Hex(const QByteArray &data)
class DThumbnailProviderPrivate : public DTK_CORE_NAMESPACE::DObjectPrivate
{
public:
DThumbnailProviderPrivate(DThumbnailProvider *qq);
explicit DThumbnailProviderPrivate(DThumbnailProvider *qq);

void init();

Expand Down

0 comments on commit a0d4c79

Please sign in to comment.