summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@qt.io>2019-06-04 14:31:18 +0200
committerFriedemann Kleint <Friedemann.Kleint@qt.io>2019-06-04 15:10:15 +0200
commit20f6c67635240865d33a370230a156de0f051d07 (patch)
treed2f6780e02d00de161bca1391db8d1acb1678d56
parentf1c8d2893d385ccfec2049655392ffca309675bd (diff)
Introduce member initialization
Fix warnings emitted by clang, use default constructors where applicable. Remove some unused members. Change-Id: I287ffa4d884be253ec5272e4266a1645376e7235 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
-rw-r--r--examples/activeqt/multiple/ax1.h4
-rw-r--r--examples/activeqt/multiple/ax2.h7
-rw-r--r--src/activeqt/container/qaxbase.cpp56
-rw-r--r--src/activeqt/container/qaxscript.cpp5
-rw-r--r--src/activeqt/container/qaxwidget.cpp37
-rw-r--r--src/activeqt/container/qaxwidget.h4
-rw-r--r--src/activeqt/control/qaxbindable.cpp5
-rw-r--r--src/activeqt/control/qaxbindable.h2
-rw-r--r--src/activeqt/control/qaxserverbase.cpp71
-rw-r--r--src/activeqt/control/qclassfactory_p.h4
-rw-r--r--tools/dumpcpp/main.cpp8
-rw-r--r--tools/testcon/mainwindow.cpp4
-rw-r--r--tools/testcon/mainwindow.h12
13 files changed, 84 insertions, 135 deletions
diff --git a/examples/activeqt/multiple/ax1.h b/examples/activeqt/multiple/ax1.h
index cbcc9e8..ba2a7f5 100644
--- a/examples/activeqt/multiple/ax1.h
+++ b/examples/activeqt/multiple/ax1.h
@@ -65,7 +65,7 @@ class QAxWidget1 : public QWidget
Q_PROPERTY(QColor fillColor READ fillColor WRITE setFillColor)
public:
explicit QAxWidget1(QWidget *parent = nullptr)
- : QWidget(parent), m_fillColor(Qt::red)
+ : QWidget(parent)
{
}
@@ -90,7 +90,7 @@ protected:
}
private:
- QColor m_fillColor;
+ QColor m_fillColor = Qt::red;
};
//! [0]
diff --git a/examples/activeqt/multiple/ax2.h b/examples/activeqt/multiple/ax2.h
index 1e1b312..13e011b 100644
--- a/examples/activeqt/multiple/ax2.h
+++ b/examples/activeqt/multiple/ax2.h
@@ -67,10 +67,7 @@ class QAxWidget2 : public QWidget
Q_PROPERTY(int lineWidth READ lineWidth WRITE setLineWidth)
public:
- explicit QAxWidget2(QWidget *parent = nullptr)
- : QWidget(parent), m_lineWidth(1)
- {
- }
+ using QWidget::QWidget;
int lineWidth() const
{
@@ -97,7 +94,7 @@ protected:
}
private:
- int m_lineWidth;
+ int m_lineWidth = 1;
};
//! [0]
diff --git a/src/activeqt/container/qaxbase.cpp b/src/activeqt/container/qaxbase.cpp
index d87217f..2709fa6 100644
--- a/src/activeqt/container/qaxbase.cpp
+++ b/src/activeqt/container/qaxbase.cpp
@@ -259,9 +259,7 @@ class QAxEventSink : public IDispatch, public IPropertyNotifySink
{
Q_DISABLE_COPY(QAxEventSink)
public:
- QAxEventSink(QAxBase *com)
- : cpoint(0), ciid(IID_NULL), combase(com), ref(1)
- {}
+ explicit QAxEventSink(QAxBase *com) : combase(com) {}
virtual ~QAxEventSink()
{
Q_ASSERT(!cpoint);
@@ -570,16 +568,16 @@ public:
return static_cast<QAxObject *>(qobject)->receivers(QByteArray::number(QSIGNAL_CODE) + signalName);
}
- IConnectionPoint *cpoint;
- IID ciid;
- ULONG cookie;
+ IConnectionPoint *cpoint = nullptr;
+ IID ciid = IID_NULL;
+ ULONG cookie = 0;
QMap<DISPID, QByteArray> sigs;
QMap<DISPID, QByteArray> propsigs;
QMap<DISPID, QByteArray> props;
- QAxBase *combase;
- LONG ref;
+ QAxBase *combase = nullptr;
+ LONG ref = 1;
};
/*
@@ -595,9 +593,7 @@ public:
QAxBasePrivate()
: useEventSink(true), useMetaObject(true), useClassInfo(true),
- cachedMetaObject(false), initialized(false), tryCache(false),
- classContext(CLSCTX_SERVER),
- ptr(0), disp(0), metaobj(0)
+ cachedMetaObject(false), initialized(false), tryCache(false)
{
// protect initialization
QMutexLocker locker(&cache_mutex);
@@ -640,10 +636,10 @@ public:
uint cachedMetaObject :1;
uint initialized :1;
uint tryCache :1;
- unsigned long classContext;
+ unsigned long classContext = CLSCTX_SERVER;
- IUnknown *ptr;
- mutable IDispatch *disp;
+ IUnknown *ptr = nullptr;
+ mutable IDispatch *disp = nullptr;
QMap<QByteArray, bool> propWritable;
@@ -656,7 +652,7 @@ public:
mutable QMap<QString, LONG> verbs;
- QAxMetaObject *metaobj;
+ QAxMetaObject *metaobj = nullptr;
};
@@ -1696,10 +1692,10 @@ private:
static int aggregateParameterCount(const QMap<QByteArray, Method> &map);
struct Property {
- Property() : flags(0)
- {}
+ Property() = default;
+
QByteArray type;
- uint flags;
+ uint flags = 0;
QByteArray realType;
};
QMap<QByteArray, Property> property_list;
@@ -1742,13 +1738,13 @@ private:
return enum_list.contains(enumname);
}
- QAxBase *that;
- QAxBasePrivate *d;
+ QAxBase *that = nullptr;
+ QAxBasePrivate *d = nullptr;
- IDispatch *disp;
- ITypeInfo *dispInfo;
- ITypeInfo *classInfo;
- ITypeLib *typelib;
+ IDispatch *disp = nullptr;
+ ITypeInfo *dispInfo = nullptr;
+ ITypeInfo *classInfo = nullptr;
+ ITypeLib *typelib = nullptr;
QByteArray current_typelib;
QSettings iidnames;
@@ -1860,15 +1856,15 @@ void qax_deleteMetaObject(QMetaObject *metaObject)
}
MetaObjectGenerator::MetaObjectGenerator(QAxBase *ax, QAxBasePrivate *dptr)
-: that(ax), d(dptr), disp(0), dispInfo(0), classInfo(0), typelib(0),
- iidnames(QLatin1String("HKEY_LOCAL_MACHINE\\Software\\Classes"), QSettings::NativeFormat)
+ : that(ax), d(dptr),
+ iidnames(QLatin1String("HKEY_LOCAL_MACHINE\\Software\\Classes"), QSettings::NativeFormat)
{
init();
}
MetaObjectGenerator::MetaObjectGenerator(ITypeLib *tlib, ITypeInfo *tinfo)
-: that(0), d(0), disp(0), dispInfo(tinfo), classInfo(0), typelib(tlib),
- iidnames(QLatin1String("HKEY_LOCAL_MACHINE\\Software\\Classes"), QSettings::NativeFormat)
+ : dispInfo(tinfo), typelib(tlib),
+ iidnames(QLatin1String("HKEY_LOCAL_MACHINE\\Software\\Classes"), QSettings::NativeFormat)
{
init();
@@ -4305,7 +4301,7 @@ class QtPropertyBag : public IPropertyBag
{
Q_DISABLE_COPY(QtPropertyBag)
public:
- QtPropertyBag() :ref(0) {}
+ QtPropertyBag() = default;
virtual ~QtPropertyBag() = default;
HRESULT __stdcall QueryInterface(REFIID iid, LPVOID *iface) override
@@ -4358,7 +4354,7 @@ public:
QAxBase::PropertyBag map;
private:
- LONG ref;
+ LONG ref = 0;
};
/*!
diff --git a/src/activeqt/container/qaxscript.cpp b/src/activeqt/container/qaxscript.cpp
index 0f0aa08..33a10e0 100644
--- a/src/activeqt/container/qaxscript.cpp
+++ b/src/activeqt/container/qaxscript.cpp
@@ -125,14 +125,13 @@ protected:
private:
QAxScript *script;
- LONG ref;
+ LONG ref = 1;
};
/*
Constructs the site for the \a s.
*/
-QAxScriptSite::QAxScriptSite(QAxScript *s)
-: script(s), ref(1)
+QAxScriptSite::QAxScriptSite(QAxScript *s) : script(s)
{
}
diff --git a/src/activeqt/container/qaxwidget.cpp b/src/activeqt/container/qaxwidget.cpp
index 54a49e3..31fd8fe 100644
--- a/src/activeqt/container/qaxwidget.cpp
+++ b/src/activeqt/container/qaxwidget.cpp
@@ -409,26 +409,26 @@ private:
QMenu *generatePopup(HMENU subMenu, QWidget *parent);
- IOleObject *m_spOleObject;
- IOleControl *m_spOleControl;
- IOleInPlaceObjectWindowless *m_spInPlaceObject;
- IOleInPlaceActiveObject *m_spInPlaceActiveObject;
- IOleDocumentView *m_spActiveView;
+ IOleObject *m_spOleObject = nullptr;
+ IOleControl *m_spOleControl = nullptr;
+ IOleInPlaceObjectWindowless *m_spInPlaceObject = nullptr;
+ IOleInPlaceActiveObject *m_spInPlaceActiveObject = nullptr;
+ IOleDocumentView *m_spActiveView = nullptr;
- QAxAggregated *aggregatedObject;
+ QAxAggregated *aggregatedObject = nullptr;
bool inPlaceObjectWindowless :1;
bool inPlaceModelessEnabled :1;
bool canHostDocument : 1;
- DWORD m_dwOleObject;
- HWND m_menuOwner;
+ DWORD m_dwOleObject = 0;
+ HWND m_menuOwner = nullptr;
CONTROLINFO control_info;
QSize sizehint;
- LONG ref;
+ LONG ref = 1;
QAxWidget *widget;
- QAxHostWidget *host;
+ QAxHostWidget *host = nullptr;
QPointer<QMenuBar> menuBar;
MenuItemMap menuItemMap;
};
@@ -552,7 +552,7 @@ bool QAxNativeEventFilter::nativeEventFilter(const QByteArray &, void *m, long *
}
QAxClientSite::QAxClientSite(QAxWidget *c)
-: eventTranslated(true), ref(1), widget(c), host(0)
+: eventTranslated(true), widget(c)
{
aggregatedObject = widget->createAggregate();
if (aggregatedObject) {
@@ -560,19 +560,10 @@ QAxClientSite::QAxClientSite(QAxWidget *c)
aggregatedObject->the_object = c;
}
- m_spOleObject = 0;
- m_spOleControl = 0;
- m_spInPlaceObject = 0;
- m_spInPlaceActiveObject = 0;
- m_spActiveView = 0;
-
inPlaceObjectWindowless = false;
inPlaceModelessEnabled = true;
canHostDocument = false;
- m_dwOleObject = 0;
- m_menuOwner = 0;
- menuBar = 0;
memset(&control_info, 0, sizeof(control_info));
}
@@ -1937,7 +1928,7 @@ const QMetaObject QAxWidget::staticMetaObject = {
call setControl().
*/
QAxWidget::QAxWidget(QWidget *parent, Qt::WindowFlags f)
-: QWidget(parent, f), container(0)
+: QWidget(parent, f)
{
}
@@ -1948,7 +1939,7 @@ QAxWidget::QAxWidget(QWidget *parent, Qt::WindowFlags f)
\sa setControl()
*/
QAxWidget::QAxWidget(const QString &c, QWidget *parent, Qt::WindowFlags f)
-: QWidget(parent, f), container(0)
+: QWidget(parent, f)
{
setControl(c);
}
@@ -1958,7 +1949,7 @@ QAxWidget::QAxWidget(const QString &c, QWidget *parent, Qt::WindowFlags f)
\a parent and \a f are propagated to the QWidget contructor.
*/
QAxWidget::QAxWidget(IUnknown *iface, QWidget *parent, Qt::WindowFlags f)
-: QWidget(parent, f), QAxBase(iface), container(0)
+: QWidget(parent, f), QAxBase(iface)
{
}
diff --git a/src/activeqt/container/qaxwidget.h b/src/activeqt/container/qaxwidget.h
index 49caa22..14c4290 100644
--- a/src/activeqt/container/qaxwidget.h
+++ b/src/activeqt/container/qaxwidget.h
@@ -96,9 +96,9 @@ protected:
const QMetaObject *fallbackMetaObject() const override;
private:
friend class QAxClientSite;
- QAxClientSite *container;
+ QAxClientSite *container = nullptr;
- QAxWidgetPrivate *d;
+ QAxWidgetPrivate *m_unused = nullptr;
const QMetaObject *parentMetaObject() const override;
};
diff --git a/src/activeqt/control/qaxbindable.cpp b/src/activeqt/control/qaxbindable.cpp
index 2bb1ffe..20e8b7c 100644
--- a/src/activeqt/control/qaxbindable.cpp
+++ b/src/activeqt/control/qaxbindable.cpp
@@ -94,10 +94,7 @@ QT_BEGIN_NAMESPACE
/*!
Constructs an empty QAxBindable object.
*/
-QAxBindable::QAxBindable()
-:activex(0)
-{
-}
+QAxBindable::QAxBindable() = default;
/*!
Destroys the QAxBindable object.
diff --git a/src/activeqt/control/qaxbindable.h b/src/activeqt/control/qaxbindable.h
index c5d2630..d895d1a 100644
--- a/src/activeqt/control/qaxbindable.h
+++ b/src/activeqt/control/qaxbindable.h
@@ -82,7 +82,7 @@ protected:
IUnknown *clientSite() const;
private:
- IAxServerBase *activex;
+ IAxServerBase *activex = nullptr;
};
QT_END_NAMESPACE
diff --git a/src/activeqt/control/qaxserverbase.cpp b/src/activeqt/control/qaxserverbase.cpp
index 676087e..6dd1234 100644
--- a/src/activeqt/control/qaxserverbase.cpp
+++ b/src/activeqt/control/qaxserverbase.cpp
@@ -379,8 +379,7 @@ private:
friend class QAxBindable;
friend class QAxPropertyPage;
-
- QAxAggregated *aggregatedObject;
+ QAxAggregated *aggregatedObject = nullptr;
ConnectionPoints points;
union {
@@ -399,13 +398,13 @@ private:
unsigned wasUIActive :1;
unsigned inDesignMode :1;
unsigned canTakeFocus :1;
- short freezeEvents;
+ short freezeEvents = 0;
- HWND m_hWnd;
+ HWND m_hWnd = nullptr;
- HMENU hmenuShared;
- HOLEMENU holemenu;
- HWND hwndMenuOwner;
+ HMENU hmenuShared = nullptr;
+ HOLEMENU holemenu = nullptr;
+ HWND hwndMenuOwner = nullptr;
QMap<HMENU, QMenu*> menuMap;
QMap<UINT, QAction*> actionMap;
QPointer<QMenuBar> menuBar;
@@ -416,8 +415,8 @@ private:
CRITICAL_SECTION refCountSection;
CRITICAL_SECTION createWindowSection;
- LONG ref;
- unsigned long ole_ref;
+ LONG ref = 0;
+ unsigned long ole_ref = 0;
QString class_name;
QString currentFileName;
@@ -425,15 +424,15 @@ private:
QHash<long, int> indexCache;
QHash<int,DISPID> signalCache;
- IUnknown *m_outerUnknown;
- IAdviseSink *m_spAdviseSink;
+ IUnknown *m_outerUnknown = nullptr;
+ IAdviseSink *m_spAdviseSink = nullptr;
QList<STATDATA> adviseSinks;
- IOleClientSite *m_spClientSite;
- IOleInPlaceSite *m_spInPlaceSite;
- IOleInPlaceSiteWindowless *m_spInPlaceSiteWindowless;
- IOleInPlaceFrame *m_spInPlaceFrame;
- ITypeInfo *m_spTypeInfo;
- IStorage *m_spStorage;
+ IOleClientSite *m_spClientSite = nullptr;
+ IOleInPlaceSite *m_spInPlaceSite = nullptr;
+ IOleInPlaceSiteWindowless *m_spInPlaceSiteWindowless = nullptr;
+ IOleInPlaceFrame *m_spInPlaceFrame = nullptr;
+ ITypeInfo *m_spTypeInfo = nullptr;
+ IStorage *m_spStorage = nullptr;
QSize m_currentExtent; // device independent pixels.
};
@@ -451,7 +450,6 @@ class QAxServerAggregate : public IUnknown
Q_DISABLE_COPY(QAxServerAggregate)
public:
QAxServerAggregate(const QString &className, IUnknown *outerUnknown)
- : ref(0)
{
object = new QAxServerBase(className, outerUnknown);
object->registerActiveObject(this);
@@ -494,7 +492,7 @@ public:
private:
QAxServerBase *object;
- LONG ref;
+ LONG ref = 0;
CRITICAL_SECTION refCountSection;
CRITICAL_SECTION createWindowSection;
@@ -525,8 +523,6 @@ public:
QAxSignalVec(const QAxServerBase::ConnectionPoints &points)
: cpoints(points.values())
- , current(0)
- , ref(0)
{
InitializeCriticalSection(&refCountSection);
const int count = cpoints.count();
@@ -628,12 +624,12 @@ public:
}
QList<IConnectionPoint*> cpoints;
- int current;
+ int current = 0;
private:
CRITICAL_SECTION refCountSection;
- LONG ref;
+ LONG ref = 0;
};
/*
@@ -651,7 +647,7 @@ public:
typedef QList<CONNECTDATA>::Iterator Iterator;
QAxConnection(QAxServerBase *parent, const QUuid &uuid)
- : that(parent), iid(uuid), current(0), ref(1)
+ : that(parent), iid(uuid)
{
InitializeCriticalSection(&refCountSection);
}
@@ -807,10 +803,10 @@ private:
QAxServerBase *that;
QUuid iid;
Connections connections;
- int current;
+ int current = 0;
CRITICAL_SECTION refCountSection;
- LONG ref;
+ LONG ref = 1;
};
// callback for DLL server to hook into non-Qt eventloop
@@ -868,7 +864,6 @@ Q_GLOBAL_STATIC(QAxWinEventFilter, qax_winEventFilter);
// COM Factory class, mapping COM requests to ActiveQt requests.
// One instance of this class for each ActiveX the server can provide.
QClassFactory::QClassFactory(CLSID clsid)
- : ref(0), licensed(false)
{
InitializeCriticalSection(&refCountSection);
@@ -1067,10 +1062,7 @@ HRESULT GetClassObject(REFIID clsid, REFIID iid, void **ppUnk)
the COM server for the respective CLSID.
*/
QAxServerBase::QAxServerBase(const QString &classname, IUnknown *outerUnknown)
-: aggregatedObject(0),
- m_hWnd(0), hmenuShared(0), hwndMenuOwner(0),
- ref(0), ole_ref(0), class_name(classname),
- m_outerUnknown(outerUnknown)
+ : class_name(classname), m_outerUnknown(outerUnknown)
{
init();
@@ -1081,13 +1073,6 @@ QAxServerBase::QAxServerBase(const QString &classname, IUnknown *outerUnknown)
Constructs a QAxServerBase object wrapping \a o.
*/
QAxServerBase::QAxServerBase(QObject *o)
- : aggregatedObject(0)
- , m_hWnd(0)
- , hmenuShared(0)
- , hwndMenuOwner(0)
- , ref(0)
- , ole_ref(0)
- , m_outerUnknown(0)
{
init();
@@ -1118,16 +1103,6 @@ void QAxServerBase::init()
wasUIActive = false;
inDesignMode = false;
canTakeFocus = false;
- freezeEvents = 0;
- exception = 0;
-
- m_spAdviseSink = 0;
- m_spClientSite = 0;
- m_spInPlaceSiteWindowless = 0;
- m_spInPlaceSite = 0;
- m_spInPlaceFrame = 0;
- m_spTypeInfo = 0;
- m_spStorage = 0;
InitializeCriticalSection(&refCountSection);
InitializeCriticalSection(&createWindowSection);
diff --git a/src/activeqt/control/qclassfactory_p.h b/src/activeqt/control/qclassfactory_p.h
index 86fea60..b74123f 100644
--- a/src/activeqt/control/qclassfactory_p.h
+++ b/src/activeqt/control/qclassfactory_p.h
@@ -102,8 +102,8 @@ public:
protected:
CRITICAL_SECTION refCountSection;
- LONG ref;
- bool licensed;
+ LONG ref = 0;
+ bool licensed = false;
QString classKey;
};
diff --git a/tools/dumpcpp/main.cpp b/tools/dumpcpp/main.cpp
index eb6f70a..61ee3b1 100644
--- a/tools/dumpcpp/main.cpp
+++ b/tools/dumpcpp/main.cpp
@@ -1433,11 +1433,11 @@ QT_USE_NAMESPACE
struct Options
{
- Options() : mode(GenerateMode), category(DefaultObject), dispatchEqualsIDispatch(false) {}
+ Options() = default;
- ProgramMode mode;
- ObjectCategories category;
- bool dispatchEqualsIDispatch;
+ ProgramMode mode = GenerateMode;
+ ObjectCategories category = DefaultObject;
+ bool dispatchEqualsIDispatch = false;
QString outname;
QString typeLib;
diff --git a/tools/testcon/mainwindow.cpp b/tools/testcon/mainwindow.cpp
index 0c3d3e8..d77b589 100644
--- a/tools/testcon/mainwindow.cpp
+++ b/tools/testcon/mainwindow.cpp
@@ -70,10 +70,6 @@ MainWindow *MainWindow::m_instance = nullptr;
MainWindow::MainWindow(QWidget *parent)
: QMainWindow(parent)
- , m_dlgInvoke(nullptr)
- , m_dlgProperties(nullptr)
- , m_dlgAmbient(nullptr)
- , m_scripts(nullptr)
{
setupUi(this);
MainWindow::m_instance = this; // Logging handler needs the UI
diff --git a/tools/testcon/mainwindow.h b/tools/testcon/mainwindow.h
index e980d06..091aac1 100644
--- a/tools/testcon/mainwindow.h
+++ b/tools/testcon/mainwindow.h
@@ -100,13 +100,11 @@ private:
static MainWindow *m_instance;
- InvokeMethod *m_dlgInvoke;
- ChangeProperties *m_dlgProperties;
- AmbientProperties *m_dlgAmbient;
- QAxScriptManager *m_scripts;
- QMdiArea *m_mdiArea;
-
- QtMessageHandler m_oldDebugHandler;
+ InvokeMethod *m_dlgInvoke = nullptr;
+ ChangeProperties *m_dlgProperties = nullptr;
+ AmbientProperties *m_dlgAmbient = nullptr;
+ QAxScriptManager *m_scripts = nullptr;
+ QMdiArea *m_mdiArea = nullptr;
private slots:
void updateGUI();