diff options
author | Keith Isdale <keith.isdale@nokia.com> | 2009-07-01 02:35:46 (GMT) |
---|---|---|
committer | Keith Isdale <keith.isdale@nokia.com> | 2009-08-24 05:28:07 (GMT) |
commit | fefd6e45962ac915fe9cd43b245642985c36b36d (patch) | |
tree | 4d0694fcb0720d493b7bb4995533865535c32675 /src | |
parent | 6c282e096c160ef0426466042bf4bb4e0e28f0b2 (diff) | |
download | Qt-fefd6e45962ac915fe9cd43b245642985c36b36d.zip Qt-fefd6e45962ac915fe9cd43b245642985c36b36d.tar.gz Qt-fefd6e45962ac915fe9cd43b245642985c36b36d.tar.bz2 |
Make assorted constructors follow good coding practice
Ensure that class members are initialized
Moved some value assignment from constructor body into the the constructor's intializer list
Reviewed-by: Jason McDonald
Diffstat (limited to 'src')
-rw-r--r-- | src/gui/image/qnativeimage.cpp | 8 | ||||
-rw-r--r-- | src/gui/kernel/qapplication_x11.cpp | 3 | ||||
-rw-r--r-- | src/gui/text/qtextobject.cpp | 10 | ||||
-rw-r--r-- | src/gui/text/qtextobject_p.h | 3 | ||||
-rw-r--r-- | src/qt3support/tools/q3garray.cpp | 1 | ||||
-rw-r--r-- | src/scripttools/debugging/qscriptcompletiontask.cpp | 1 | ||||
-rw-r--r-- | src/scripttools/debugging/qscriptdebugger.cpp | 2 | ||||
-rw-r--r-- | src/scripttools/debugging/qscriptdebuggeragent.cpp | 8 | ||||
-rw-r--r-- | src/scripttools/debugging/qscriptdebuggerbackend.cpp | 13 | ||||
-rw-r--r-- | src/scripttools/debugging/qscriptdebuggerevent.cpp | 1 | ||||
-rw-r--r-- | src/scripttools/debugging/qscriptdebuggerscriptedconsolecommand.cpp | 2 | ||||
-rw-r--r-- | src/svg/qsvgstyle.cpp | 6 | ||||
-rw-r--r-- | src/tools/moc/moc.h | 4 | ||||
-rw-r--r-- | src/xml/dom/qdom.cpp | 6 | ||||
-rw-r--r-- | src/xmlpatterns/acceltree/qacceltree_p.h | 1 | ||||
-rw-r--r-- | src/xmlpatterns/api/qabstractxmlforwarditerator_p.h | 2 |
16 files changed, 35 insertions, 36 deletions
diff --git a/src/gui/image/qnativeimage.cpp b/src/gui/image/qnativeimage.cpp index fc5ad2a..918454d 100644 --- a/src/gui/image/qnativeimage.cpp +++ b/src/gui/image/qnativeimage.cpp @@ -144,11 +144,15 @@ QImage::Format QNativeImage::systemFormat() #elif defined(Q_WS_X11) && !defined(QT_NO_MITSHM) QNativeImage::QNativeImage(int width, int height, QImage::Format format,bool /* isTextBuffer */, QWidget *widget) + : xshmimg(0), xshmpm(0) { if (!X11->use_mitshm) { - xshmimg = 0; - xshmpm = 0; image = QImage(width, height, format); + // follow good coding practice and set xshminfo attributes, though values not used in this case + xshminfo.readOnly = true; + xshminfo.shmaddr = 0; + xshminfo.shmid = 0; + xshminfo.shmseg = 0; return; } diff --git a/src/gui/kernel/qapplication_x11.cpp b/src/gui/kernel/qapplication_x11.cpp index 4c42d28..f9cf8e5 100644 --- a/src/gui/kernel/qapplication_x11.cpp +++ b/src/gui/kernel/qapplication_x11.cpp @@ -5404,7 +5404,8 @@ class QSessionManagerPrivate : public QObjectPrivate { public: QSessionManagerPrivate(QSessionManager* mgr, QString& id, QString& key) - : QObjectPrivate(), sm(mgr), sessionId(id), sessionKey(key), eventLoop(0) {} + : QObjectPrivate(), sm(mgr), sessionId(id), sessionKey(key), + restartHint(QSessionManager::RestartIfRunning), eventLoop(0) {} QSessionManager* sm; QStringList restartCommand; QStringList discardCommand; diff --git a/src/gui/text/qtextobject.cpp b/src/gui/text/qtextobject.cpp index 98c92eb..5dc0c48 100644 --- a/src/gui/text/qtextobject.cpp +++ b/src/gui/text/qtextobject.cpp @@ -412,11 +412,6 @@ QTextFrameLayoutData::~QTextFrameLayoutData() QTextFrame::QTextFrame(QTextDocument *doc) : QTextObject(*new QTextFramePrivate(doc), doc) { - Q_D(QTextFrame); - d->fragment_start = 0; - d->fragment_end = 0; - d->parentFrame = 0; - d->layoutData = 0; } // ### DOC: What does this do to child frames? @@ -435,11 +430,6 @@ QTextFrame::~QTextFrame() QTextFrame::QTextFrame(QTextFramePrivate &p, QTextDocument *doc) : QTextObject(p, doc) { - Q_D(QTextFrame); - d->fragment_start = 0; - d->fragment_end = 0; - d->parentFrame = 0; - d->layoutData = 0; } /*! diff --git a/src/gui/text/qtextobject_p.h b/src/gui/text/qtextobject_p.h index e862b30..0b78547 100644 --- a/src/gui/text/qtextobject_p.h +++ b/src/gui/text/qtextobject_p.h @@ -94,7 +94,8 @@ class QTextFramePrivate : public QTextObjectPrivate Q_DECLARE_PUBLIC(QTextFrame) public: QTextFramePrivate(QTextDocument *doc) - : QTextObjectPrivate(doc) + : QTextObjectPrivate(doc), fragment_start(0), fragment_end(0), + parentFrame(0), layoutData(0) { } virtual void fragmentAdded(const QChar &type, uint fragment); diff --git a/src/qt3support/tools/q3garray.cpp b/src/qt3support/tools/q3garray.cpp index e4aef3d..c1360a0 100644 --- a/src/qt3support/tools/q3garray.cpp +++ b/src/qt3support/tools/q3garray.cpp @@ -114,6 +114,7 @@ Q3GArray::Q3GArray() */ Q3GArray::Q3GArray(int, int) + : shd(0) { } diff --git a/src/scripttools/debugging/qscriptcompletiontask.cpp b/src/scripttools/debugging/qscriptcompletiontask.cpp index a1256a9..59817e1 100644 --- a/src/scripttools/debugging/qscriptcompletiontask.cpp +++ b/src/scripttools/debugging/qscriptcompletiontask.cpp @@ -76,6 +76,7 @@ public: }; QScriptCompletionTaskPrivate::QScriptCompletionTaskPrivate() + : cursorPosition(0), frameIndex(0), frontend(0), console(0) { } diff --git a/src/scripttools/debugging/qscriptdebugger.cpp b/src/scripttools/debugging/qscriptdebugger.cpp index 75ab2f7..68fea05 100644 --- a/src/scripttools/debugging/qscriptdebugger.cpp +++ b/src/scripttools/debugging/qscriptdebugger.cpp @@ -1013,7 +1013,7 @@ class SyncBreakpointsJob : public QScriptDebuggerCommandSchedulerJob public: SyncBreakpointsJob(QScriptDebuggerPrivate *debugger) : QScriptDebuggerCommandSchedulerJob(debugger), - m_debugger(debugger) {} + m_debugger(debugger), m_index(-1) {} void start() { QScriptDebuggerCommandSchedulerFrontend frontend(commandScheduler(), this); diff --git a/src/scripttools/debugging/qscriptdebuggeragent.cpp b/src/scripttools/debugging/qscriptdebuggeragent.cpp index a263f8a..febd975 100644 --- a/src/scripttools/debugging/qscriptdebuggeragent.cpp +++ b/src/scripttools/debugging/qscriptdebuggeragent.cpp @@ -61,11 +61,11 @@ QT_BEGIN_NAMESPACE */ QScriptDebuggerAgentPrivate::QScriptDebuggerAgentPrivate() + : state(NoState), stepDepth(0), stepCount(0), + targetScriptId(-1), targetLineNumber(-1), returnCounter(0), + nextBreakpointId(1), hitBreakpointId(0), + nextContextId(0), statementCounter(0) { - state = NoState; - nextBreakpointId = 1; - nextContextId = 0; - statementCounter = 0; } QScriptDebuggerAgentPrivate::~QScriptDebuggerAgentPrivate() diff --git a/src/scripttools/debugging/qscriptdebuggerbackend.cpp b/src/scripttools/debugging/qscriptdebuggerbackend.cpp index 4d492cf..afb6231 100644 --- a/src/scripttools/debugging/qscriptdebuggerbackend.cpp +++ b/src/scripttools/debugging/qscriptdebuggerbackend.cpp @@ -131,14 +131,13 @@ private: QScriptDebuggerBackendPrivate::QScriptDebuggerBackendPrivate() + : agent(0), commandExecutor(0), + pendingEvaluateContextIndex(-1), pendingEvaluateLineNumber(-1), + ignoreExceptions(false), + nextScriptValueIteratorId(0), nextScriptObjectSnapshotId(0), + eventReceiver(0), + q_ptr(0) // q_ptr will be set later by QScriptDebuggerBackend constructor { - eventReceiver = 0; - agent = 0; - commandExecutor = 0; - pendingEvaluateLineNumber = -1; - ignoreExceptions = false; - nextScriptValueIteratorId = 0; - nextScriptObjectSnapshotId = 0; } QScriptDebuggerBackendPrivate::~QScriptDebuggerBackendPrivate() diff --git a/src/scripttools/debugging/qscriptdebuggerevent.cpp b/src/scripttools/debugging/qscriptdebuggerevent.cpp index ce08c9d..857b09a 100644 --- a/src/scripttools/debugging/qscriptdebuggerevent.cpp +++ b/src/scripttools/debugging/qscriptdebuggerevent.cpp @@ -60,6 +60,7 @@ public: }; QScriptDebuggerEventPrivate::QScriptDebuggerEventPrivate() + : type(QScriptDebuggerEvent::None) { } diff --git a/src/scripttools/debugging/qscriptdebuggerscriptedconsolecommand.cpp b/src/scripttools/debugging/qscriptdebuggerscriptedconsolecommand.cpp index b8088e1..d66ea39 100644 --- a/src/scripttools/debugging/qscriptdebuggerscriptedconsolecommand.cpp +++ b/src/scripttools/debugging/qscriptdebuggerscriptedconsolecommand.cpp @@ -367,7 +367,7 @@ class QScriptDebuggerScriptedConsoleCommandJobPrivate : public QScriptDebuggerConsoleCommandJobPrivate { public: - QScriptDebuggerScriptedConsoleCommandJobPrivate() {} + QScriptDebuggerScriptedConsoleCommandJobPrivate() : command(0), commandCount(0) {} ~QScriptDebuggerScriptedConsoleCommandJobPrivate() {} QScriptDebuggerScriptedConsoleCommandPrivate *command; diff --git a/src/svg/qsvgstyle.cpp b/src/svg/qsvgstyle.cpp index 720dbb6..4cbd49a 100644 --- a/src/svg/qsvgstyle.cpp +++ b/src/svg/qsvgstyle.cpp @@ -81,12 +81,14 @@ void QSvgQualityStyle::revert(QPainter *, QSvgExtraStates &) } QSvgFillStyle::QSvgFillStyle(const QBrush &brush) - : m_fill(brush), m_style(0), m_fillRuleSet(false), m_fillOpacitySet(false) + : m_fill(brush), m_style(0), m_fillRuleSet(false), m_fillRule(Qt::OddEvenFill), + m_fillOpacitySet(false), m_fillOpacity(0),m_oldOpacity(0) { } QSvgFillStyle::QSvgFillStyle(QSvgStyleProperty *style) - : m_style(style), m_fillRuleSet(false), m_fillOpacitySet(false) + : m_style(style), m_fillRuleSet(false), m_fillRule(Qt::OddEvenFill), + m_fillOpacitySet(false), m_fillOpacity(0),m_oldOpacity(0) { } diff --git a/src/tools/moc/moc.h b/src/tools/moc/moc.h index afdbe99..fe5a4f3 100644 --- a/src/tools/moc/moc.h +++ b/src/tools/moc/moc.h @@ -58,7 +58,7 @@ struct Type enum ReferenceType { NoReference, Reference, Pointer }; inline Type() : isVolatile(false), isScoped(false), firstToken(NOTOKEN), referenceType(NoReference) {} - inline explicit Type(const QByteArray &_name) : name(_name), isVolatile(false), firstToken(NOTOKEN), referenceType(NoReference) {} + inline explicit Type(const QByteArray &_name) : name(_name), isVolatile(false), isScoped(false), firstToken(NOTOKEN), referenceType(NoReference) {} QByteArray name; uint isVolatile : 1; uint isScoped : 1; @@ -137,7 +137,7 @@ struct ClassInfoDef struct ClassDef { ClassDef(): - hasQObject(false), hasQGadget(false), notifyableProperties(0){} + hasQObject(false), hasQGadget(false), notifyableProperties(0), begin(0), end(0){} QByteArray classname; QByteArray qualified; QList<QPair<QByteArray, FunctionDef::Access> > superclassList; diff --git a/src/xml/dom/qdom.cpp b/src/xml/dom/qdom.cpp index 4242531..d1cfd7e 100644 --- a/src/xml/dom/qdom.cpp +++ b/src/xml/dom/qdom.cpp @@ -7379,11 +7379,9 @@ QDomComment QDomNode::toComment() const **************************************************************/ QDomHandler::QDomHandler(QDomDocumentPrivate* adoc, bool namespaceProcessing) + : errorLine(0), errorColumn(0), doc(adoc), node(adoc), cdata(false), + nsProcessing(namespaceProcessing), locator(0) { - doc = adoc; - node = doc; - cdata = false; - nsProcessing = namespaceProcessing; } QDomHandler::~QDomHandler() diff --git a/src/xmlpatterns/acceltree/qacceltree_p.h b/src/xmlpatterns/acceltree/qacceltree_p.h index 38f5a8e..a033c15 100644 --- a/src/xmlpatterns/acceltree/qacceltree_p.h +++ b/src/xmlpatterns/acceltree/qacceltree_p.h @@ -129,6 +129,7 @@ namespace QPatternist { public: inline BasicNodeData() + : m_parent(0), m_size(0), m_depth(0), m_kind(0) { } diff --git a/src/xmlpatterns/api/qabstractxmlforwarditerator_p.h b/src/xmlpatterns/api/qabstractxmlforwarditerator_p.h index a0f7131..fde5634 100644 --- a/src/xmlpatterns/api/qabstractxmlforwarditerator_p.h +++ b/src/xmlpatterns/api/qabstractxmlforwarditerator_p.h @@ -86,7 +86,7 @@ public: typedef QList<QExplicitlySharedDataPointer<QAbstractXmlForwardIterator<T> > > List; typedef QVector<QExplicitlySharedDataPointer<QAbstractXmlForwardIterator<T> > > Vector; - inline QAbstractXmlForwardIterator() {} + inline QAbstractXmlForwardIterator() : d_ptr(0) {} virtual ~QAbstractXmlForwardIterator() {} virtual T next() = 0; |