commit 699a6db9fa168f91458a17d4f30c124e52a38054
Author: Georg Baum <[email protected]>
Date: Sun Sep 13 19:47:21 2015 +0200
Add some missing member variable initializations
These were all found by cppcheck. Even in constructors that are there "only
because of std containers" the class should be initialized correctly. You
can
never know whether such an object does not get used, and then a nice crash
caused by dereferencing a NULL-pointer is better than undefined behaviour.
diff --git a/src/Encoding.h b/src/Encoding.h
index 00d0106..f1513c8 100644
--- a/src/Encoding.h
+++ b/src/Encoding.h
@@ -126,7 +126,8 @@ public:
/// Represent any of the above packages
static int const any;
///
- Encoding() : fixedwidth_(true), unsafe_(false), complete_(false) {}
+ Encoding() : fixedwidth_(true), unsafe_(false), start_encodable_(0),
+ package_(none), complete_(false) {}
///
Encoding(std::string const & n, std::string const & l,
std::string const & g, std::string const & i,
diff --git a/src/LyXRC.cpp b/src/LyXRC.cpp
index 0221cba..4fb1b02 100644
--- a/src/LyXRC.cpp
+++ b/src/LyXRC.cpp
@@ -334,6 +334,7 @@ void LyXRC::setDefaults()
full_screen_toolbars = true;
full_screen_tabbar = true;
full_screen_menubar = true;
+ full_screen_statusbar = true;
full_screen_scrollbar = true;
full_screen_width = 700;
diff --git a/src/PDFOptions.h b/src/PDFOptions.h
index 756c2f7..d74caf4 100644
--- a/src/PDFOptions.h
+++ b/src/PDFOptions.h
@@ -142,14 +142,6 @@ public:
* are checked.
*/
std::string quoted_options_check(std::string const & str) const;
-
-
- /**
- * Flag indicating whether user made some input into PDF
preferences.
- * We want to save options, when user decide to switch off PDF
support
- * for a while.
- */
- bool store_options;
};
} // namespace lyx
diff --git a/src/TextMetrics.h b/src/TextMetrics.h
index 4e9fc0d..eb48224 100644
--- a/src/TextMetrics.h
+++ b/src/TextMetrics.h
@@ -35,7 +35,7 @@ class TextMetrics
{
public:
/// Default constructor (only here for STL containers).
- TextMetrics() : text_(0) {}
+ TextMetrics() : bv_(0), text_(0), main_text_(false), max_width_(0) {}
/// The only useful constructor.
TextMetrics(BufferView *, Text *);
@@ -178,7 +178,7 @@ public:
\param x,y are absolute screen coordinates.
\param assert_in_view if true the cursor will be set on a row
that is completely visible
- \param up whether we are going up or down (only used when
+ \param up whether we are going up or down (only used when
assert_in_view is true
\retval inset is non-null if the cursor is positionned inside
*/
diff --git a/src/TocBackend.h b/src/TocBackend.h
index 15a800d..903072b 100644
--- a/src/TocBackend.h
+++ b/src/TocBackend.h
@@ -38,7 +38,7 @@ class TocItem
public:
/// Default constructor for STL containers.
- TocItem() : dit_(0) {}
+ TocItem() : dit_(0), depth_(0), output_(false) {}
///
TocItem(DocIterator const & dit,
int depth,
diff --git a/src/VCBackend.h b/src/VCBackend.h
index 970972a..042d26e 100644
--- a/src/VCBackend.h
+++ b/src/VCBackend.h
@@ -35,7 +35,7 @@ public:
NOLOCKING,
};
- VCS(Buffer * b) : owner_(b) {}
+ VCS(Buffer * b) : vcstatus(NOLOCKING), owner_(b) {}
virtual ~VCS() {}
/// register a file for version control
diff --git a/src/frontends/qt4/LayoutBox.cpp b/src/frontends/qt4/LayoutBox.cpp
index 1ca7a1e..0a4da44 100644
--- a/src/frontends/qt4/LayoutBox.cpp
+++ b/src/frontends/qt4/LayoutBox.cpp
@@ -106,6 +106,7 @@ public:
struct LayoutBox::Private
{
Private(LayoutBox * parent, GuiView & gv) : p(parent), owner_(gv),
+ inset_(0),
// set the layout model with two columns
// 1st: translated layout names
// 2nd: raw layout names
diff --git a/src/frontends/qt4/TocModel.cpp b/src/frontends/qt4/TocModel.cpp
index cd1189b..44a2533 100644
--- a/src/frontends/qt4/TocModel.cpp
+++ b/src/frontends/qt4/TocModel.cpp
@@ -81,7 +81,7 @@ public:
TocModel::TocModel(QObject * parent)
: model_(new TocTypeModel(parent)),
sorted_model_(new QSortFilterProxyModel(parent)),
- is_sorted_(false), maxdepth_(0), mindepth_(0)
+ is_sorted_(false), toc_(0), maxdepth_(0), mindepth_(0)
{
sorted_model_->setSortLocaleAware(true);
sorted_model_->setSourceModel(model_);
diff --git a/src/insets/InsetIPAMacro.h b/src/insets/InsetIPAMacro.h
index dbcfc54..9f2184b 100644
--- a/src/insets/InsetIPAMacro.h
+++ b/src/insets/InsetIPAMacro.h
@@ -131,7 +131,7 @@ public:
};
///
- InsetIPAChar() : Inset(0) {}
+ InsetIPAChar() : Inset(0), kind_(TONE_FALLING) {}
///
explicit InsetIPAChar(Kind k);
///
diff --git a/src/insets/InsetLine.cpp b/src/insets/InsetLine.cpp
index 95cd089..087dba7 100644
--- a/src/insets/InsetLine.cpp
+++ b/src/insets/InsetLine.cpp
@@ -45,7 +45,7 @@ using frontend::Painter;
InsetLine::InsetLine(Buffer * buf, InsetCommandParams const & p)
- : InsetCommand(buf, p)
+ : InsetCommand(buf, p), height_(0), offset_(0)
{}
diff --git a/src/insets/InsetSpecialChar.h b/src/insets/InsetSpecialChar.h
index b1121dd..70e2bf3 100644
--- a/src/insets/InsetSpecialChar.h
+++ b/src/insets/InsetSpecialChar.h
@@ -53,7 +53,7 @@ public:
};
///
- InsetSpecialChar() : Inset(0) {}
+ InsetSpecialChar() : Inset(0), kind_(HYPHENATION) {}
///
explicit InsetSpecialChar(Kind k);
///
diff --git a/src/insets/InsetTabular.cpp b/src/insets/InsetTabular.cpp
index be88ad6..94d2f8e 100644
--- a/src/insets/InsetTabular.cpp
+++ b/src/insets/InsetTabular.cpp
@@ -652,7 +652,7 @@ Tabular::ColumnData::ColumnData()
Tabular::ltType::ltType()
- : topDL(false),
+ : set(false), topDL(false),
bottomDL(false),
empty(false)
{}
diff --git a/src/mathed/InsetMathColor.cpp b/src/mathed/InsetMathColor.cpp
index 9023b74..c50f613 100644
--- a/src/mathed/InsetMathColor.cpp
+++ b/src/mathed/InsetMathColor.cpp
@@ -29,14 +29,14 @@ using namespace lyx::support;
namespace lyx {
InsetMathColor::InsetMathColor(Buffer * buf, bool oldstyle, ColorCode color)
- : InsetMathNest(buf, 1), oldstyle_(oldstyle),
+ : InsetMathNest(buf, 1), w_(0), oldstyle_(oldstyle),
color_(from_utf8(lcolor.getLaTeXName(color)))
{}
InsetMathColor::InsetMathColor(Buffer * buf, bool oldstyle,
docstring const & color)
- : InsetMathNest(buf, 1), oldstyle_(oldstyle), color_(color)
+ : InsetMathNest(buf, 1), w_(0), oldstyle_(oldstyle), color_(color)
{}
diff --git a/src/mathed/InsetMathDecoration.cpp
b/src/mathed/InsetMathDecoration.cpp
index b515d56..37ae239 100644
--- a/src/mathed/InsetMathDecoration.cpp
+++ b/src/mathed/InsetMathDecoration.cpp
@@ -37,7 +37,7 @@ namespace lyx {
InsetMathDecoration::InsetMathDecoration(Buffer * buf, latexkeys const * key)
- : InsetMathNest(buf, 1), key_(key)
+ : InsetMathNest(buf, 1), key_(key), dh_(0), dy_(0), dw_(0)
{
// lyxerr << " creating deco " << key->name << endl;
}
diff --git a/src/support/debug.h b/src/support/debug.h
index 4e62bcd..2165389 100644
--- a/src/support/debug.h
+++ b/src/support/debug.h
@@ -142,7 +142,8 @@ inline void operator|=(Debug::Type & d1, Debug::Type d2)
class LyXErr
{
public:
- LyXErr(): dt_(Debug::NONE), enabled_(true), second_enabled_(false) {}
+ LyXErr(): dt_(Debug::NONE), stream_(0), enabled_(true),
+ second_stream_(0), second_enabled_(false) {}
/// Disable the stream completely
void disable();