On Wed, Jan 10, 2001 at 11:54:36AM +0100, Lars Gullik Bj&resh;nnes wrote:
> Then I end up with something like:
> 
>       size_type const sz = rep->sz;
>       if (!sz) return npos;
>       
>       size_type ii = min(sz - 1, i);
>         for (int t = ii; t <= 0; --t) {
                           ^^^ this should be t >= 0

>               if (rep->s[t] == c) return t;
>       }
>         return npos;
> 
> Can you test it.

This works, but I would write

  if (rep->sz < 1) return npos;
  size_type ii = min(rep->sz - 1, i);
  do {
      if (rep->s[ii] == c) return ii;
  } while (ii-- > 0);
  return npos;

And for lyxstring::rfind(lyxstring const & a, size_type) I would write
  if (rep->sz < a.length()) return npos;
  ...

Actually, it appears that lyxstring::rfind(lyxstring const & a, size_type)
is completely broken...

Reply via email to