Squash a bunch of compiler warnings.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@8538 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Angus Leeming 2004-03-27 01:18:51 +00:00
parent e26fc29a3c
commit b11b6f78b1
17 changed files with 68 additions and 37 deletions

View 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());

View 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):

View 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()) {

View 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;

View 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);

View 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);

View 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;

View 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();

View 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) {

View 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();

View 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;
}

View 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);

View 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

View 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();
}

View 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();

View 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())

View 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);
}
}