From: Angus Leeming Date: Fri, 11 Jan 2002 17:57:02 +0000 (+0000) Subject: Fixes for a broken std::count. X-Git-Tag: 1.6.10~20049 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=44806c63f9ea0186df4bf989e5c99260f41d7d31;p=features.git Fixes for a broken std::count. A couple of white-space type changes in mathed. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@3341 a592a061-630c-0410-9148-cb99ea01b6c8 --- diff --git a/src/BufferView2.C b/src/BufferView2.C index 7bdda14a64..0eb2b4611c 100644 --- a/src/BufferView2.C +++ b/src/BufferView2.C @@ -590,7 +590,10 @@ bool BufferView::ChangeRefsIfUnique(string const & from, string const & to) { // Check if the label 'from' appears more than once vector labels = buffer()->getLabelList(); - if (count(labels.begin(), labels.end(), from) > 1) + // count is broken on some systems, so use the HP version + int res; + count(labels.begin(), labels.end(), from, res); + if (res > 1) return false; return ChangeInsets(Inset::REF_CODE, from, to); diff --git a/src/ChangeLog b/src/ChangeLog index 54c59f98f5..64d60bb3ef 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2002-01-11 Angus Leeming + + * BufferView2.C (ChangeRefsIfUnique): use the HP version of std::count + as the other one is broken on my machine! + 2002-01-10 Martin Vermeer * commandtags.h: diff --git a/src/mathed/ChangeLog b/src/mathed/ChangeLog index bd7ca57973..10b8e7ae89 100644 --- a/src/mathed/ChangeLog +++ b/src/mathed/ChangeLog @@ -1,3 +1,14 @@ +2002-01-11 Angus Leeming + + * math_exfuncinset.C: remove using std::ostream declaration. + + * math_kerninset.C: whitespace change, consistent with other files. + + * math_mathmlstream.C (operator<<): + * math_streamstr.C (operator<<): use countChar rather than std::count. + + * math_parser.C (operator==): comment out. Not used. + 2002-01-10 Martin Vermeer * formulabase.C (localDispatch): handle LFUN_FRAK and LFUN_ITAL. diff --git a/src/mathed/math_exfuncinset.C b/src/mathed/math_exfuncinset.C index c258e2b0b3..10175f52c9 100644 --- a/src/mathed/math_exfuncinset.C +++ b/src/mathed/math_exfuncinset.C @@ -5,8 +5,6 @@ #include "math_mathmlstream.h" #include "math_streamstr.h" -using std::ostream; - MathExFuncInset::MathExFuncInset(string const & name) : MathNestInset(1), name_(name) diff --git a/src/mathed/math_kerninset.C b/src/mathed/math_kerninset.C index 5fe1d030a6..ae853e35b7 100644 --- a/src/mathed/math_kerninset.C +++ b/src/mathed/math_kerninset.C @@ -10,6 +10,7 @@ #include "math_support.h" #include "lyxrc.h" + MathKernInset::MathKernInset() {} diff --git a/src/mathed/math_mathmlstream.C b/src/mathed/math_mathmlstream.C index 8aed771f0b..ba77e72284 100644 --- a/src/mathed/math_mathmlstream.C +++ b/src/mathed/math_mathmlstream.C @@ -4,6 +4,7 @@ #include "math_inset.h" #include "math_extern.h" #include "debug.h" +#include "support/lstrings.h" #include @@ -221,7 +222,7 @@ WriteStream & operator<<(WriteStream & ws, MathArray const & ar) WriteStream & operator<<(WriteStream & ws, char const * s) { ws.os() << s; - ws.addlines(std::count(s, s + strlen(s), '\n')); + ws.addlines(int(countChar(s, '\n'))); return ws; } diff --git a/src/mathed/math_parser.C b/src/mathed/math_parser.C index 98940b4537..5c7b4b4a83 100644 --- a/src/mathed/math_parser.C +++ b/src/mathed/math_parser.C @@ -213,13 +213,13 @@ string Token::asString() const return cs_.size() ? cs_ : string(1, char_); } -bool operator==(Token const & s, Token const & t) -{ - return s.character() == t.character() - && s.cat() == t.cat() && s.cs() == t.cs(); -} - -// Angus' compiler says this is not needed +// Angus' compiler says these are not needed +//bool operator==(Token const & s, Token const & t) +//{ +// return s.character() == t.character() +// && s.cat() == t.cat() && s.cs() == t.cs(); +//} +// //bool operator!=(Token const & s, Token const & t) //{ // return !(s == t); diff --git a/src/mathed/math_streamstr.C b/src/mathed/math_streamstr.C index 6e47e2b572..fd14d8fc6b 100644 --- a/src/mathed/math_streamstr.C +++ b/src/mathed/math_streamstr.C @@ -3,6 +3,7 @@ #include "math_streamstr.h" #include "math_mathmlstream.h" #include "support/LOstream.h" +#include "support/lstrings.h" #include @@ -10,7 +11,7 @@ WriteStream & operator<<(WriteStream & ws, string const & s) { ws.os() << s; - ws.addlines(std::count(s.begin(), s.end(), '\n')); + ws.addlines(int(countChar(s, '\n'))); return ws; }