TextEditor: Initialize some members

Coverity was complaining about these, in some places even rightly so:-)

Change-Id: Ia85cdd2c74f05edba6f0d4534aa9f2ee2a750595
Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
Tobias Hunger
2017-07-18 23:15:52 +02:00
parent 2f0a395017
commit 7d33f0f061
10 changed files with 27 additions and 32 deletions

View File

@@ -57,13 +57,13 @@ struct BehaviorSettingsPage::BehaviorSettingsPagePrivate
const BehaviorSettingsPageParameters m_parameters; const BehaviorSettingsPageParameters m_parameters;
QPointer<QWidget> m_widget; QPointer<QWidget> m_widget;
Internal::Ui::BehaviorSettingsPage *m_page; Internal::Ui::BehaviorSettingsPage *m_page = nullptr;
void init(); void init();
CodeStylePool *m_defaultCodeStylePool; CodeStylePool *m_defaultCodeStylePool = nullptr;
SimpleCodeStylePreferences *m_codeStyle; SimpleCodeStylePreferences *m_codeStyle = nullptr;
SimpleCodeStylePreferences *m_pageCodeStyle; SimpleCodeStylePreferences *m_pageCodeStyle = nullptr;
TypingSettings m_typingSettings; TypingSettings m_typingSettings;
StorageSettings m_storageSettings; StorageSettings m_storageSettings;
BehaviorSettings m_behaviorSettings; BehaviorSettings m_behaviorSettings;
@@ -72,7 +72,7 @@ struct BehaviorSettingsPage::BehaviorSettingsPagePrivate
BehaviorSettingsPage::BehaviorSettingsPagePrivate::BehaviorSettingsPagePrivate BehaviorSettingsPage::BehaviorSettingsPagePrivate::BehaviorSettingsPagePrivate
(const BehaviorSettingsPageParameters &p) (const BehaviorSettingsPageParameters &p)
: m_parameters(p), m_page(0), m_pageCodeStyle(0) : m_parameters(p)
{ {
} }

View File

@@ -33,10 +33,6 @@ using namespace TextEditor;
using namespace Internal; using namespace Internal;
ProcessorRunner::ProcessorRunner() ProcessorRunner::ProcessorRunner()
: m_processor(0)
, m_interface(0)
, m_discardProposal(false)
, m_proposal(0)
{} {}
ProcessorRunner::~ProcessorRunner() ProcessorRunner::~ProcessorRunner()

View File

@@ -54,11 +54,11 @@ public:
IAssistProposal *proposal() const; IAssistProposal *proposal() const;
private: private:
IAssistProcessor *m_processor; IAssistProcessor *m_processor = nullptr;
AssistInterface *m_interface; AssistInterface *m_interface = nullptr;
bool m_discardProposal; bool m_discardProposal = false;
IAssistProposal *m_proposal; IAssistProposal *m_proposal = nullptr;
AssistReason m_reason; AssistReason m_reason = IdleEditor;
}; };
} // Internal } // Internal

View File

@@ -107,14 +107,13 @@ private:
virtual void doReplaceExpressions(const QStringList &captures); virtual void doReplaceExpressions(const QStringList &captures);
QString m_string; QString m_string;
int m_length; int m_length = 0;
Qt::CaseSensitivity m_caseSensitivity; Qt::CaseSensitivity m_caseSensitivity = Qt::CaseSensitive;
}; };
class RegExprRule : public DynamicRule class RegExprRule : public DynamicRule
{ {
public: public:
RegExprRule() : m_onlyBegin(false), m_isCached(false) {}
virtual ~RegExprRule() {} virtual ~RegExprRule() {}
void setPattern(const QString &pattern); void setPattern(const QString &pattern);
@@ -131,10 +130,10 @@ private:
bool isExactMatch(ProgressData *progress); bool isExactMatch(ProgressData *progress);
bool m_onlyBegin; bool m_onlyBegin = false;
bool m_isCached; bool m_isCached = false;
int m_offset; int m_offset = 0;
int m_length; int m_length = 0;
QStringList m_captures; QStringList m_captures;
QRegExp m_expression; QRegExp m_expression;
}; };

View File

@@ -75,7 +75,7 @@ private:
private: private:
QString m_helpId; QString m_helpId;
QString m_docMark; QString m_docMark;
Category m_category; Category m_category = Unknown;
mutable QMap<QString, QUrl> m_helpLinks; // cached help links mutable QMap<QString, QUrl> m_helpLinks; // cached help links
}; };

View File

@@ -51,7 +51,7 @@ public:
void refresh(QFutureInterface<void> &) override {} void refresh(QFutureInterface<void> &) override {}
private: private:
bool m_hasCurrentEditor; bool m_hasCurrentEditor = false;
}; };
} // namespace Internal } // namespace Internal

View File

@@ -245,7 +245,7 @@ class BaseTextEditorPrivate
public: public:
BaseTextEditorPrivate() {} BaseTextEditorPrivate() {}
TextEditorFactoryPrivate *m_origin; TextEditorFactoryPrivate *m_origin = nullptr;
}; };
class HoverHandlerRunner class HoverHandlerRunner
@@ -561,7 +561,7 @@ public:
void disableBlockSelection(BlockSelectionUpdateKind kind); void disableBlockSelection(BlockSelectionUpdateKind kind);
void resetCursorFlashTimer(); void resetCursorFlashTimer();
QBasicTimer m_cursorFlashTimer; QBasicTimer m_cursorFlashTimer;
bool m_cursorVisible; bool m_cursorVisible = true;
bool m_moveLineUndoHack = false; bool m_moveLineUndoHack = false;
QTextCursor m_findScopeStart; QTextCursor m_findScopeStart;

View File

@@ -44,10 +44,10 @@ enum TransFormationType { Uppercase, Lowercase };
struct TestBlockSelection struct TestBlockSelection
{ {
int positionBlock; int positionBlock = 0;
int positionColumn; int positionColumn = 0;
int anchorBlock; int anchorBlock = 0;
int anchorColumn; int anchorColumn = 0;
TestBlockSelection(int positionBlock, int positionColumn, int anchorBlock, int anchorColumn) TestBlockSelection(int positionBlock, int positionColumn, int anchorBlock, int anchorColumn)
: positionBlock(positionBlock), positionColumn(positionColumn) : positionBlock(positionBlock), positionColumn(positionColumn)
, anchorBlock(anchorBlock), anchorColumn(anchorColumn) {} , anchorBlock(anchorBlock), anchorColumn(anchorColumn) {}

View File

@@ -94,7 +94,7 @@ TextMark::~TextMark()
TextMarkRegistry::remove(this); TextMarkRegistry::remove(this);
if (m_baseTextDocument) if (m_baseTextDocument)
m_baseTextDocument->removeMark(this); m_baseTextDocument->removeMark(this);
m_baseTextDocument = 0; m_baseTextDocument = nullptr;
} }
QString TextMark::fileName() const QString TextMark::fileName() const

View File

@@ -121,9 +121,9 @@ private:
QString m_fileName; QString m_fileName;
int m_lineNumber = 0; int m_lineNumber = 0;
Priority m_priority = LowPriority; Priority m_priority = LowPriority;
bool m_visible = false;
QIcon m_icon; QIcon m_icon;
Utils::Theme::Color m_color; Utils::Theme::Color m_color = Utils::Theme::TextColorNormal;
bool m_visible = false;
bool m_hasColor = false; bool m_hasColor = false;
Core::Id m_category; Core::Id m_category;
double m_widthFactor = 1.0; double m_widthFactor = 1.0;