]> git.lyx.org Git - features.git/commitdiff
A first batch of potential bugs spotted by llvm/clang
authorJean-Marc Lasgouttes <lasgouttes@lyx.org>
Thu, 2 May 2013 14:38:25 +0000 (16:38 +0200)
committerJean-Marc Lasgouttes <lasgouttes@lyx.org>
Thu, 2 May 2013 14:38:25 +0000 (16:38 +0200)
There are more warnings left, but these are the easiest to fix. And some of them are real bugs (assignments with == instead of =).

12 files changed:
src/TextClass.h
src/frontends/qt4/GuiDocument.h
src/frontends/qt4/GuiFontLoader.cpp
src/frontends/qt4/GuiWorkArea.cpp
src/frontends/qt4/GuiWorkArea.h
src/frontends/qt4/TocWidget.cpp
src/insets/InsetCommandParams.h
src/insets/InsetTabular.h
src/mathed/InsetMathFont.cpp
src/support/FileName.h
src/support/Messages.cpp
src/support/Messages.h

index bc900fa7a5093e21db446b29bc3cadf853c032d7..9475b621e573786ebbaacaf66679859c1a3dba5e 100644 (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:
index 413e2e29e9e34494d75e7b0338a9bd6cabeb66d9..cfd58823fed127594514139932534004849e7eca 100644 (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();
index 7302ff2c3b0159e3d07109084dd84026c5691e8c..b2448bebeec226a9cfd744ba63bc06de38939640 100644 (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)
index ac632f9e05c475b8633b69dd83e1273b9008b4df..adfaf4a1cc0fcea82320a5599eb0831670baf51a 100644 (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 ?
index a33e158a5478efc5e4f283f4b5dd16d970b5792a..f9727f9507f6135d4d9ee33ffc661db76f9d0d6c 100644 (file)
@@ -257,8 +257,6 @@ protected:
 private:
        ///
        QPoint dragStartPos_;
-       ///
-       int dragCurrentIndex_;
 
 Q_SIGNALS:
        ///
index 247addbcc9f8ee4faa4c9536cebcd2c3a072b9f8..4bb5345f2786cb0e1a6ca3408da1bd6707c3970c 100644 (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)
 {
index 7dc59fa5ee764fc0e46cf65d4d5a6008ee5fdb42..219d79b27ea92ed9dd80c3ed198c6e810a18d09d 100644 (file)
@@ -31,6 +31,8 @@ class Lexer;
 
 class ParamInfo {
 public:
+       ///
+       ParamInfo() {}
        /// Types of parameters
        enum ParamType {
                LATEX_OPTIONAL,    /// normal optional argument
index 178060e86aba47d8a8c7d2c4f408913d453c80a7..1fed9bea174b96c1701d91c4085decfa146e2276 100644 (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;
index 26789e71e8016f351bf1123953b381275d8f8b0e..b2e7c1dccc1b51dad33e162a39776c9c5606c766 100644 (file)
@@ -101,7 +101,7 @@ void InsetMathFont::validate(LaTeXFeatures & features) const
                                || (key_->name.length() == 6 && key_->name.substr(0, 4) == "text"))
                        features.require("amstext");
                if (key_->name == "mathscr")
-                       features.require("mathrsfs"); 
+                       features.require("mathrsfs");
                if (key_->name == "textipa")
                        features.require("tipa");
                if (key_->name == "ce" || key_->name == "cf")
@@ -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";
@@ -149,7 +149,7 @@ void InsetMathFont::htmlize(HtmlStream & os) const
                variant = "monospace";
        else if (tag == "textipa" || tag == "textsc" || tag == "noun")
                variant = "noun";
-       
+
        docstring const beg = (tag.size() < 4) ? from_ascii("") : tag.substr(0, 4);
        if (!variant.empty()) {
                os << MTag("span", "class='" + variant + "'")
@@ -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";
@@ -188,7 +188,7 @@ void InsetMathFont::mathmlize(MathStream & os) const
        else if (tag == "mathtt" || tag == "texttt")
                variant = "monospace";
        // no support at present for textipa, textsc, noun
-       
+
        if (!variant.empty()) {
                os << MTag("mstyle", "mathvariant='" + variant + "'")
                   << cell(0)
index 83d9e946f26898c9d092e87a49471bdeb6f1c072..fe15163889ec1214fa1299b6692f3a7170ead170 100644 (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();
        ///
index 69273c41b8d62fc69a41dc4bf4189cda97d8620e..4e58a873fd23ac15e60932b29a5e375a376e0d19 100644 (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(".");
index 4ba2737cef1518911c99923991a213b80c511b23..655577c0c784772103ff18fc835a455fd448fbc4 100644 (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.