commit e263fe8e03b9b506e8355e5a11cb3ec717c29592
Author: Jean-Marc Lasgouttes <[email protected]>
Date: Sun Feb 20 17:02:04 2022 +0100
Fix unintialized variables spotted by coverity
The InsetWrap case happens in decodeInsetParaps (InsetCommand.cpp),
where the default constructor is invoked. In this case, lines was not
initialized.
---
src/insets/InsetWrap.cpp | 4 ----
src/insets/InsetWrap.h | 8 ++++----
src/mathed/MathParser.cpp | 2 +-
3 files changed, 5 insertions(+), 9 deletions(-)
diff --git a/src/insets/InsetWrap.cpp b/src/insets/InsetWrap.cpp
index c862b17..8987405 100644
--- a/src/insets/InsetWrap.cpp
+++ b/src/insets/InsetWrap.cpp
@@ -47,10 +47,6 @@ InsetWrap::InsetWrap(Buffer * buf, string const & type)
: InsetCaptionable(buf)
{
setCaptionType(type);
- params_.lines = 0;
- params_.placement = "o";
- params_.overhang = Length(0, Length::PCW);
- params_.width = Length(50, Length::PCW);
}
diff --git a/src/insets/InsetWrap.h b/src/insets/InsetWrap.h
index 02e0a20..a44821e 100644
--- a/src/insets/InsetWrap.h
+++ b/src/insets/InsetWrap.h
@@ -30,13 +30,13 @@ public:
///
std::string type;
///
- int lines;
+ int lines = 0;
///
- std::string placement;
+ std::string placement = "o";
///
- Length overhang;
+ Length overhang = Length(0, Length::PCW);
///
- Length width;
+ Length width = Length(50, Length::PCW);
};
diff --git a/src/mathed/MathParser.cpp b/src/mathed/MathParser.cpp
index 6d1b747..0ba3375 100644
--- a/src/mathed/MathParser.cpp
+++ b/src/mathed/MathParser.cpp
@@ -1369,7 +1369,7 @@ bool Parser::parse1(InsetMathGrid & grid, unsigned flags,
// otherwise parse it as an user macro
MathData count;
parse(count, FLAG_ITEM, mode);
- int cols;
+ int cols = 0;
// limit arbitrarily to 100 columns
if (extractNumber(count, cols) && cols > 0 && cols <
100) {
// resize the table if necessary
--
lyx-cvs mailing list
[email protected]
http://lists.lyx.org/mailman/listinfo/lyx-cvs