From a6590666823cae2622c743c60a6687e5cf21fb08 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lars=20Gullik=20Bj=C3=B8nnes?= Date: Wed, 27 Sep 2000 17:07:33 +0000 Subject: [PATCH] for fixes to cxx warnings git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@1049 a592a061-630c-0410-9148-cb99ea01b6c8 --- ChangeLog | 7 +++++++ src/LaTeX.h | 3 +++ src/LaTeXFeatures.C | 2 +- src/LaTeXFeatures.h | 4 ++-- src/buffer.C | 19 +++++++++++-------- src/buffer.h | 5 ++++- src/bufferlist.h | 4 +++- src/insets/insettext.C | 8 +++++++- 8 files changed, 38 insertions(+), 14 deletions(-) diff --git a/ChangeLog b/ChangeLog index edb13b66ff..1ac073b302 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2000-09-27 Lars Gullik Bjønnes + + * src/insets/insettext.C (Ascii): return numer of '\n' in the text + outputed to the ostream. + + * several files: fixed types based on warnings from cxx + 2000-09-26 John Levon * src/frontends/kde/Makefile.am: fix rule for diff --git a/src/LaTeX.h b/src/LaTeX.h index e490695442..b57a57e6ab 100644 --- a/src/LaTeX.h +++ b/src/LaTeX.h @@ -111,6 +111,9 @@ public: path = name of the files original path. */ LaTeX(string const & cmd, string const & file, string const & path); + + /// + virtual ~LaTeX() {} /// runs LaTeX several times int run(TeXErrors &, MiniBuffer *); diff --git a/src/LaTeXFeatures.C b/src/LaTeXFeatures.C index 204e9a66d9..6e1fec3c98 100644 --- a/src/LaTeXFeatures.C +++ b/src/LaTeXFeatures.C @@ -25,7 +25,7 @@ using std::endl; -LaTeXFeatures::LaTeXFeatures(BufferParams const & p, int n) +LaTeXFeatures::LaTeXFeatures(BufferParams const & p, LyXTextClass::size_type n) : layout(n, false), params(p) { // packages diff --git a/src/LaTeXFeatures.h b/src/LaTeXFeatures.h index 5e6ff72c56..91165ad7f0 100644 --- a/src/LaTeXFeatures.h +++ b/src/LaTeXFeatures.h @@ -21,9 +21,9 @@ #include #include "LString.h" +#include "layout.h" class BufferParams; -class LyXTextClass; struct Language; /** The packages and commands that a buffer needs. This struct @@ -34,7 +34,7 @@ struct Language; */ struct LaTeXFeatures { /// - LaTeXFeatures(BufferParams const &, int n) ; + LaTeXFeatures(BufferParams const &, LyXTextClass::size_type n) ; /// The packaes needed by the document string const getPackages(); /// The macros definitions needed by the document diff --git a/src/buffer.C b/src/buffer.C index 67d59801bc..845b038737 100644 --- a/src/buffer.C +++ b/src/buffer.C @@ -1461,18 +1461,21 @@ void Buffer::writeFileAscii(string const & fname, int linelen) //---------------------------------------------------------------------------- #else //---------------------------------------------------------------------------- -string const Buffer::asciiParagraph(LyXParagraph const * par, int linelen) const +string const Buffer::asciiParagraph(LyXParagraph const * par, + unsigned int linelen) const { ostringstream buffer; LyXFont font1, font2; Inset const * inset; - char c, footnoteflag = 0, depth = 0; + char c; + LyXParagraph::footnote_flag footnoteflag = LyXParagraph::NO_FOOTNOTE; + char depth = 0; string tmp; LyXParagraph::size_type i; - int j; + unsigned int j; int ltype = 0; int ltype_depth = 0; - int currlinelen = 0; + unsigned int currlinelen = 0; bool ref_printed = false; int noparbreak = 0; @@ -2691,8 +2694,8 @@ void Buffer::pop_tag(ostream & os, string const & tag, // checks, if newcol chars should be put into this line // writes newline, if necessary. static -void linux_doc_line_break(ostream & os, unsigned int & colcount, - const unsigned int newcol) +void linux_doc_line_break(ostream & os, string::size_type & colcount, + string::size_type newcol) { colcount += newcol; if (colcount > lyxrc.ascii_linelen) { @@ -2703,7 +2706,7 @@ void linux_doc_line_break(ostream & os, unsigned int & colcount, void Buffer::SimpleLinuxDocOnePar(ostream & os, LyXParagraph * par, - int desc_on, int const /*depth*/) + int desc_on, int /*depth*/) { LyXFont font1; char c; @@ -2721,7 +2724,7 @@ void Buffer::SimpleLinuxDocOnePar(ostream & os, LyXParagraph * par, int stack_num = -1; // style stack position // Can this be rewritten to use a std::stack, please. (Lgb) char stack[5][3]; // style stack - unsigned int char_line_count = 5; // Heuristic choice ;-) + string::size_type char_line_count = 5; // Heuristic choice ;-) if (style.labeltype != LABEL_MANUAL) main_body = 0; diff --git a/src/buffer.h b/src/buffer.h index 53df1feade..ad3249b579 100644 --- a/src/buffer.h +++ b/src/buffer.h @@ -150,8 +150,11 @@ public: /// void writeFileAscii(string const & , int); + /// void writeFileAscii(std::ostream &, int); - string const asciiParagraph(LyXParagraph const *, int linelen) const; + /// + string const asciiParagraph(LyXParagraph const *, + unsigned int linelen) const; /// void makeLaTeXFile(string const & filename, string const & original_path, diff --git a/src/bufferlist.h b/src/bufferlist.h index 57c59faffb..7a89a8a87e 100644 --- a/src/bufferlist.h +++ b/src/bufferlist.h @@ -39,6 +39,8 @@ public: /// typedef Container::const_iterator const_iterator; /// + typedef Container::size_type size_type; + /// bool empty() const { return container.empty(); } /// void release(Buffer * buf); @@ -57,7 +59,7 @@ public: /// Buffer * operator[](int c) { return container[c]; } /// - int size() const { return container.size(); } + size_type size() const { return container.size(); } private: /// Container container; diff --git a/src/insets/insettext.C b/src/insets/insettext.C index a22efa5466..ec9e2ed665 100644 --- a/src/insets/insettext.C +++ b/src/insets/insettext.C @@ -1026,11 +1026,17 @@ int InsetText::Latex(Buffer const * buf, ostream & os, bool, bool) const int InsetText::Ascii(Buffer const * buf, ostream & os, int linelen) const { LyXParagraph * p = par; + unsigned int lines = 0; + while (p) { - os << buf->asciiParagraph(p, linelen); + string const tmp = buf->asciiParagraph(p, linelen); + lines += countChar(tmp, '\n'); + os << tmp; p = p->next; } os << "\n"; + ++lines; + return lines; }