]> git.lyx.org Git - features.git/commitdiff
Squash a bunch of compiler warnings.
authorAngus Leeming <leeming@lyx.org>
Sat, 27 Mar 2004 01:18:51 +0000 (01:18 +0000)
committerAngus Leeming <leeming@lyx.org>
Sat, 27 Mar 2004 01:18:51 +0000 (01:18 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@8538 a592a061-630c-0410-9148-cb99ea01b6c8

17 files changed:
src/BufferView_pimpl.C
src/ChangeLog
src/CutAndPaste.C
src/buffer.C
src/frontends/controllers/ControlErrorList.C
src/frontends/gtk/FileDialogPrivate.C
src/frontends/gtk/GPainter.C
src/frontends/gtk/GToolbar.C
src/frontends/qt2/QRef.C
src/iterators.C
src/mathed/math_scriptinset.C
src/output_plaintext.C
src/outputparams.h
src/paragraph_funcs.C
src/rowpainter.C
src/text.C
src/text2.C

index cd1ae3f597910a7b7f2574118b2221d34015d6af..76b745b48cd849c8c23bdb53063a8d32dbe4c8fa 100644 (file)
@@ -713,12 +713,14 @@ void BufferView::Pimpl::stuffClipboard(string const & stuff) const
 }
 
 
