mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-25 22:06:15 +00:00
Many small code cleanups suggested by cppcheck
This commit is contained in:
parent
7c1891e0b4
commit
3aba81cf6a
@ -65,7 +65,7 @@ InsetCollapsible::InsetCollapsible(InsetCollapsible const & rhs)
|
||||
}
|
||||
|
||||
|
||||
InsetCollapsible const & InsetCollapsible::operator=(InsetCollapsible const & that)
|
||||
InsetCollapsible & InsetCollapsible::operator=(InsetCollapsible const & that)
|
||||
{
|
||||
if (&that == this)
|
||||
return *this;
|
||||
|
@ -39,7 +39,7 @@ public:
|
||||
///
|
||||
InsetCollapsible(InsetCollapsible const & rhs);
|
||||
///
|
||||
InsetCollapsible const & operator=(InsetCollapsible const &);
|
||||
InsetCollapsible & operator=(InsetCollapsible const &);
|
||||
///
|
||||
virtual ~InsetCollapsible();
|
||||
///
|
||||
|
@ -114,7 +114,7 @@ namespace lyx {
|
||||
// Lgb
|
||||
|
||||
//FIXME: why do we set in stone the type here?
|
||||
InsetFloat::InsetFloat(Buffer * buf, string params_str)
|
||||
InsetFloat::InsetFloat(Buffer * buf, string const & params_str)
|
||||
: InsetCaptionable(buf)
|
||||
{
|
||||
string2params(params_str, params_);
|
||||
@ -431,7 +431,7 @@ void InsetFloat::latex(otexstream & os, OutputParams const & runparams_in) const
|
||||
// sidewaysfloats always use their own page,
|
||||
// therefore don't output the p option that is always set
|
||||
if (!placement.empty()
|
||||
&& (!params_.sideways || (params_.sideways && from_ascii(placement) != "p")))
|
||||
&& (!params_.sideways || from_ascii(placement) != "p"))
|
||||
os << '[' << from_ascii(placement) << ']';
|
||||
os << '\n';
|
||||
|
||||
|
@ -57,7 +57,7 @@ public:
|
||||
class InsetFloat : public InsetCaptionable
|
||||
{
|
||||
public:
|
||||
InsetFloat(Buffer * buffer, std::string params_str);
|
||||
InsetFloat(Buffer * buffer, std::string const & params_str);
|
||||
///
|
||||
static void string2params(std::string const &, InsetFloatParams &);
|
||||
///
|
||||
|
@ -883,15 +883,15 @@ void InsetInclude::latex(otexstream & os, OutputParams const & runparams) const
|
||||
// If needed, use converters to produce a latex file from the child
|
||||
if (tmpwritefile != writefile) {
|
||||
ErrorList el;
|
||||
Converters::RetVal const retval =
|
||||
Converters::RetVal const conv_retval =
|
||||
theConverters().convert(tmp, tmpwritefile, writefile,
|
||||
included_file, inc_format, tex_format, el);
|
||||
if (retval == Converters::KILLED && buffer().isClone() &&
|
||||
if (conv_retval == Converters::KILLED && buffer().isClone() &&
|
||||
buffer().isExporting()) {
|
||||
// We really shouldn't get here, I don't think.
|
||||
LYXERR0("No conversion exception?");
|
||||
throw ConversionException();
|
||||
} else if (retval != Converters::SUCCESS && !runparams.silent) {
|
||||
} else if (conv_retval != Converters::SUCCESS && !runparams.silent) {
|
||||
docstring msg = bformat(_("Included file `%1$s' "
|
||||
"was not exported correctly.\n "
|
||||
"LaTeX export is probably incomplete."),
|
||||
|
@ -168,7 +168,7 @@ set<string> getTexFileList(string const & filename)
|
||||
return list;
|
||||
}
|
||||
|
||||
bool translateString(docstring const in, docstring & out, string const lcode)
|
||||
bool translateString(docstring const & in, docstring & out, string const & lcode)
|
||||
{
|
||||
out = translateIfPossible(in, lcode);
|
||||
return in != out;
|
||||
@ -176,7 +176,7 @@ bool translateString(docstring const in, docstring & out, string const lcode)
|
||||
} // namespace anon
|
||||
|
||||
|
||||
docstring InsetInfoParams::getDate(string const iname, QDate const date) const
|
||||
docstring InsetInfoParams::getDate(string const & iname, QDate const date) const
|
||||
{
|
||||
QLocale loc;
|
||||
if (lang)
|
||||
@ -201,7 +201,7 @@ docstring InsetInfoParams::getDate(string const iname, QDate const date) const
|
||||
}
|
||||
|
||||
|
||||
docstring InsetInfoParams::getTime(string const iname, QTime const time) const
|
||||
docstring InsetInfoParams::getTime(string const & iname, QTime const time) const
|
||||
{
|
||||
QLocale loc;
|
||||
if (lang)
|
||||
|
@ -139,9 +139,9 @@ public:
|
||||
UNKNOWN_INFO, // Invalid type
|
||||
};
|
||||
///
|
||||
docstring getDate(std::string const, QDate const date = QDate::currentDate()) const;
|
||||
docstring getDate(std::string const &, QDate const date = QDate::currentDate()) const;
|
||||
///
|
||||
docstring getTime(std::string const, QTime const time = QTime::currentTime()) const;
|
||||
docstring getTime(std::string const &, QTime const time = QTime::currentTime()) const;
|
||||
///
|
||||
std::vector<std::pair<std::string,docstring>> getArguments(Buffer const * buf,
|
||||
std::string const &) const;
|
||||
|
@ -111,10 +111,9 @@ InsetQuotesParams::QuoteStyle InsetQuotesParams::getQuoteStyle(string const & s,
|
||||
str = "eld";
|
||||
}
|
||||
|
||||
int i;
|
||||
|
||||
// '.' wildcard means: keep current style
|
||||
if (!allow_wildcards || str[0] != '.') {
|
||||
int i;
|
||||
for (i = 0; i < stylescount(); ++i) {
|
||||
if (str[0] == style_char[i]) {
|
||||
res = QuoteStyle(i);
|
||||
@ -144,10 +143,9 @@ InsetQuotesParams::QuoteSide InsetQuotesParams::getQuoteSide(string const & s,
|
||||
str = "eld";
|
||||
}
|
||||
|
||||
int i;
|
||||
|
||||
// '.' wildcard means: keep current side
|
||||
if (!allow_wildcards || str[1] != '.') {
|
||||
int i;
|
||||
for (i = 0; i < 2; ++i) {
|
||||
if (str[1] == side_char[i]) {
|
||||
res = InsetQuotesParams::QuoteSide(i);
|
||||
@ -177,10 +175,9 @@ InsetQuotesParams::QuoteLevel InsetQuotesParams::getQuoteLevel(string const & s,
|
||||
str = "eld";
|
||||
}
|
||||
|
||||
int i;
|
||||
|
||||
// '.' wildcard means: keep current level
|
||||
if (!allow_wildcards || str[2] != '.') {
|
||||
int i;
|
||||
for (i = 0; i < 2; ++i) {
|
||||
if (str[2] == level_char[i]) {
|
||||
res = InsetQuotesParams::QuoteLevel(i);
|
||||
|
@ -86,10 +86,9 @@ InsetText::InsetText(Buffer * buf, UsePlain type)
|
||||
|
||||
|
||||
InsetText::InsetText(InsetText const & in)
|
||||
: Inset(in), text_(this, in.text_)
|
||||
: Inset(in), drawFrame_(in.drawFrame_), frame_color_(in.frame_color_),
|
||||
text_(this, in.text_)
|
||||
{
|
||||
drawFrame_ = in.drawFrame_;
|
||||
frame_color_ = in.frame_color_;
|
||||
}
|
||||
|
||||
|
||||
@ -1142,9 +1141,9 @@ bool InsetText::needsCProtection(bool const maintext, bool const fragile) const
|
||||
Paragraph const & par = pars[size_type(pit)];
|
||||
if (par.needsCProtection(fragile))
|
||||
return true;
|
||||
docstring const pars = par.asString();
|
||||
docstring const par_str = par.asString();
|
||||
for (int k = 0; k < nchars_escape; k++) {
|
||||
if (contains(pars, chars_escape[k]))
|
||||
if (contains(par_str, chars_escape[k]))
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user