Compare commits

...

7 Commits

Author SHA1 Message Date
Jean-Marc Lasgouttes
8e181e992d Avoid a couple of copies.
Spotted by Coverity scan.
2024-09-12 18:33:45 +02:00
Jean-Marc Lasgouttes
7a99ef7fbb Make docstring parameters const references
Spotted by Coverity scan.
2024-09-12 18:28:26 +02:00
Jean-Marc Lasgouttes
b743870d71 Graph::getReachable(): pass a parameter by const reference
Spotted by coverity.
2024-09-12 18:20:43 +02:00
Jean-Marc Lasgouttes
b1bbf64a28 Avoid a copy
Spotted by Coverity scan.
2024-09-12 18:05:50 +02:00
Jean-Marc Lasgouttes
cc40330e00 Avoid a couple of copies
Spotted by Coverity scan.
2024-09-12 17:59:41 +02:00
Jean-Marc Lasgouttes
91f3f27545 GuiWorkArea: pass KeySymbol parameters as const references
Spotted by Coverity scan.
2024-09-12 17:52:57 +02:00
Jean-Marc Lasgouttes
8ea9c2da03 Avoid a couple copies in Trans::addDeadKeys().
Spotted by Coverity scan.
2024-09-12 17:24:32 +02:00
10 changed files with 24 additions and 33 deletions

View File

