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.
This commit is contained in:
Jean-Marc Lasgouttes 2022-02-20 17:02:04 +01:00
parent 6b0cd451fb
commit e263fe8e03
3 changed files with 5 additions and 9 deletions

View File

@ -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);
}

View File

@ -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);
};

View File

@ -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