commit 3cf887f08ebcb1eeae49b69ac501101e28fc0f07
Author: Jean-Marc Lasgouttes <lasgout...@lyx.org>
Date:   Mon Apr 21 16:50:56 2014 +0200

    Fix various warnings issued by clang++.
    
    * remove unused class TexStream.
    
    * remove unused virtual method Inset::cellXOffset
    
    * remove second argument of FileDialog constructor, which was actually
      not used
    
    * remove some dead local code
    
    * remove some unused private members of classes
    
    * in InsetMathNest::updateBuffer, fix the logic of a test

diff --git a/src/Buffer.cpp b/src/Buffer.cpp
index 80560dd..d47abd9 100644
--- a/src/Buffer.cpp
+++ b/src/Buffer.cpp
@@ -58,7 +58,6 @@
 #include "SpellChecker.h"
 #include "sgml.h"
 #include "TexRow.h"
-#include "TexStream.h"
 #include "Text.h"
 #include "TextClass.h"
 #include "TocBackend.h"
@@ -1555,7 +1554,6 @@ bool Buffer::makeLaTeXFile(FileName const & fname,
        if (!openFileWrite(ofs, fname))
                return false;
 
-       //TexStream ts(ofs.rdbuf(), &texrow());
        ErrorList & errorList = d->errorLists["Export"];
        errorList.clear();
        bool failed_export = false;
diff --git a/src/BufferParams.cpp b/src/BufferParams.cpp
index 6930b78..955f803 100644
--- a/src/BufferParams.cpp
+++ b/src/BufferParams.cpp
@@ -88,11 +88,6 @@ static char const * const string_orientation[] = {
 };
 
 
-static char const * const string_footnotekinds[] = {
-       "footnote", "margin", "fig", "tab", "alg", "wide-fig", "wide-tab", ""
-};
-
-
 static char const * const tex_graphics[] = {
        "default", "dvialw", "dvilaser", "dvipdf", "dvipdfm", "dvipdfmx",
        "dvips", "dvipsone", "dvitops", "dviwin", "dviwindo", "dvi2ps", "emtex",
diff --git a/src/Makefile.am b/src/Makefile.am
index ea5ca42..120bff9 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -178,7 +178,6 @@ SOURCEFILESCORE = \
        Text.cpp \
        Text2.cpp \
        Text3.cpp \
-       TexStream.cpp \
        TextClass.cpp \
        TextMetrics.cpp \
        TocBackend.cpp \
@@ -282,7 +281,6 @@ HEADERFILESCORE = \
        Spacing.h \
        SpellChecker.h \
        TexRow.h \
-       TexStream.h \
        Text.h \
        TextClass.h \
        TextMetrics.h \
diff --git a/src/TexStream.cpp b/src/TexStream.cpp
deleted file mode 100644
index dc1c43c..0000000
--- a/src/TexStream.cpp
+++ /dev/null
@@ -1,121 +0,0 @@
-/**
- * \file TexStream.cpp
- * This file is part of LyX, the document processor.
- * Licence details can be found in the file COPYING.
- *
- * Full author contact details are available in file CREDITS.
- *
- * Inspired by Dietmar Kuehl's prefix iostreams found on
- * http://www.inf.uni-konstanz.de/~kuehl/
- */
-
-#include <config.h>
-
-#include "TexStream.h"
-#include "TexRow.h"
-
-#include <iostream>
-#include <streambuf>
-
-namespace lyx {
-
-////////////////////////////////////////////////////////////////
-//
-// TexStreamBuffer
-//
-////////////////////////////////////////////////////////////////
-
-
-class TexStreamBuffer : public TexStreamBase
-{
-public:
-       TexStreamBuffer(TexStreamBase * sbuf, TexRow * texrow);
-       int line() const { return line_; }
-       int column() const { return column_; }
-
-protected:
-       int_type overflow(int_type);
-       int sync();
-
-private:
-       TexStreamBase * sbuf_; 
-       TexRow * texrow_;
-       int column_;
-       int line_;
-};
-
-
-TexStreamBuffer::TexStreamBuffer(TexStreamBase *sb, TexRow * texrow)
-  : sbuf_(sb), texrow_(texrow), line_(0)
-{
-       setp(0, 0);
-       setg(0, 0, 0);
-}
-
-TexStreamBuffer::int_type TexStreamBuffer::overflow(TexStreamBuffer::int_type 
c)
-{
-       if (c == '\n') {
-               ++line_;
-               column_ = 0;
-       } else {
-               ++column_;
-       }
-       return c;
-}
-
-
-int TexStreamBuffer::sync()
-{
-       sbuf_->pubsync();
-       return 0;
-}
-
-  
-////////////////////////////////////////////////////////////////
-//
-// TexStream
-//
-////////////////////////////////////////////////////////////////
-
-TexStream::TexStream(TexStreamBase * sbuf, TexRow * texrow)
-               : std::basic_ostream<char_type>(sbuf_ = new 
TexStreamBuffer(sbuf, texrow))
-{}
-
-
-TexStream::~TexStream()
-{
-       delete sbuf_;
-}
-
-
-int TexStream::line() const
-{
-       return sbuf_->line();
-}
-
-
-////////////////////////////////////////////////////////////////
-//
-// Test
-//
-////////////////////////////////////////////////////////////////
-
-#if 0
-
-int main(int argc, char *argv[])
-{
-       TexStream out(cout.rdbuf());
-       char c;
-       while (cin) {
-               if (cin.get(c))
-                       out.put(c);
-       }
-       cout << "line count: " << out.line() << endl;
-
-       return 0;
-}
-
-#endif
-
-}
-
diff --git a/src/TexStream.h b/src/TexStream.h
deleted file mode 100644
index 7c4bdd9..0000000
--- a/src/TexStream.h
+++ /dev/null
@@ -1,31 +0,0 @@
-#ifndef TEXSTREAM_H
-#define TEXSTREAM_H
-
-#include "support/docstring.h"
-
-#include "TexRow.h"
-
-#include <iostream>
-#include <streambuf>
-
-namespace lyx {
-
-class TexStreamBuffer;
-class TexRow;
-
-typedef std::basic_streambuf<char_type> TexStreamBase;
-
-class TexStream : public std::basic_ostream<char_type>
-{
-public:
-       TexStream(TexStreamBase * sbuf, TexRow * texrow);
-       ~TexStream();
-       int line() const;
-
-private:
-       TexStreamBuffer * sbuf_;
-};
-
-} // namespace lyx
-
-#endif
diff --git a/src/frontends/qt4/FileDialog.cpp b/src/frontends/qt4/FileDialog.cpp
index 988a8d0..8f63d2e 100644
--- a/src/frontends/qt4/FileDialog.cpp
+++ b/src/frontends/qt4/FileDialog.cpp
@@ -55,8 +55,8 @@ public:
 };
 
 
-FileDialog::FileDialog(QString const & t, FuncCode s)
-       : private_(new FileDialog::Private), title_(t), success_(s)
+FileDialog::FileDialog(QString const & t)
+       : private_(new FileDialog::Private), title_(t)
 {}
 
 
diff --git a/src/frontends/qt4/FileDialog.h b/src/frontends/qt4/FileDialog.h
index d60d9a4..99a9836 100644
--- a/src/frontends/qt4/FileDialog.h
+++ b/src/frontends/qt4/FileDialog.h
@@ -13,8 +13,6 @@
 #ifndef FILEDIALOG_H
 #define FILEDIALOG_H
 
-#include "FuncCode.h"
-
 #include <QString>
 
 #include <utility>
@@ -42,16 +40,12 @@ public:
 
        /**
         * Constructs a file dialog with title \param title.
-        * If \param a is \const LFUN_SELECT_FILE_SYNC then a value
-        * will be returned immediately upon performing a open(),
-        * otherwise a callback Dispatch() will be invoked with the filename as
-        * argument, of action \param a.
         *
         * Up to two optional extra buttons are allowed for specifying
         * additional directories in the navigation (an empty
         * directory is interpreted as FileName::getcwd())
         */
-       FileDialog(QString const & title, FuncCode a = LFUN_SELECT_FILE_SYNC);
+       FileDialog(QString const & title);
 
        ~FileDialog();
 
@@ -83,8 +77,6 @@ private:
        /// the dialog title
        QString title_;
 
-       /// success action to perform if not synchronous
-       FuncCode success_;
 };
 
 } // namespace lyx
