From 120e59bc97aa77082c8cccbda62c2f4f2cae9be7 Mon Sep 17 00:00:00 2001 From: Angus Leeming Date: Wed, 24 Mar 2004 17:06:17 +0000 Subject: [PATCH] 64 bit compile fixes. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@8525 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/ChangeLog | 14 ++++++++++++++ src/errorlist.C | 9 +++++---- src/errorlist.h | 8 +++++--- src/frontends/controllers/ChangeLog | 10 ++++++++++ src/frontends/controllers/ControlErrorList.C | 6 +++--- src/frontends/controllers/ControlSpellchecker.C | 3 ++- src/paragraph.C | 2 +- src/paragraph.h | 4 ++-- src/text.C | 5 +++-- 9 files changed, 45 insertions(+), 16 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index c480db6f73..e87981e5cf 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,17 @@ +2004-03-24 Angus Leeming + + 64-bit compile fixes. + + * errorlist.[Ch] (pos_start, pos_end): store as lyx::pos_type. + (c-tor): pass lyx::pos_types rather than ints. + + * paragraph.[Ch] (beginOfBody, begin_of_body_): return, store as + lyx::pos_type. + + * text.C (Delete): compile fix. + (getPar): ensure that function declaration is the same as that in + the header file. + 2004-03-23 Angus Leeming * ispell.C (LaunchIspell): diff --git a/src/errorlist.C b/src/errorlist.C index 3052ba49f8..d829f04c4f 100644 --- a/src/errorlist.C +++ b/src/errorlist.C @@ -12,13 +12,14 @@ #include "errorlist.h" +using lyx::pos_type; using std::string; -ErrorItem::ErrorItem(string const & error, string const & description, - int par_id, int pos_start, int pos_end) - : error(error), description(description), par_id(par_id), - pos_start(pos_start), pos_end(pos_end) +ErrorItem::ErrorItem(string const & error_, string const & description_, + int par_id_, pos_type pos_start_, pos_type pos_end_) + : error(error_), description(description_), par_id(par_id_), + pos_start(pos_start_), pos_end(pos_end_) {} diff --git a/src/errorlist.h b/src/errorlist.h index 20b386c841..52e79a5ee2 100644 --- a/src/errorlist.h +++ b/src/errorlist.h @@ -12,6 +12,8 @@ #ifndef ERRORLIST_H #define ERRORLIST_H +#include "support/types.h" + #include #include @@ -22,10 +24,10 @@ struct ErrorItem { std::string error; std::string description; int par_id; - int pos_start; - int pos_end; + lyx::pos_type pos_start; + lyx::pos_type pos_end; ErrorItem(std::string const & error, std::string const & description, - int parid, int posstart, int posend); + int parid, lyx::pos_type posstart, lyx::pos_type posend); ErrorItem(); }; diff --git a/src/frontends/controllers/ChangeLog b/src/frontends/controllers/ChangeLog index 61c503d1ad..965b47df86 100644 --- a/src/frontends/controllers/ChangeLog +++ b/src/frontends/controllers/ChangeLog @@ -1,3 +1,13 @@ +2004-03-24 Angus Leeming + + 64-bit compile fixes. + + * ControlErrorList.C (goTo): use lyx::pos_type as type of + temporary vars. + + * ControlSpellchecker.C (nextWord): pass progress as a + PosIterator::difference_type, not an int. + 2004-03-17 Angus Leeming * ControlForks.[Ch]: removed. diff --git a/src/frontends/controllers/ControlErrorList.C b/src/frontends/controllers/ControlErrorList.C index 6211826620..b31ba80eb5 100644 --- a/src/frontends/controllers/ControlErrorList.C +++ b/src/frontends/controllers/ControlErrorList.C @@ -68,9 +68,9 @@ void ControlErrorList::goTo(int item) return; } - int const end = std::min(err.pos_end, pit->size()); - int const start = std::min(err.pos_start, end); - int const range = end - start; + lyx::pos_type const end = std::min(err.pos_end, pit->size()); + lyx::pos_type const start = std::min(err.pos_start, end); + lyx::pos_type const range = end - start; // Now make the selection. PosIterator const pos(pit, start); diff --git a/src/frontends/controllers/ControlSpellchecker.C b/src/frontends/controllers/ControlSpellchecker.C index 4955ab8677..46beabd4ab 100644 --- a/src/frontends/controllers/ControlSpellchecker.C +++ b/src/frontends/controllers/ControlSpellchecker.C @@ -160,7 +160,8 @@ bool isLetter(PosIterator & cur) WordLangTuple nextWord(PosIterator & cur, PosIterator const & end, - int & progress, BufferParams & bp) + PosIterator::difference_type & progress, + BufferParams & bp) { // skip until we have real text (will jump paragraphs) for (; cur != end && !isLetter(cur); ++cur, ++progress); diff --git a/src/paragraph.C b/src/paragraph.C index bbefcb9254..365600571c 100644 --- a/src/paragraph.C +++ b/src/paragraph.C @@ -645,7 +645,7 @@ void Paragraph::applyLayout(LyXLayout_ptr const & new_layout) } -int Paragraph::beginOfBody() const +pos_type Paragraph::beginOfBody() const { return begin_of_body_; } diff --git a/src/paragraph.h b/src/paragraph.h index 08e897bba7..5eb1e37d99 100644 --- a/src/paragraph.h +++ b/src/paragraph.h @@ -202,7 +202,7 @@ public: /// the paragraph alongside the text of the rest of the paragraph /// (the body). This function returns the starting position of the /// body of the text in the paragraph. - int beginOfBody() const; + lyx::pos_type beginOfBody() const; /// recompute this value void setBeginOfBody(); @@ -353,7 +353,7 @@ private: // for average tasks as buffer loading/switching etc. TextContainer text_; /// end of label - int begin_of_body_; + lyx::pos_type begin_of_body_; struct Pimpl; /// diff --git a/src/text.C b/src/text.C index 85cf1332d9..38e5ae671f 100644 --- a/src/text.C +++ b/src/text.C @@ -1341,7 +1341,8 @@ void LyXText::Delete(LCursor & cur) CursorSlice sl = cur.top(); cursorRight(cur); if (sl == cur.top()) { - recordUndo(cur, Undo::DELETE, cur.par(), max(0, cur.par() - 1)); + recordUndo(cur, Undo::DELETE, cur.par(), + max(par_type(0), cur.par() - 1)); backspace(cur); } } @@ -1442,7 +1443,7 @@ ParagraphList::iterator LyXText::getPar(CursorSlice const & cur) const } -ParagraphList::iterator LyXText::getPar(int par) const +ParagraphList::iterator LyXText::getPar(par_type par) const { //lyxerr << "getPar: " << par << " from " << paragraphs().size() << endl; BOOST_ASSERT(par >= 0); -- 2.39.2