@ -590,9 +590,8 @@ Buffer * Buffer::cloneWithChildren() const
{
BufferMap bufmap;
cloned_buffers.emplace_back(new CloneList);
CloneList_ptr clones = cloned_buffers.back();
cloneWithChildren(bufmap, clones);
cloneWithChildren(bufmap, cloned_buffers.back());
// make sure we got cloned
BufferMap::const_iterator bit = bufmap.find(this);

View File

@ -79,9 +79,8 @@ Graph::EdgePath const
}
Graph::EdgePath const
Graph::getReachable(int from, bool only_viewable,
bool clear_visited, set<int> excludes)
Graph::EdgePath const Graph::getReachable(int from, bool only_viewable, bool clear_visited,
set<int> const & excludes)
{
EdgePath result;
queue<int> Q;

View File

@ -33,8 +33,8 @@ public:
/// \return a vector of the vertices from which "to" can be reached
EdgePath const getReachableTo(int to, bool clear_visited);
/// \return a vector of the reachable vertices, avoiding all "excludes"
EdgePath const getReachable(int from, bool only_viewable,
bool clear_visited, std::set<int> excludes = std::set<int>());
EdgePath const getReachable(int from, bool only_viewable, bool clear_visited,
std::set<int> const & excludes = std::set<int>());
/// can "from" be reached from "to"?
bool isReachable(int from, int to);
/// find a path from "from" to "to". always returns one of the

View File

@ -176,19 +176,13 @@ tex_accent getkeymod(string const &);
void Trans::addDeadkey(tex_accent accent, docstring const & keys)
{
KmodInfo tmp;
tmp.data = keys;
tmp.accent = accent;
kmod_list_[accent] = tmp;
kmod_list_[accent] = KmodInfo(keys, accent, KmodException());
for (char_type key : keys) {
// FIXME This is a hack.
// tmp is no valid UCS4 string, but misused to store the
// accent.
docstring tmpd;
tmpd += char_type(0);
tmpd += char_type(accent);
keymap_[key] = tmpd;
keymap_[key] = docstring() + char_type(0) + char_type(accent);
}
}

View File

@ -112,6 +112,9 @@ public:
///
KmodInfo() : accent(TEX_NOACCENT) {}
///
KmodInfo(docstring const & d, tex_accent a, KmodException const & e)
: data(d), accent(a), exception_list(e) {}
///
docstring data;
///
tex_accent accent;

View File

@ -1037,7 +1037,7 @@ bool CompressorProxy::emitCheck(bool isAutoRepeat)
}
void CompressorProxy::slot(KeySymbol sym, KeyModifier mod, bool isAutoRepeat)
void CompressorProxy::slot(KeySymbol const & sym, KeyModifier mod, bool isAutoRepeat)
{
if (emitCheck(isAutoRepeat))
Q_EMIT signal(sym, mod);

View File

@ -102,7 +102,7 @@ Q_SIGNALS:
///
void bufferViewChanged();
/// send key event to CompressorProxy
void compressKeySym(KeySymbol sym, KeyModifier mod, bool isAutoRepeat);
void compressKeySym(KeySymbol const & sym, KeyModifier mod, bool isAutoRepeat);
private Q_SLOTS:
/// Scroll the BufferView.
@ -170,9 +170,9 @@ class CompressorProxy : public QObject
bool emitCheck(bool isAutoRepeat);
bool flag_;
// input: event to compress
Q_SLOT void slot(KeySymbol sym, KeyModifier mod, bool isAutoRepeat);
Q_SLOT void slot(KeySymbol const & sym, KeyModifier mod, bool isAutoRepeat);
// output: compressed event
Q_SIGNAL void signal(KeySymbol sym, KeyModifier mod);
Q_SIGNAL void signal(KeySymbol const & sym, KeyModifier mod);
public:
// No default constructor, since the proxy must be a child of the
// target object.

View File

@ -1725,10 +1725,6 @@ void MenuDefinition::expandCiteStyles(BufferView const * bv)
&& (keys.size() > 1
|| !citinset->getParam("pretextlist").empty()
|| !citinset->getParam("posttextlist").empty());
vector<pair<docstring, docstring>> pres =
citinset->getQualifiedLists(citinset->getParam("pretextlist"));
vector<pair<docstring, docstring>> posts =
citinset->getQualifiedLists(citinset->getParam("posttextlist"));
CiteItem ci;
ci.textBefore = citinset->getParam("before");
@ -1738,8 +1734,10 @@ void MenuDefinition::expandCiteStyles(BufferView const * bv)
ci.context = CiteItem::Dialog;
ci.max_size = 40;
ci.isQualified = qualified;
ci.pretexts = pres;
ci.posttexts = posts;
ci.pretexts =
citinset->getQualifiedLists(citinset->getParam("pretextlist"));
ci.posttexts =
citinset->getQualifiedLists(citinset->getParam("posttextlist"));
BiblioInfo::CiteStringMap citeStrings =
buf->masterBibInfo().getCiteStrings(keys, citeStyleList, bv->buffer(), ci);

View File

@ -476,7 +476,7 @@ docstring InsetCitation::complexLabel(bool for_xhtml) const
break;
}
}
string cite_type = getCmdName();
bool const uppercase = isUpperCase(cite_type[0]);
if (uppercase)
@ -502,8 +502,6 @@ docstring InsetCitation::complexLabel(bool for_xhtml) const
&& (keys.size() > 1
|| !getParam("pretextlist").empty()
|| !getParam("posttextlist").empty());
QualifiedList pres = getQualifiedLists(getParam("pretextlist"));
QualifiedList posts = getQualifiedLists(getParam("posttextlist"));
CiteItem ci;
ci.textBefore = getParam("before");
@ -512,8 +510,8 @@ docstring InsetCitation::complexLabel(bool for_xhtml) const
ci.Starred = starred;
ci.max_size = UINT_MAX;
ci.isQualified = qualified;
ci.pretexts = pres;
ci.posttexts = posts;
ci.pretexts = getQualifiedLists(getParam("pretextlist"));
ci.posttexts = getQualifiedLists(getParam("posttextlist"));
if (for_xhtml) {
ci.max_key_size = UINT_MAX;
ci.context = CiteItem::Export;

View File

@ -32,11 +32,11 @@ public:
///
docstring const & formattedCounter() const { return formatted_counter_; }
///
void setCounterValue(docstring cv) { counter_value_ = cv; }
void setCounterValue(docstring const & cv) { counter_value_ = cv; }
///
void setPrettyCounter(docstring pc) { pretty_counter_ = pc; }
void setPrettyCounter(docstring const & pc) { pretty_counter_ = pc; }
///
void setFormattedCounter(docstring fc) { formatted_counter_ = fc; }
void setFormattedCounter(docstring const & fc) { formatted_counter_ = fc; }
///
int rowFlags() const override { return CanBreakBefore | CanBreakAfter; }
/// Updates only the label string, doesn't handle undo nor references.