summaryrefslogtreecommitdiff
path: root/libstdc++/std
diff options
context:
space:
mode:
authorjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>1998-07-12 02:20:51 +0000
committerjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>1998-07-12 02:20:51 +0000
commite6341d674cfd2de6fc7ee45feca0d840f6279f33 (patch)
tree74183aaf8ba44536d7fb14d2c91355177c06cb0e /libstdc++/std
parentd9dd3b949a3653402d46035685c7fa1c9a0f66eb (diff)
downloadgcc-e6341d674cfd2de6fc7ee45feca0d840f6279f33.tar.gz
* Makefile.in (VERSION): Bump to 2.9.0.
* std/bastring.cc (find_last_of): Fix. (find_last_not_of): Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@21072 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libstdc++/std')
-rw-r--r--libstdc++/std/bastring.cc12
1 files changed, 9 insertions, 3 deletions
diff --git a/libstdc++/std/bastring.cc b/libstdc++/std/bastring.cc
index fca6f29680b..b5f7a0dbfef 100644
--- a/libstdc++/std/bastring.cc
+++ b/libstdc++/std/bastring.cc
@@ -325,10 +325,12 @@ basic_string <charT, traits, Allocator>::size_type
basic_string <charT, traits, Allocator>::
find_last_of (const charT* s, size_type pos, size_type n) const
{
+ if (length() == 0)
+ return npos;
size_t xpos = length () - 1;
if (xpos > pos)
xpos = pos;
- for (; xpos; --xpos)
+ for (++xpos; xpos-- > 0;)
if (_find (s, data () [xpos], 0, n) != npos)
return xpos;
return npos;
@@ -363,10 +365,12 @@ basic_string <charT, traits, Allocator>::size_type
basic_string <charT, traits, Allocator>::
find_last_not_of (const charT* s, size_type pos, size_type n) const
{
+ if (length() == 0)
+ return npos;
size_t xpos = length () - 1;
if (xpos > pos)
xpos = pos;
- for (; xpos; --xpos)
+ for (++xpos; xpos-- > 0;)
if (_find (s, data () [xpos], 0, n) == npos)
return xpos;
return npos;
@@ -377,10 +381,12 @@ basic_string <charT, traits, Allocator>::size_type
basic_string <charT, traits, Allocator>::
find_last_not_of (charT c, size_type pos) const
{
+ if (length() == 0)
+ return npos;
size_t xpos = length () - 1;
if (xpos > pos)
xpos = pos;
- for (; xpos; --xpos)
+ for (++xpos; xpos-- > 0;)
if (traits::ne (data () [xpos], c))
return xpos;
return npos;