Compare commits

...

4 Commits

Author SHA1 Message Date
Jean-Marc Lasgouttes
eeb84bce17 Pass three string parameters by address
Spoted by Coverity scan.
2024-09-11 17:33:52 +02:00
Jean-Marc Lasgouttes
13b05102f2 Pass a docstring parameter by address
Spotted by Coverity scan.
2024-09-11 17:30:33 +02:00
Jean-Marc Lasgouttes
e6930ffec8 Pass a pair of docstring arguments by address
Spotted by Coverity scan.
2024-09-11 17:25:03 +02:00
Jean-Marc Lasgouttes
851e59cd26 Avoid an unnecessary string copy
Spotted by Coverity scan.
2024-09-11 17:08:45 +02:00
6 changed files with 10 additions and 9 deletions

View File

@ -245,14 +245,13 @@ LyXVC::CommandResult LyXVC::checkIn(string & log)
LYXERR(Debug::LYXVC, "LyXVC: checkIn");
if (!vcs_)
return ErrorBefore;
docstring empty(_("(no log message)"));
docstring response;
bool ok = true;
if (vcs_->isCheckInWithConfirmation())
ok = Alert::askForText(response, _("LyX VC: Log Message"));
if (ok) {
if (response.empty())
response = empty;
response = _("(no log message)");
//shell collisions
response = subst(response, from_ascii("\""), from_ascii("\\\""));
return vcs_->checkIn(to_utf8(response), log);

View File

@ -835,7 +835,7 @@ void GuiCitation::init()
void GuiCitation::findKey(BiblioInfo const & bi,
QString const & str, bool only_keys,
docstring field, docstring entry_type,
docstring const & field, docstring const & entry_type,
bool case_sensitive, bool reg_exp, bool reset)
{
// FIXME THREAD

View File

@ -129,8 +129,8 @@ private:
BiblioInfo const & bi, //< optimize by passing this
QString const & str, //< string expression
bool only_keys, //< set to true if only keys shall be searched.
docstring field, //<field to search, empty for all fields
docstring entryType, //<entry type to display, empty for all
docstring const & field, //<field to search, empty for all fields
docstring const & entryType, //<entry type to display, empty for all
bool case_sensitive, //< set to true for case sensitive search.
bool reg_exp, //< set to true if \c str is a regular expression.
bool reset = false //< whether to reset and search all keys

View File

@ -99,7 +99,7 @@ static ParamInfo const & findInfo(InsetCode code, string const & cmdName)
ParamInfo::ParamData::ParamData(std::string const & s, ParamType t,
ParamHandling h, bool ignore,
docstring default_value)
docstring const & default_value)
: name_(s), type_(t), handling_(h), ignore_(ignore),
default_value_(default_value)
{}

View File

@ -55,7 +55,7 @@ public:
///
ParamData(std::string const &, ParamType, ParamHandling = HANDLING_NONE,
bool ignore = false,
docstring default_value = docstring());
docstring const & default_value = docstring());
///
std::string name() const { return name_; }
///

View File

@ -1136,7 +1136,8 @@ public:
private:
/// Auxiliary find method (does not account for opt.matchword)
MatchResult findAux(DocIterator const & cur, int len, matchType at_begin) const;
void CreateRegexp(FindAndReplaceOptions const & opt, string regexp_str, string regexp2_str, string par_as_string = "");
void CreateRegexp(FindAndReplaceOptions const & opt, string const & regexp_str,
string const & regexp2_str, string const & par_as_string = string());
/** Normalize a stringified or latexified LyX paragraph.
**
@ -3619,7 +3620,8 @@ static void identifyClosing(string & t, bool ignoreformat)
static int num_replaced = 0;
static bool previous_single_replace = true;
void MatchStringAdv::CreateRegexp(FindAndReplaceOptions const & opt, string regexp_str, string regexp2_str, string par_as_string)
void MatchStringAdv::CreateRegexp(FindAndReplaceOptions const & opt, string const & regexp_str,
string const & regexp2_str, string const & par_as_string)
{
#if QTSEARCH
if (regexp_str.empty() || regexp2_str.empty()) {