mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-22 01:59:02 +00:00
Fix a bunch of minor issues discovered by the cppcheck script.
This commit is contained in:
parent
84d4d45daa
commit
065db68067
@ -67,10 +67,10 @@ public:
|
||||
///
|
||||
Author const & get(int id) const;
|
||||
///
|
||||
typedef std::vector<Author> Authors;
|
||||
///
|
||||
void sort();
|
||||
///
|
||||
typedef std::vector<Author> Authors;
|
||||
///
|
||||
Authors::const_iterator begin() const;
|
||||
///
|
||||
Authors::const_iterator end() const;
|
||||
|
@ -384,7 +384,7 @@ void Compare::run()
|
||||
AuthorList const & extra_authors = options_.settings_from_new ?
|
||||
old_buffer->params().authors() : new_buffer->params().authors();
|
||||
AuthorList::Authors::const_iterator it = extra_authors.begin();
|
||||
for (; it != extra_authors.end(); it++)
|
||||
for (; it != extra_authors.end(); ++it)
|
||||
dest_buffer->params().authors().record(*it);
|
||||
|
||||
doStatusMessage();
|
||||
|
@ -56,8 +56,7 @@ static FileName cache_dir;
|
||||
|
||||
class CacheItem {
|
||||
public:
|
||||
CacheItem()
|
||||
{}
|
||||
CacheItem() {}
|
||||
CacheItem(FileName const & orig_from, string const & to_format,
|
||||
time_t t, unsigned long c)
|
||||
: timestamp(t), checksum(c)
|
||||
|
@ -635,7 +635,6 @@ bool Cursor::posVisRight(bool skip_inset)
|
||||
Cursor new_cur = *this; // where we will move to
|
||||
pos_type left_pos; // position visually left of current cursor
|
||||
pos_type right_pos; // position visually right of current cursor
|
||||
bool new_pos_is_RTL; // is new position we're moving to RTL?
|
||||
|
||||
getSurroundingPos(left_pos, right_pos);
|
||||
|
||||
@ -679,7 +678,7 @@ bool Cursor::posVisRight(bool skip_inset)
|
||||
// we're currently to the left of 'right_pos'). In
|
||||
// order to move to the right, it depends whether or
|
||||
// not the character at 'right_pos' is RTL.
|
||||
new_pos_is_RTL = paragraph().getFontSettings(
|
||||
bool const new_pos_is_RTL = paragraph().getFontSettings(
|
||||
buffer()->params(), right_pos).isVisibleRightToLeft();
|
||||
// If the character at 'right_pos' *is* LTR, then in
|
||||
// order to move to the right of it, we need to be
|
||||
@ -735,7 +734,6 @@ bool Cursor::posVisLeft(bool skip_inset)
|
||||
Cursor new_cur = *this; // where we will move to
|
||||
pos_type left_pos; // position visually left of current cursor
|
||||
pos_type right_pos; // position visually right of current cursor
|
||||
bool new_pos_is_RTL; // is new position we're moving to RTL?
|
||||
|
||||
getSurroundingPos(left_pos, right_pos);
|
||||
|
||||
@ -779,7 +777,7 @@ bool Cursor::posVisLeft(bool skip_inset)
|
||||
// currently to the right of 'left_pos'). In order to
|
||||
// move to the left, it depends whether or not the
|
||||
// character at 'left_pos' is RTL.
|
||||
new_pos_is_RTL = paragraph().getFontSettings(
|
||||
bool const new_pos_is_RTL = paragraph().getFontSettings(
|
||||
buffer()->params(), left_pos).isVisibleRightToLeft();
|
||||
// If the character at 'left_pos' *is* RTL, then in
|
||||
// order to move to the left of it, we need to be
|
||||
|
@ -24,10 +24,6 @@ using namespace std;
|
||||
namespace lyx {
|
||||
|
||||
|
||||
Floating::Floating()
|
||||
{}
|
||||
|
||||
|
||||
Floating::Floating(string const & type, string const & placement,
|
||||
string const & ext, string const & within,
|
||||
string const & style, string const & name,
|
||||
|
@ -26,7 +26,7 @@ namespace lyx {
|
||||
class Floating {
|
||||
public:
|
||||
///
|
||||
Floating();
|
||||
Floating() {}
|
||||
///
|
||||
Floating(std::string const & type, std::string const & placement,
|
||||
std::string const & ext, std::string const & within,
|
||||
|
@ -20,7 +20,7 @@ namespace lyx {
|
||||
|
||||
OutputParams::OutputParams(Encoding const * enc)
|
||||
: flavor(LATEX), math_flavor(NotApplicable), nice(false), is_child(false),
|
||||
moving_arg(false), inulemcmd(0), local_font(0), master_language(0),
|
||||
moving_arg(false), intitle(false), inulemcmd(0), local_font(0), master_language(0),
|
||||
encoding(enc), free_spacing(false), use_babel(false), use_polyglossia(false),
|
||||
use_indices(false), use_japanese(false), linelen(0), depth(0),
|
||||
exportdata(new ExportData),
|
||||
|
@ -45,7 +45,7 @@ class PainterInfo;
|
||||
class ParagraphMetrics {
|
||||
public:
|
||||
/// Default constructor (only here for STL containers).
|
||||
ParagraphMetrics() : par_(0) {}
|
||||
ParagraphMetrics() : position_(0), par_(0) {}
|
||||
/// The only useful constructor.
|
||||
explicit ParagraphMetrics(Paragraph const & par);
|
||||
|
||||
|
@ -24,7 +24,7 @@ namespace lyx {
|
||||
class PersonalWordList {
|
||||
public:
|
||||
/// the word list has an associated language
|
||||
PersonalWordList(std::string lang) { lang_ = lang; }
|
||||
PersonalWordList(std::string lang) : lang_(lang), dirty_(false) {}
|
||||
/// the location of the file to hold to word list
|
||||
lyx::support::FileName dictfile() const;
|
||||
/// (re)load the word list from file
|
||||
@ -44,11 +44,17 @@ public:
|
||||
/// end of word list
|
||||
docstring_list::const_iterator end() const;
|
||||
private:
|
||||
///
|
||||
docstring_list words_;
|
||||
///
|
||||
std::string lang_;
|
||||
///
|
||||
bool dirty_;
|
||||
///
|
||||
bool equalwords(docstring const & w1, docstring const & w2) const;
|
||||
///
|
||||
std::string header() const { return "# personal word list"; }
|
||||
///
|
||||
void dirty(bool flag) { dirty_ = flag; }
|
||||
};
|
||||
|
||||
|
@ -219,7 +219,7 @@ enum TextClassTags {
|
||||
TC_CITEENGINETYPE,
|
||||
TC_CITEFORMAT,
|
||||
TC_DEFAULTBIBLIO,
|
||||
TC_FULLAUTHORLIST,
|
||||
TC_FULLAUTHORLIST
|
||||
};
|
||||
|
||||
|
||||
|
@ -1152,11 +1152,10 @@ Dimension TextMetrics::rowHeight(pit_type const pit, pos_type const first,
|
||||
pit_type nextpit = pit + 1;
|
||||
if (nextpit != pit_type(pars.size())) {
|
||||
pit_type cpit = pit;
|
||||
double usual = 0;
|
||||
double unusual = 0;
|
||||
|
||||
if (pars[cpit].getDepth() > pars[nextpit].getDepth()) {
|
||||
usual = pars[cpit].layout().bottomsep * dh;
|
||||
double usual = pars[cpit].layout().bottomsep * dh;
|
||||
double unusual = 0;
|
||||
cpit = text_->depthHook(cpit, pars[nextpit].getDepth());
|
||||
if (pars[cpit].layout() != pars[nextpit].layout()
|
||||
|| pars[nextpit].getLabelWidthString() != pars[cpit].getLabelWidthString())
|
||||
|
@ -54,7 +54,6 @@ class Painter {
|
||||
public:
|
||||
Painter() : drawing_enabled_(true) {}
|
||||
|
||||
float line_width;
|
||||
static const float thin_line;
|
||||
|
||||
/// possible line styles
|
||||
|
@ -110,8 +110,8 @@ bool FindAndReplaceWidget::eventFilter(QObject * obj, QEvent * event)
|
||||
// back to how it was
|
||||
searchbackCB->setChecked(searchback);
|
||||
return true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
case Qt::Key_Tab:
|
||||
if (e->modifiers() == Qt::NoModifier) {
|
||||
if (obj == find_work_area_){
|
||||
|
@ -41,8 +41,8 @@ public:
|
||||
int x1, int y1,
|
||||
int x2, int y2,
|
||||
Color,
|
||||
line_style = line_solid,
|
||||
float line_width = thin_line);
|
||||
line_style ls = line_solid,
|
||||
float lw = thin_line);
|
||||
|
||||
/**
|
||||
* lines - draw a set of lines
|
||||
@ -55,8 +55,8 @@ public:
|
||||
int const * yp,
|
||||
int np,
|
||||
Color,
|
||||
line_style = line_solid,
|
||||
float line_width = thin_line);
|
||||
line_style ls = line_solid,
|
||||
float lw = thin_line);
|
||||
|
||||
/// draw a rectangle
|
||||
virtual void rectangle(
|
||||
@ -64,7 +64,7 @@ public:
|
||||
int w, int h,
|
||||
Color,
|
||||
line_style = line_solid,
|
||||
float line_width = thin_line);
|
||||
float lw = thin_line);
|
||||
|
||||
/// draw a filled rectangle
|
||||
virtual void fillRectangle(
|
||||
|
@ -77,7 +77,7 @@ FileName imageLibFileSearch(QString & dir, QString const & name,
|
||||
|
||||
namespace {
|
||||
|
||||
double locstringToDouble(QString const str)
|
||||
double locstringToDouble(QString const & str)
|
||||
{
|
||||
QLocale loc;
|
||||
bool ok;
|
||||
|
@ -108,8 +108,6 @@ public:
|
||||
|
||||
/// change associated Buffer
|
||||
virtual void setBuffer(Buffer & buffer);
|
||||
/// remove the buffer reference
|
||||
void resetBuffer() { setBuffer( *static_cast<Buffer *>(0)); }
|
||||
/// retrieve associated Buffer
|
||||
virtual Buffer & buffer();
|
||||
virtual Buffer const & buffer() const;
|
||||
|
@ -78,12 +78,10 @@ void InsetBibitem::initView()
|
||||
void InsetBibitem::updateCommand(docstring const & new_key, bool)
|
||||
{
|
||||
docstring key = new_key;
|
||||
|
||||
vector<docstring> bibkeys = buffer().masterBibInfo().getKeys();
|
||||
|
||||
int i = 1;
|
||||
|
||||
if (find(bibkeys.begin(), bibkeys.end(), key) != bibkeys.end()) {
|
||||
int i = 1;
|
||||
// generate unique label
|
||||
key = new_key + '-' + convert<docstring>(i);
|
||||
while (find(bibkeys.begin(), bibkeys.end(), key) != bibkeys.end()) {
|
||||
@ -131,7 +129,6 @@ void InsetBibitem::doDispatch(Cursor & cur, FuncRequest & cmd)
|
||||
docstring label = p["label"];
|
||||
|
||||
// definitions for escaping
|
||||
int previous;
|
||||
static docstring const backslash = from_ascii("\\");
|
||||
static docstring const lbrace = from_ascii("{");
|
||||
static docstring const rbrace = from_ascii("}");
|
||||
@ -140,6 +137,7 @@ void InsetBibitem::doDispatch(Cursor & cur, FuncRequest & cmd)
|
||||
static char_type const brackets_escape[2] = {'[', ']'};
|
||||
|
||||
if (!label.empty()) {
|
||||
int previous;
|
||||
// The characters in chars_name[] need to be changed to a command when
|
||||
// they are in the name field.
|
||||
for (int k = 0; k < 6; k++)
|
||||
|
@ -174,8 +174,6 @@ private:
|
||||
///
|
||||
std::string defaultCSSClass() const;
|
||||
///
|
||||
std::string defaultCSSLabelClass() const { return defaultCSSClass() + "_label"; }
|
||||
///
|
||||
void readArgument(Lexer &);
|
||||
///
|
||||
docstring name_;
|
||||
|
@ -53,7 +53,7 @@ public:
|
||||
|
||||
protected:
|
||||
RenderBase() : state_(false) {}
|
||||
RenderBase(RenderBase const &x) : state_(x.state_){}
|
||||
RenderBase(RenderBase const & x) : state_(x.state_) {}
|
||||
RenderBase & operator=(RenderBase const &) { return *this; }
|
||||
|
||||
/// render state. currently, render_button uses this to store mouse_hover_
|
||||
|
@ -96,7 +96,7 @@ public:
|
||||
SearchScope scope = S_BUFFER,
|
||||
SearchRestriction restr = R_EVERYTHING
|
||||
);
|
||||
FindAndReplaceOptions() { }
|
||||
FindAndReplaceOptions() {}
|
||||
docstring find_buf_name;
|
||||
bool casesensitive;
|
||||
bool matchword;
|
||||
|
@ -151,7 +151,7 @@ static InsetLabel * dummy_pointer = 0;
|
||||
InsetMathHull::InsetMathHull(Buffer * buf)
|
||||
: InsetMathGrid(buf, 1, 1), type_(hullNone), numbered_(1, true),
|
||||
numbers_(1, empty_docstring()), label_(1, dummy_pointer),
|
||||
preview_(new RenderPreview(this))
|
||||
preview_(new RenderPreview(this)), use_preview_(false)
|
||||
{
|
||||
//lyxerr << "sizeof InsetMath: " << sizeof(InsetMath) << endl;
|
||||
//lyxerr << "sizeof MetricsInfo: " << sizeof(MetricsInfo) << endl;
|
||||
@ -166,7 +166,7 @@ InsetMathHull::InsetMathHull(Buffer * buf)
|
||||
InsetMathHull::InsetMathHull(Buffer * buf, HullType type)
|
||||
: InsetMathGrid(buf, getCols(type), 1), type_(type), numbered_(1, true),
|
||||
numbers_(1, empty_docstring()), label_(1, dummy_pointer),
|
||||
preview_(new RenderPreview(this))
|
||||
preview_(new RenderPreview(this)), use_preview_(false)
|
||||
{
|
||||
buffer_ = buf;
|
||||
initMath();
|
||||
|
@ -29,17 +29,18 @@
|
||||
namespace lyx {
|
||||
|
||||
InsetMathSymbol::InsetMathSymbol(latexkeys const * l)
|
||||
: sym_(l), h_(0), scriptable_(false)
|
||||
: sym_(l), h_(0), kerning_(0), scriptable_(false)
|
||||
{}
|
||||
|
||||
|
||||
InsetMathSymbol::InsetMathSymbol(char const * name)
|
||||
: sym_(in_word_set(from_ascii(name))), h_(0), scriptable_(false)
|
||||
: sym_(in_word_set(from_ascii(name))), h_(0),
|
||||
kerning_(0), scriptable_(false)
|
||||
{}
|
||||
|
||||
|
||||
InsetMathSymbol::InsetMathSymbol(docstring const & name)
|
||||
: sym_(in_word_set(name)), h_(0), scriptable_(false)
|
||||
: sym_(in_word_set(name)), h_(0), kerning_(0), scriptable_(false)
|
||||
{}
|
||||
|
||||
|
||||
|
@ -142,7 +142,7 @@ inline void operator|=(Debug::Type & d1, Debug::Type d2)
|
||||
class LyXErr
|
||||
{
|
||||
public:
|
||||
LyXErr(): enabled_(true), second_enabled_(false) {}
|
||||
LyXErr(): dt_(Debug::NONE), enabled_(true), second_enabled_(false) {}
|
||||
|
||||
/// Disable the stream completely
|
||||
void disable();
|
||||
|
Loading…
Reference in New Issue
Block a user