A first batch of potential bugs spotted by llvm/clang

There are more warnings left, but these are the easiest to fix. And some of them are real bugs (assignments with == instead of =).
This commit is contained in:
Jean-Marc Lasgouttes 2013-05-02 16:38:25 +02:00
parent 154319d063
commit bd2e7480b1
12 changed files with 18 additions and 19 deletions

View File

@ -385,7 +385,7 @@ public:
/// \return true if there is a Layout with latexname lay
bool hasLaTeXLayout(std::string const & lay) const;
/// A DocumentClass nevers count as loaded, since it is dynamic
virtual bool loaded() { return false; }
virtual bool loaded() const { return false; }
/// \return the layout object of an inset given by name. If the name
/// is not found as such, the part after the ':' is stripped off, and
/// searched again. In this way, an error fallback can be provided:

View File

@ -183,8 +183,6 @@ private:
GuiIdListModel modules_av_model_;
/// selected modules
GuiIdListModel modules_sel_model_;
/// current buffer
BufferId current_id_;
/// return false if validate_listings_params returns error
bool isValid();

View File

@ -131,10 +131,12 @@ QString symbolFamily(FontFamily family)
}
#if 0
bool isSymbolFamily(FontFamily family)
{
return family >= SYMBOL_FAMILY && family <= ESINT_FAMILY;
}
#endif
static bool isChosenFont(QFont & font, QString const & family)

View File

@ -968,7 +968,7 @@ void GuiWorkArea::generateSyntheticMouseEvent()
d->buffer_view_->scroll(up ? -step : step);
d->buffer_view_->updateMetrics();
} else {
d->buffer_view_->scrollDocView(value + up ? -step : step, false);
d->buffer_view_->scrollDocView(value + (up ? -step : step), false);
}
// In which paragraph do we have to set the cursor ?

View File

@ -257,8 +257,6 @@ protected:
private:
///
QPoint dragStartPos_;
///
int dragCurrentIndex_;
Q_SIGNALS:
///

View File

@ -262,6 +262,7 @@ void TocWidget::on_persistentCB_stateChanged(int state)
}
#if 0
/* FIXME (Ugras 17/11/06):
I have implemented a indexDepth function to get the model indices. In my
opinion, somebody should derive a new qvariant class for tocModelItem
@ -274,7 +275,7 @@ static int indexDepth(QModelIndex const & index, int depth = -1)
return index.parent() == QModelIndex()
? depth : indexDepth(index.parent(), depth);
}
#endif
void TocWidget::on_depthSL_valueChanged(int depth)
{

View File

@ -31,6 +31,8 @@ class Lexer;
class ParamInfo {
public:
///
ParamInfo() {}
/// Types of parameters
enum ParamType {
LATEX_OPTIONAL, /// normal optional argument

View File

@ -57,7 +57,7 @@ public:
///
InsetCode lyxCode() const { return CELL_CODE; }
///
Inset * clone() { return new InsetTableCell(*this); }
Inset * clone() const { return new InsetTableCell(*this); }
///
bool getStatus(Cursor & cur, FuncRequest const & cmd,
FuncStatus & status) const;

View File

@ -139,7 +139,7 @@ void InsetMathFont::htmlize(HtmlStream & os) const
|| tag == "textbf")
variant = "bold";
else if (tag == "mathcal")
variant == "script";
variant = "script";
else if (tag == "mathit" || tag == "textsl"
|| tag == "emph" || tag == "textit")
variant = "italic";
@ -179,7 +179,7 @@ void InsetMathFont::mathmlize(MathStream & os) const
|| tag == "textbf")
variant = "bold";
else if (tag == "mathcal")
variant == "script";
variant = "script";
else if (tag == "mathit" || tag == "textsl"
|| tag == "emph" || tag == "textit")
variant = "italic";

View File

@ -55,8 +55,8 @@ public:
* \param filename the file in question. Must have an absolute path.
* Encoding is always UTF-8.
*/
virtual void set(std::string const & filename);
virtual void set(FileName const & fn, std::string const & suffix);
void set(std::string const & filename);
void set(FileName const & fn, std::string const & suffix);
virtual void erase();
/// Is this filename empty?
bool empty() const;
@ -253,7 +253,7 @@ public:
* \param buffer_path if \c filename has a relative path, generate
* the absolute path using this.
*/
virtual void set(std::string const & filename, std::string const & buffer_path);
void set(std::string const & filename, std::string const & buffer_path);
///
void erase();
///

View File

@ -69,7 +69,7 @@ namespace lyx {
// This version use the traditional gettext.
Messages::Messages(string const & l)
: lang_(l), warned_(false)
: lang_(l)
{
// strip off any encoding suffix, i.e., assume 8-bit po files
size_t i = lang_.find(".");

View File

@ -36,8 +36,6 @@ public:
private:
///
std::string lang_;
/// Did we warn about unavailable locale already?
mutable bool warned_;
///
typedef std::map<std::string, docstring> TranslationCache;
/// Internal cache for gettext translated strings.