]> git.lyx.org Git - features.git/commitdiff
Another fix for lyxstring::rfind
authorJean-Marc Lasgouttes <lasgouttes@lyx.org>
Wed, 10 Jan 2001 14:09:56 +0000 (14:09 +0000)
committerJean-Marc Lasgouttes <lasgouttes@lyx.org>
Wed, 10 Jan 2001 14:09:56 +0000 (14:09 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@1311 a592a061-630c-0410-9148-cb99ea01b6c8

ChangeLog
src/support/lyxstring.C
src/tabular.h

index 062a642304b24931dec80da34559a6f0f828ad36..b58c0e3e478d8492d82c412bbc3c15d834da8fd8 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2001-01-10  Jean-Marc Lasgouttes  <Jean-Marc.Lasgouttes@inria.fr>
+
+       * src/support/lyxstring.C (rfind): better fix (from Dekel).
+
+       * src/tabular.h: add a couple std:: qualifiers.
+
 2001-01-10  Lars Gullik Bjønnes  <larsbj@lyx.org>
 
        * src/support/lyxstring.C (rfind): also test the first char in the
index 967fd88650a197dae34d547d24f6fb872ec012ec..515e90533b9b18905d9f69ec9a82b8599f8cf15b 100644 (file)
@@ -23,6 +23,8 @@
 
 #include "LAssert.h"
 
+#include "debug.h"
+
 using std::min;
 using std::istream;
 using std::ostream;
@@ -1027,11 +1029,13 @@ lyxstring::size_type lyxstring::rfind(value_type c, size_type i) const
 {
        TestlyxstringInvariant(this);
 
-       size_type ii = min(rep->sz - 1, i);
-        for (size_type t = ii; t >= 0; --t) {
-               if (rep->s[t] == c) return t;
-       }
-        return npos;
+       size_type const sz = rep->sz;
+       if (sz < 1) return npos;
+       size_type ii = min(sz - 1, i);
+       do {
+               if (rep->s[ii] == c) return ii;
+       } while (ii-- > 0);
+       return npos;
 }
 
 
index 7b51a08e2a3edcb243392bb4ebc65ed77b857343..c68ec96f310a1bbc36f25aeee9b87f0006fa83eb 100644 (file)
@@ -455,10 +455,10 @@ private: //////////////////////////////////////////////////////////////////
     typedef std::vector<columnstruct> column_vector;
 
     ///
-    void ReadNew(Buffer const * buf, istream & is,
+    void ReadNew(Buffer const * buf, std::istream & is,
             LyXLex & lex, string const & l);
     ///
-    void ReadOld(Buffer const * buf, istream & is,
+    void ReadOld(Buffer const * buf, std::istream & is,
             LyXLex & lex, string const & l);
     ///
     int rows_;