]> git.lyx.org Git - features.git/commitdiff
Add some missing member variable initializations
authorGeorg Baum <baum@lyx.org>
Sun, 13 Sep 2015 17:47:21 +0000 (19:47 +0200)
committerGeorg Baum <baum@lyx.org>
Sun, 13 Sep 2015 17:47:21 +0000 (19:47 +0200)
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.

15 files changed:
src/Encoding.h
src/LyXRC.cpp
src/PDFOptions.h
src/TextMetrics.h
src/TocBackend.h
src/VCBackend.h
src/frontends/qt4/LayoutBox.cpp
src/frontends/qt4/TocModel.cpp
src/insets/InsetIPAMacro.h
src/insets/InsetLine.cpp
src/insets/InsetSpecialChar.h
src/insets/InsetTabular.cpp
src/mathed/InsetMathColor.cpp
src/mathed/InsetMathDecoration.cpp
src/support/debug.h

index 00d0106b543fc36c1925d6e61e9b04e4d4c8fb60..f1513c8f625ff85ec95c4de6d30b0cd47a40b27b 100644 (file)
@@ -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,
index 0221cba3969ea669a56a94ccb9e4671ce3137429..4fb1b027c0ecf9fbbba6cd01bef885bd1db62d11 100644 (file)
@@ -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;
 
index 756c2f70a4e37482dc8be9c84853b47f17c9c2b1..d74caf430e638c65cd353970b6bdc0f2554113df 100644 (file)
@@ -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
index 4e9fc0dc2d05fc5955a4790356b2cd1f79fe3eca..eb48224212c11652b4182033ee83ac2506ad0c24 100644 (file)
@@ -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
        */
index 15a800d990347ad8ed6e71b51a9db01eb84c3e5a..903072b770c12a89623cdff25a3ebefbbb7c7b0c 100644 (file)
@@ -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,
index 970972af48b50db7d233d7647cfb6451dcdce21d..042d26e9fd265e6f5f99db26ef9c1ceba81be65c 100644 (file)
@@ -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
index 1ca7a1eba7c24c6346b6405121d15f724e289f62..0a4da449377c949c43cc5f6b3fe8552fe9c772e9 100644 (file)
@@ -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
index cd1189b49b473371c2e2b6ce53ee76147dfe8c18..44a25339ee00d6f70b62dfe4cc9faeb9afbd5e69 100644 (file)
@@ -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_);
index dbcfc541abcae5d51f9cf0f108c7e7df1a63e881..9f2184bb1ffdd6720be67f3104d5d7bae4dc12df 100644 (file)
@@ -131,7 +131,7 @@ public:
        };
 
        ///
-       InsetIPAChar() : Inset(0) {}
+       InsetIPAChar() : Inset(0), kind_(TONE_FALLING) {}
        ///
        explicit InsetIPAChar(Kind k);
        ///
index 95cd089c403f76347617631df8e1cde51246358d..087dba7df2cc8a8fa429d4aaae2f4fec39d2f7dd 100644 (file)
@@ -45,7 +45,7 @@ using frontend::Painter;
 
 
 InsetLine::InsetLine(Buffer * buf, InsetCommandParams const & p)
-       : InsetCommand(buf, p)
+       : InsetCommand(buf, p), height_(0), offset_(0)
 {}
 
 
index b1121dda8b1847e73eea15e890dab5a1a983510e..70e2bf3f823239615b7ca272e1120c97ebe90829 100644 (file)
@@ -53,7 +53,7 @@ public:
        };
 
        ///
-       InsetSpecialChar() : Inset(0) {}
+       InsetSpecialChar() : Inset(0), kind_(HYPHENATION) {}
        ///
        explicit InsetSpecialChar(Kind k);
        ///
index be88ad64e8882f3d97e9b840e9a4c043005cdb78..94d2f8e4c5abfbc1b43c6f9db5812c80db10fff7 100644 (file)
@@ -652,7 +652,7 @@ Tabular::ColumnData::ColumnData()
 
 
 Tabular::ltType::ltType()
-       : topDL(false),
+       : set(false), topDL(false),
          bottomDL(false),
          empty(false)
 {}
index 9023b7406eafab94bf2da0f5dc7afa9647510170..c50f61360932a519e6b6f030bd369f2f07852814 100644 (file)
@@ -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)
 {}
 
 
index b515d56e9fb7a4a45ff9283adaca1db9fa8e59db..37ae239d108479d057a042b9a4bfafb2cbb2fed4 100644 (file)
@@ -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;
 }
index 4e62bcd5c1d1990aa52b22bec00d7367f8884a86..216538958d62c70af970541e927c9937c5351b7f 100644 (file)
@@ -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();