From: Angus Leeming Date: Sat, 27 Mar 2004 01:18:51 +0000 (+0000) Subject: Squash a bunch of compiler warnings. X-Git-Tag: 1.6.10~15425 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=b11b6f78b1153198dd8dba2bc7da4c56bfa20dab;p=features.git Squash a bunch of compiler warnings. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@8538 a592a061-630c-0410-9148-cb99ea01b6c8 --- diff --git a/src/BufferView_pimpl.C b/src/BufferView_pimpl.C index cd1ae3f597..76b745b48c 100644 --- a/src/BufferView_pimpl.C +++ b/src/BufferView_pimpl.C @@ -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()); diff --git a/src/ChangeLog b/src/ChangeLog index 3eaee3c708..b3ed0d7a83 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,22 @@ +2004-03-26 Angus Leeming + + * 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 * ispell.C (LaunchIspell::start): diff --git a/src/CutAndPaste.C b/src/CutAndPaste.C index de02331c41..d94dc4de6e 100644 --- a/src/CutAndPaste.C +++ b/src/CutAndPaste.C @@ -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()) { diff --git a/src/buffer.C b/src/buffer.C index e3c5ceadc6..904d63cc4a 100644 --- a/src/buffer.C +++ b/src/buffer.C @@ -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; diff --git a/src/frontends/controllers/ControlErrorList.C b/src/frontends/controllers/ControlErrorList.C index 44fcb2e2b6..005378f481 100644 --- a/src/frontends/controllers/ControlErrorList.C +++ b/src/frontends/controllers/ControlErrorList.C @@ -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); diff --git a/src/frontends/gtk/FileDialogPrivate.C b/src/frontends/gtk/FileDialogPrivate.C index 085576461e..a1b3cc2d7e 100644 --- a/src/frontends/gtk/FileDialogPrivate.C +++ b/src/frontends/gtk/FileDialogPrivate.C @@ -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); diff --git a/src/frontends/gtk/GPainter.C b/src/frontends/gtk/GPainter.C index e57e388691..050cb788f3 100644 --- a/src/frontends/gtk/GPainter.C +++ b/src/frontends/gtk/GPainter.C @@ -62,8 +62,7 @@ void GPainter::setForeground(Glib::RefPtr gc, LColor_color clr) void GPainter::setLineParam(Glib::RefPtr 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 gc, break; } + Gdk::LineStyle style = Gdk::LINE_SOLID; switch (ls) { case Painter::line_solid: style = Gdk::LINE_SOLID; diff --git a/src/frontends/gtk/GToolbar.C b/src/frontends/gtk/GToolbar.C index 85559b7ff1..5799d5077a 100644 --- a/src/frontends/gtk/GToolbar.C +++ b/src/frontends/gtk/GToolbar.C @@ -208,7 +208,7 @@ void GToolbar::update() ToolbarBackend::Item * item = reinterpret_cast( 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(); diff --git a/src/frontends/qt2/QRef.C b/src/frontends/qt2/QRef.C index 5b6c0ff117..bbf59eadc5 100644 --- a/src/frontends/qt2/QRef.C +++ b/src/frontends/qt2/QRef.C @@ -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) { diff --git a/src/iterators.C b/src/iterators.C index bbf771ce5f..f4536bd025 100644 --- a/src/iterators.C +++ b/src/iterators.C @@ -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(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(); diff --git a/src/mathed/math_scriptinset.C b/src/mathed/math_scriptinset.C index 7ccd69f88d..f884901e52 100644 --- a/src/mathed/math_scriptinset.C +++ b/src/mathed/math_scriptinset.C @@ -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; } diff --git a/src/output_plaintext.C b/src/output_plaintext.C index a852a49e40..a3f23e9d68 100644 --- a/src/output_plaintext.C +++ b/src/output_plaintext.C @@ -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 p = addDepth(depth, ltype_depth); diff --git a/src/outputparams.h b/src/outputparams.h index a0aaabddfe..d3fa4b2f0a 100644 --- a/src/outputparams.h +++ b/src/outputparams.h @@ -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 diff --git a/src/paragraph_funcs.C b/src/paragraph_funcs.C index 24da4d5e99..05fe823984 100644 --- a/src/paragraph_funcs.C +++ b/src/paragraph_funcs.C @@ -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(); } diff --git a/src/rowpainter.C b/src/rowpainter.C index 1667a3e9dd..1ac042d13c 100644 --- a/src/rowpainter.C +++ b/src/rowpainter.C @@ -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(); diff --git a/src/text.C b/src/text.C index e52f14da97..c5a35fca69 100644 --- a/src/text.C +++ b/src/text.C @@ -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()) diff --git a/src/text2.C b/src/text2.C index 226d342687..30ac68f634 100644 --- a/src/text2.C +++ b/src/text2.C @@ -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); } }