Compare commits

...

4 Commits

Author SHA1 Message Date
Juergen Spitzmueller
d3123c16f7 initialize boolean (reported by coverity) 2024-09-07 12:55:10 +02:00
Juergen Spitzmueller
e685d31f5a use std::move() instead of copying when value is no longer used
This is mainly to shut down coverity which nowadays nags on this.
I am not sure whether we really gain something in these cases.
2024-09-07 12:50:27 +02:00
Juergen Spitzmueller
458f39cc43 Fix cut and past error (reported by coverity) 2024-09-07 12:39:45 +02:00
Juergen Spitzmueller
35b832f344 fix potential null pointer (reported by coverity) 2024-09-07 12:36:23 +02:00
7 changed files with 8 additions and 6 deletions

View File

@ -1707,7 +1707,7 @@ void BufferView::dispatch(FuncRequest const & cmd, DispatchResult & dr)
string label = dit.innerParagraph().getLabelForXRef(); string label = dit.innerParagraph().getLabelForXRef();
if (!label.empty()) { if (!label.empty()) {
// if the paragraph has a label, we refer to this // if the paragraph has a label, we refer to this
string const arg = (type.empty()) ? label : label + " " + type; string const arg = (type.empty()) ? move(label) : move(label) + " " + type;
lyx::dispatch(FuncRequest(LFUN_REFERENCE_INSERT, arg)); lyx::dispatch(FuncRequest(LFUN_REFERENCE_INSERT, arg));
break; break;
} else { } else {

View File

@ -798,7 +798,7 @@ docstring Encodings::convertLaTeXCommands(docstring const & str, bool const lite
if (!cnvtd.empty()) { if (!cnvtd.empty()) {
// it did, so we'll take that bit and proceed with what's left // it did, so we'll take that bit and proceed with what's left
ret += cnvtd; ret += cnvtd;
val = rem; val = move(rem);
continue; continue;
} }
// it's a command of some sort // it's a command of some sort

View File

@ -33,7 +33,7 @@ void Statistics::update(CursorData const & cur, bool skip)
{ {
// early exit if the buffer has not changed since last time // early exit if the buffer has not changed since last time
if (stats_id_ == cur.buffer()->id()) if (stats_id_ == cur.buffer()->id())
return; return;
// reset counts // reset counts
*this = Statistics(); *this = Statistics();

View File

@ -55,7 +55,7 @@ private:
void update(Paragraph const & par, pos_type from = 0, pos_type to = -1); void update(Paragraph const & par, pos_type from = 0, pos_type to = -1);
// Indicate whether parts that produce no output should be counted. // Indicate whether parts that produce no output should be counted.
bool skip_no_output_; bool skip_no_output_ = false;
// Used in the code to track status // Used in the code to track status
bool inword_ = false; bool inword_ = false;
// The buffer id at last statistics computation. // The buffer id at last statistics computation.

View File

@ -1128,7 +1128,7 @@ bool TextClass::readCiteEngine(Lexer & lexrc, ReadType rt, bool const add)
if (numerical) if (numerical)
numerical = getCiteStyles(ENGINE_TYPE_NUMERICAL).empty(); numerical = getCiteStyles(ENGINE_TYPE_NUMERICAL).empty();
if (notes) if (notes)
numerical = getCiteStyles(ENGINE_TYPE_NOTES).empty(); notes = getCiteStyles(ENGINE_TYPE_NOTES).empty();
if (defce) if (defce)
defce = getCiteStyles(ENGINE_TYPE_DEFAULT).empty(); defce = getCiteStyles(ENGINE_TYPE_DEFAULT).empty();
} }

View File

@ -278,6 +278,8 @@ bool GuiLog::initialiseParams(string const & sdata)
continue; continue;
} }
Index const * index = indiceslist.findShortcut(ci); Index const * index = indiceslist.findShortcut(ci);
if (!index)
continue;
string const name = to_utf8(index->index()); string const name = to_utf8(index->index());
logTypeCO->addItem(qt_(name), toqstr("index:" + stmp.absFileName())); logTypeCO->addItem(qt_(name), toqstr("index:" + stmp.absFileName()));
} }

View File

@ -440,7 +440,7 @@ docstring nomenclWidest(Buffer const & buffer)
msymb.size(); msymb.size();
if (wx > w) { if (wx > w) {
w = wx; w = wx;
symb = symbol; symb = move(symbol);
} }
} }
} }