-InsetBase * BufferView::Pimpl::getInsetByCode(InsetBase::Code code)
+InsetBase * BufferView::Pimpl::getInsetByCode(InsetBase::Code /*code*/)
 {
 #warning Does not work for mathed
        // Ok, this is a little bit too brute force but it
        // should work for now. Better infrastructure is coming. (Lgb)
 
+#warning FIXME
+#if 0
        Buffer * buf = bv_->buffer();
        Buffer::inset_iterator beg = buf->inset_iterator_begin();
        Buffer::inset_iterator end = buf->inset_iterator_end();
@@ -726,8 +728,6 @@ InsetBase * BufferView::Pimpl::getInsetByCode(InsetBase::Code code)
        bool cursor_par_seen = false;
 
        LCursor & cur = bv_->cursor();
-#warning FIXME
-#if 0
        LyXText * = bv_->getLyXText();
        ParagraphList::iterator pit = text->getPar(cur.par());
 
index 3eaee3c7085056fe2518d8037b921af634c04fc8..b3ed0d7a83d35a84ac9037f531446e875280a659 100644 (file)
@@ -1,3 +1,22 @@
+2004-03-26  Angus Leeming  <leeming@lyx.org>
+
+       * src/BufferView_pimpl.C:
+       * src/CutAndPaste.C:
+       * src/buffer.C:
+       * src/iterators.C:
+       * src/output_plaintext.C:
+       * src/outputparams.h:
+       * src/paragraph_funcs.C:
+       * src/rowpainter.C:
+       * src/text.C:
+       * src/text2.C:
+       * src/frontends/controllers/ControlErrorList.C:
+       * src/frontends/gtk/FileDialogPrivate.C:
+       * src/frontends/gtk/GPainter.C:
+       * src/frontends/gtk/GToolbar.C:
+       * src/frontends/qt2/QRef.C:
+       * src/mathed/math_scriptinset.C: squash compiler warnings.
+
 2004-03-26  Angus Leeming  <leeming@lyx.org>
 
        * ispell.C (LaunchIspell::start):
index de02331c41508c22c715afeb4bff50f170411a52..d94dc4de6e463a9e92ccad29d6b2f2208dbf70f1 100644 (file)
@@ -139,10 +139,12 @@ PitPosPair eraseSelection(BufferParams const & params, ParagraphList & pars,
        par_type startpit, par_type endpit,
        int startpos, int endpos, bool doclear)
 {
-       if (startpit == pars.size() || (startpos > pars[startpit].size()))
+       if (startpit == par_type(pars.size()) ||
+           (startpos > pars[startpit].size()))
                return PitPosPair(endpit, endpos);
 
-       if (endpit == pars.size() || startpit == endpit) {
+       if (endpit == par_type(pars.size()) ||
+           startpit == endpit) {
                endpos -= pars[startpit].erase(startpos, endpos);
                return PitPosPair(endpit, endpos);
        }
@@ -162,7 +164,7 @@ PitPosPair eraseSelection(BufferParams const & params, ParagraphList & pars,
 
        par_type pit = startpit + 1;
 
-       while (pit != endpit && pit != pars.size()) {
+       while (pit != endpit && pit != par_type(pars.size())) {
                par_type const next = pit + 1;
                // "erase" the contents of the par
                pars[pit].erase(0, pars[pit].size());
@@ -183,7 +185,7 @@ PitPosPair eraseSelection(BufferParams const & params, ParagraphList & pars,
        }
 #endif
 
-       if (startpit + 1 == pars.size())
+       if (startpit + 1 == par_type(pars.size()))
                return PitPosPair(endpit, endpos);
 
        if (doclear) {
@@ -324,7 +326,7 @@ pasteSelection(Buffer const & buffer, ParagraphList & pars,
 
        // Split the paragraph for inserting the buf if necessary.
        bool did_split = false;
-       if (pars[pit].size() || pit + 1 == pars.size()) {
+       if (pars[pit].size() || pit + 1 == par_type(pars.size())) {
                breakParagraphConservative(buffer.params(), pars, pit, pos);
                did_split = true;
        }
@@ -344,7 +346,7 @@ pasteSelection(Buffer const & buffer, ParagraphList & pars,
        pos = pars[last_paste].size();
 
        // Maybe some pasting.
-       if (did_split && last_paste + 1 != pars.size()) {
+       if (did_split && last_paste + 1 != par_type(pars.size())) {
                if (pars[last_paste + 1].hasSameLayout(pars[last_paste])) {
                        mergeParagraph(buffer.params(), pars, last_paste);
                } else if (pars[last_paste + 1].empty()) {
index e3c5ceadc6e33c422085b601ea45e606b89e93a1..904d63cc4afefff7c33d22e1c43cb4d7fbff7c67 100644 (file)
@@ -1302,7 +1302,7 @@ bool Buffer::isMultiLingual() const
 
 void Buffer::inset_iterator::setParagraph()
 {
-       while (pit != pars_->size()) {
+       while (pit != par_type(pars_->size())) {
                it = (*pars_)[pit].insetlist.begin();
                if (it != (*pars_)[pit].insetlist.end())
                        return;
@@ -1522,7 +1522,7 @@ Buffer::inset_iterator Buffer::inset_const_iterator_end() const
 
 Buffer::inset_iterator & Buffer::inset_iterator::operator++()
 {
-       if (pit != pars_->size()) {
+       if (pit != par_type(pars_->size())) {
                ++it;
                if (it == (*pars_)[pit].insetlist.end()) {
                        ++pit;
index 44fcb2e2b6c551198ba349499b282b5095181b42..005378f481ae750c66fed452d9d24d607cc79631 100644 (file)
@@ -72,6 +72,7 @@ void ControlErrorList::goTo(int item)
 
        // Now make the selection.
 #warning FIXME (goto error)
+#warning This should be implemented using an LFUN. (Angus)
 #if 0
        PosIterator const pos(pit, start);
        kernel().bufferview()->putSelectionAt(pos, range, false);
index 085576461eb6494167ac783dff4f4158760dac4e..a1b3cc2d7ef9033d1a31c770684f41dc76968d30 100644 (file)
@@ -18,8 +18,8 @@ using std::string;
 
 FileDialog::Private::Private(string const & title,
                             kb_action action,
-                            FileDialog::Button b1,
-                            FileDialog::Button b2) :
+                            FileDialog::Button /*b1*/,
+                            FileDialog::Button /*b2*/) :
        action_(action)
 {
        fileSelection_.set_title(title);
index e57e388691f36f4a372f74d17bbfeb92f26f660f..050cb788f3413989aeb7ec447d46888685354364 100644 (file)
@@ -62,8 +62,7 @@ void GPainter::setForeground(Glib::RefPtr<Gdk::GC> gc, LColor_color clr)
 void GPainter::setLineParam(Glib::RefPtr<Gdk::GC> gc,
                            line_style ls, line_width lw)
 {
-       int width;
-       Gdk::LineStyle style;
+       int width = 0;
        switch (lw) {
        case Painter::line_thin:
                width = 0;
@@ -73,6 +72,7 @@ void GPainter::setLineParam(Glib::RefPtr<Gdk::GC> gc,
                break;
        }
 
+       Gdk::LineStyle style = Gdk::LINE_SOLID;
        switch (ls) {
        case Painter::line_solid:
                style = Gdk::LINE_SOLID;
index 85559b7ff1305bedd713dc9945a86254f2369338..5799d5077afed89e0cba4278a2e08fdcc7045266 100644 (file)
@@ -208,7 +208,7 @@ void GToolbar::update()
                        ToolbarBackend::Item * item =
                        reinterpret_cast<ToolbarBackend::Item*>(
                                widget->get_data(gToolData));
-                       if (item->first.action == ToolbarBackend::LAYOUTS) {
+                       if (item->first.action == int(ToolbarBackend::LAYOUTS)) {
                                LyXFunc const & lf = view_->getLyXFunc();
                                bool const sensitive =
                                        lf.getStatus(FuncRequest(LFUN_LAYOUT)).enabled();
index 5b6c0ff117c29e64ae8a45439daa027f98bbf957..bbf59eadc5199a148920c04d96c8c17d75089771 100644 (file)
@@ -184,7 +184,7 @@ void QRef::redoRefs()
        
        // restore the last selection for new insets
        if (tmp.isEmpty() && lastref != -1 
-       && lastref < dialog_->refsLB->count())
+           && lastref < int(dialog_->refsLB->count()))
                dialog_->refsLB->setCurrentItem(lastref);
        else    
                for (unsigned int i = 0; i < dialog_->refsLB->count(); ++i) {
index bbf771ce5fd3378984ea8ce27a65e7d32f9fcadc..f4536bd025bb5a44f4961a52f85843cf94f4f982 100644 (file)
@@ -36,7 +36,7 @@ using boost::next;
 ParPosition::ParPosition(par_type p, ParagraphList const & pl)
        : pit(p), plist(&pl)
 {
-       if (p != pl.size())
+       if (p != par_type(pl.size()))
                it.reset(const_cast<InsetList&>(pl[p].insetlist).begin());
 }
 
@@ -117,7 +117,8 @@ ParIterator & ParIterator::operator++()
                }
 
                // Try to go to the next paragarph
-               if (p.pit + 1 != p.plist->size() || positions_.size() == 1) {
+               if (p.pit + 1 != par_type(p.plist->size()) ||
+                   positions_.size() == 1) {
                        ++p.pit;
                        p.index.reset();
                        p.it.reset();
@@ -291,7 +292,8 @@ ParConstIterator & ParConstIterator::operator++()
                }
 
                // Try to go to the next paragarph
-               if (p.pit + 1 != p.plist->size() || positions_.size() == 1) {
+               if (p.pit + 1 != par_type(p.plist->size()) ||
+                   positions_.size() == 1) {
                        ++p.pit;
                        p.index.reset();
                        p.it.reset();
index 7ccd69f88d1254e92a4dc8df18270764d4dfae07..f884901e52eab1cb1ee018bb1e8afffd63d8a5ef 100644 (file)
@@ -341,6 +341,8 @@ InsetBase::idx_type MathScriptInset::idxOfScript(bool up) const
        if (nargs() == 3)
                return up ? 1 : 2;
        BOOST_ASSERT(false);
+       // Silence compiler
+       return 0;
 }
 
 
index a852a49e404fd47f6322a7dc95e773f417b6aa46..a3f23e9d686d583f723afeceac5252ede00b7b54 100644 (file)
@@ -238,7 +238,7 @@ void asciiParagraph(Buffer const & buf,
                default:
                        word += c;
                        if (runparams.linelen > 0 &&
-                               currlinelen + word.length() > runparams.linelen)
+                           currlinelen + word.length() > runparams.linelen)
                        {
                                os << "\n";
                                pair<int, string> p = addDepth(depth, ltype_depth);
index a0aaabddfec319e5237c6b9d7d1dc73f911533b3..d3fa4b2f0acf5c170de140ec1d44018066c9d827 100644 (file)
@@ -12,6 +12,8 @@
 #ifndef OUTPUTPARAMS_H
 #define OUTPUTPARAMS_H
 
+#include "support/types.h"
+
 struct OutputParams {
         enum FLAVOR {
                 LATEX,
@@ -58,7 +60,7 @@ struct OutputParams {
 
        /** Line lenght to use with ascii export.
         */
-       int linelen;
+       lyx::size_type linelen;
 };
 
 #endif // LATEXRUNPARAMS_H
index 24da4d5e9908612819b1cbe08bd5446b651c92c2..05fe823984bf2a73e0fb63d54f7850029d3b6b04 100644 (file)
@@ -250,12 +250,12 @@ int getEndLabel(par_type p, ParagraphList const & pars)
 {
        par_type pit = p;
        Paragraph::depth_type par_depth = pars[p].getDepth();
-       while (pit != pars.size()) {
+       while (pit != par_type(pars.size())) {
                LyXLayout_ptr const & layout = pars[pit].layout();
                int const endlabeltype = layout->endlabeltype;
 
                if (endlabeltype != END_LABEL_NO_LABEL) {
-                       if (p + 1 == pars.size())
+                       if (p + 1 == par_type(pars.size()))
                                return endlabeltype;
 
                        Paragraph::depth_type const next_depth =
@@ -268,7 +268,7 @@ int getEndLabel(par_type p, ParagraphList const & pars)
                if (par_depth == 0)
                        break;
                pit = outerHook(pit, pars);
-               if (pit != pars.size())
+               if (pit != par_type(pars.size()))
                        par_depth = pars[pit].getDepth();
        }
        return END_LABEL_NO_LABEL;
@@ -281,9 +281,11 @@ LyXFont const outerFont(par_type pit, ParagraphList const & pars)
        LyXFont tmpfont(LyXFont::ALL_INHERIT);
 
        // Resolve against environment font information
-       while (pit != pars.size() && par_depth && !tmpfont.resolved()) {
+       while (pit != par_type(pars.size())
+              && par_depth
+              && !tmpfont.resolved()) {
                pit = outerHook(pit, pars);
-               if (pit != pars.size()) {
+               if (pit != par_type(pars.size())) {
                        tmpfont.realize(pars[pit].layout()->font);
                        par_depth = pars[pit].getDepth();
                }
index 1667a3e9dd1162e63dde5d670fd9dda0026e43a6..1ac042d13c1c28be2c754f5df3e90a6f582277c3 100644 (file)
@@ -852,7 +852,7 @@ int paintPars(BufferView const & bv, LyXText const & text,
        y -= bv.top_y();
 
        ParagraphList & pars = text.paragraphs();
-       for ( ; pit != pars.size(); ++pit) {
+       for ( ; pit != par_type(pars.size()); ++pit) {
                RowList::iterator row = pars[pit].rows.begin();
                RowList::iterator rend = pars[pit].rows.end();
 
index e52f14da972225d31a561f56cf356b17908b35fc..c5a35fca69c22c8704fcf13614137d216fab8bce 100644 (file)
@@ -528,12 +528,12 @@ int LyXText::leftMargin(par_type pit, pos_type pos) const
 
                // Make a corresponding row. Need to call leftMargin()
                // to check whether it is a sufficent paragraph.
-               if (newpar != pars_.size()
+               if (newpar != par_type(pars_.size())
                    && pars_[newpar].layout()->isEnvironment()) {
                        x = leftMargin(newpar);
                }
 
-               if (newpar != paragraphs().size()
+               if (newpar != par_type(paragraphs().size())
                    && pars_[pit].layout() == tclass.defaultLayout()) {
                        if (pars_[newpar].params().noindent())
                                parindent.erase();
@@ -1001,7 +1001,7 @@ void LyXText::setHeightOfRow(par_type pit, Row & row)
                }
 
                prev = outerHook(pit, pars_);
-               if (prev != pars_.size()) {
+               if (prev != par_type(pars_.size())) {
                        maxasc += int(pars_[prev].layout()->parsep * dh);
                } else if (pit != 0) {
                        if (pars_[pit - 1].getDepth() != 0 ||
@@ -1017,7 +1017,7 @@ void LyXText::setHeightOfRow(par_type pit, Row & row)
                // a section, or between the items of a itemize or enumerate
                // environment
                par_type nextpit = pit + 1;
-               if (nextpit != pars_.size()) {
+               if (nextpit != par_type(pars_.size())) {
                        par_type cpit = pit;
                        double usual = 0;
                        double unusual = 0;
@@ -1747,7 +1747,7 @@ void LyXText::nextRow(par_type & pit, RowList::iterator & rit) const
        ++rit;
        if (rit == pars_[pit].rows.end()) {
                ++pit;
-               if (pit == paragraphs().size())
+               if (pit == par_type(paragraphs().size()))
                        --pit;
                else
                        rit = pars_[pit].rows.begin();
@@ -1868,7 +1868,8 @@ void LyXText::drawSelection(PainterInfo &, int, int) const
 
 bool LyXText::isLastRow(par_type pit, Row const & row) const
 {
-       return row.endpos() >= pars_[pit].size() && pit + 1 == paragraphs().size();
+       return row.endpos() >= pars_[pit].size()
+               && pit + 1 == par_type(paragraphs().size());
 }
 
 
@@ -2199,7 +2200,7 @@ int LyXText::dist(int x, int y) const
 
        if (x < xo_)
                xx = xo_ - x;
-       else if (x > xo_ + width_)
+       else if (x > xo_ + int(width_))
                xx = x - xo_ - width_;
 
        if (y < yo_ - ascent())
index 226d342687ce6adf6652beafefe4dea2e6fbfc0f..30ac68f63487fdb0bf4ef303ae83f3f5d2ea948c 100644 (file)
@@ -195,10 +195,10 @@ void LyXText::setCharFont(par_type pit, pos_type pos, LyXFont const & fnt)
        if (pars_[pit].getDepth()) {
                par_type tp = pit;
                while (!layoutfont.resolved() &&
-                      tp != paragraphs().size() &&
+                      tp != par_type(paragraphs().size()) &&
                       pars_[tp].getDepth()) {
                        tp = outerHook(tp, paragraphs());
-                       if (tp != paragraphs().size())
+                       if (tp != par_type(paragraphs().size()))
                                layoutfont.realize(pars_[tp].layout()->font);
                }
        }