diff --git a/src/frontends/qt4/GuiPrefs.cpp b/src/frontends/qt4/GuiPrefs.cpp
index f463d03..92885c5 100644
--- a/src/frontends/qt4/GuiPrefs.cpp
+++ b/src/frontends/qt4/GuiPrefs.cpp
@@ -112,7 +112,7 @@ QString browseFile(QString const & filename,
        else if(!fallback_dir.isEmpty())
                lastPath = fallback_dir;
 
-       FileDialog dlg(title, LFUN_SELECT_FILE_SYNC);
+       FileDialog dlg(title);
        dlg.setButton2(label1, dir1);
        dlg.setButton2(label2, dir2);
 
@@ -183,7 +183,7 @@ QString browseDir(QString const & pathname,
        if (!pathname.isEmpty())
                lastPath = onlyPath(pathname);
 
-       FileDialog dlg(title, LFUN_SELECT_FILE_SYNC);
+       FileDialog dlg(title);
        dlg.setButton1(label1, dir1);
        dlg.setButton2(label2, dir2);
 
diff --git a/src/frontends/qt4/GuiSymbols.cpp b/src/frontends/qt4/GuiSymbols.cpp
index 743cab7..ecaf165 100644
--- a/src/frontends/qt4/GuiSymbols.cpp
+++ b/src/frontends/qt4/GuiSymbols.cpp
@@ -198,7 +198,7 @@ class GuiSymbols::Model : public QAbstractItemModel
 {
 public:
        Model(GuiSymbols * parent)
-               : QAbstractItemModel(parent), parent_(parent)
+               : QAbstractItemModel(parent)
        {}
 
        QModelIndex index(int row, int column, QModelIndex const &) const
@@ -255,8 +255,7 @@ public:
 
 private:
        friend class GuiSymbols;
-       GuiSymbols * parent_;
-       
+
        QList<char_type> symbols_;
 };
 
diff --git a/src/frontends/qt4/GuiView.cpp b/src/frontends/qt4/GuiView.cpp
index f25672e..f1106b0 100644
--- a/src/frontends/qt4/GuiView.cpp
+++ b/src/frontends/qt4/GuiView.cpp
@@ -1946,7 +1946,7 @@ void GuiView::openDocument(string const & fname)
        string filename;
 
        if (fname.empty()) {
-               FileDialog dlg(qt_("Select document to open"), LFUN_FILE_OPEN);
+               FileDialog dlg(qt_("Select document to open"));
                dlg.setButton1(qt_("Documents|#o#O"), 
toqstr(lyxrc.document_path));
                dlg.setButton2(qt_("Examples|#E#e"),
                                
toqstr(addPath(package().system_support().absFileName(), "examples")));
@@ -2085,7 +2085,7 @@ void GuiView::importDocument(string const & argument)
                docstring const text = bformat(_("Select %1$s file to import"),
                        formats.prettyName(format));
 
-               FileDialog dlg(toqstr(text), LFUN_BUFFER_IMPORT);
+               FileDialog dlg(toqstr(text));
                dlg.setButton1(qt_("Documents|#o#O"), 
toqstr(lyxrc.document_path));
                dlg.setButton2(qt_("Examples|#E#e"),
                        
toqstr(addPath(package().system_support().absFileName(), "examples")));
@@ -2219,7 +2219,7 @@ void GuiView::insertLyXFile(docstring const & fname)
                        initpath = trypath;
 
                // FIXME UNICODE
-               FileDialog dlg(qt_("Select LyX document to insert"), 
LFUN_FILE_INSERT);
+               FileDialog dlg(qt_("Select LyX document to insert"));
                dlg.setButton1(qt_("Documents|#o#O"), 
toqstr(lyxrc.document_path));
                dlg.setButton2(qt_("Examples|#E#e"),
                        toqstr(addPath(package().system_support().absFileName(),
@@ -2261,8 +2261,7 @@ bool GuiView::renameBuffer(Buffer & b, docstring const & 
newname, RenameKind kin
 
                // No argument? Ask user through dialog.
                // FIXME UNICODE
-               FileDialog dlg(qt_("Choose a filename to save document as"),
-                                  LFUN_BUFFER_WRITE_AS);
+               FileDialog dlg(qt_("Choose a filename to save document as"));
                dlg.setButton1(qt_("Documents|#o#O"), 
toqstr(lyxrc.document_path));
                dlg.setButton2(qt_("Templates|#T#t"), 
toqstr(lyxrc.template_path));
 
@@ -3467,7 +3466,6 @@ void GuiView::dispatch(FuncRequest const & cmd, 
DispatchResult & dr)
 
                case LFUN_FILE_INSERT_PLAINTEXT:
                case LFUN_FILE_INSERT_PLAINTEXT_PARA: {
-                       bool const as_paragraph = (cmd.action() == 
LFUN_FILE_INSERT_PLAINTEXT_PARA);
                        string const fname = to_utf8(cmd.argument());
                        if (!fname.empty() && !FileName::isAbsolute(fname)) {
                                dr.setMessage(_("Absolute filename expected."));
@@ -3476,8 +3474,7 @@ void GuiView::dispatch(FuncRequest const & cmd, 
DispatchResult & dr)
                        
                        FileName filename(fname);
                        if (fname.empty()) {
-                               FileDialog dlg(qt_("Select file to insert"), 
(as_paragraph ?
-                                       LFUN_FILE_INSERT_PLAINTEXT_PARA : 
LFUN_FILE_INSERT_PLAINTEXT));
+                               FileDialog dlg(qt_("Select file to insert"));
 
                                FileDialog::Result result = 
dlg.open(toqstr(bv->buffer().filePath()),
                                        QStringList(qt_("All Files (*)")));
diff --git a/src/insets/Inset.h b/src/insets/Inset.h
index b18f8a5..f299b99 100644
--- a/src/insets/Inset.h
+++ b/src/insets/Inset.h
@@ -263,10 +263,6 @@ public:
        virtual row_type row(idx_type) const { return 0; }
        /// cell index corresponding to row and column;
        virtual idx_type index(row_type row, col_type col) const;
-       /// any additional x-offset when drawing a cell?
-       virtual int cellXOffset(idx_type) const { return 0; }
-       /// any additional y-offset when drawing a cell?
-       virtual int cellYOffset(idx_type) const { return 0; }
        /// number of embedded cells
        virtual size_t nargs() const { return 0; }
        /// number of rows in gridlike structures
diff --git a/src/insets/InsetQuotes.cpp b/src/insets/InsetQuotes.cpp
index 3ff490e..80981a0 100644
--- a/src/insets/InsetQuotes.cpp
+++ b/src/insets/InsetQuotes.cpp
@@ -328,7 +328,7 @@ int InsetQuotes::docbook(odocstream & os, OutputParams 
const &) const
 }
 
 
-docstring InsetQuotes::xhtml(XHTMLStream & xs, OutputParams const & op) const
+docstring InsetQuotes::xhtml(XHTMLStream & xs, OutputParams const &) const
 {
        xs << XHTMLStream::ESCAPE_NONE << getQuoteEntity();
        return docstring();
diff --git a/src/mathed/InsetMathNest.cpp b/src/mathed/InsetMathNest.cpp
index 2209e02..3d3308c 100644
--- a/src/mathed/InsetMathNest.cpp
+++ b/src/mathed/InsetMathNest.cpp
@@ -1771,7 +1771,7 @@ bool InsetMathNest::interpretChar(Cursor & cur, char_type 
const c)
                        // but suppress direct insertion of two spaces in a row
                        // the still allows typing  '<space>a<space>' and 
deleting the 'a', but
                        // it is better than nothing...
-                       if (!cur.pos() != 0 || cur.prevAtom()->getChar() != ' 
') {
+                       if (cur.pos() == 0 || cur.prevAtom()->getChar() != ' ') 
{
                                cur.insert(c);
                                // FIXME: we have to enable full redraw here 
because of the
                                // visual box corners that define the inset. If 
we know for
diff --git a/src/output_xhtml.cpp b/src/output_xhtml.cpp
index 281ffc2..d76a353 100644
--- a/src/output_xhtml.cpp
+++ b/src/output_xhtml.cpp
@@ -742,35 +742,15 @@ XHTMLStream & XHTMLStream::operator<<(html::EndTag const 
& etag)
        // curtag is now the one we actually want.
        os_ << curtag->writeEndTag();
        tag_stack_.pop_back();
-       
+
        return *this;
 }
 
 // End code for XHTMLStream
 
 namespace {
-       
-// convenience functions
-
-inline void openTag(XHTMLStream & xs, Layout const & lay)
-{
-       xs << html::StartTag(lay.htmltag(), lay.htmlattr());
-}
-
-
-void openTag(XHTMLStream & xs, Layout const & lay, 
-             ParagraphParameters const & params)
-{
-       // FIXME Are there other things we should handle here?
-       string const align = alignmentToCSS(params.align());
-       if (align.empty()) {
-               openTag(xs, lay);
-               return;
-       }
-       string attrs = lay.htmlattr() + " style='text-align: " + align + ";'";
-       xs << html::StartTag(lay.htmltag(), attrs);
-}
 
+// convenience functions
 
 inline void openParTag(XHTMLStream & xs, Layout const & lay,
                        std::string parlabel)
diff --git a/status.21x b/status.21x
index 0bb056c..7dfca01 100644
--- a/status.21x
+++ b/status.21x
@@ -191,3 +191,5 @@ What's new
 - Fix a configuration error on Windows causing that TeX files were not scanned.
 
 - Add "Keywords" to lyx.desktop file (bug 9414).
+
+- Fix several compilation warnings (bug 9488).

Reply via email to