basic_string.tcc (find(const _CharT*, size_type, size_type)): Robustify.
2006-09-05 Paolo Carlini <pcarlini@suse.de> * include/bits/basic_string.tcc (find(const _CharT*, size_type, size_type)): Robustify. * include/ext/vstring.tcc (find(const _CharT*, size_type, size_type)): Likewise. From-SVN: r116700
This commit is contained in:
parent
9a7fd67a82
commit
5527be59f4
@ -1,3 +1,10 @@
|
||||
2006-09-05 Paolo Carlini <pcarlini@suse.de>
|
||||
|
||||
* include/bits/basic_string.tcc (find(const _CharT*, size_type,
|
||||
size_type)): Robustify.
|
||||
* include/ext/vstring.tcc (find(const _CharT*, size_type,
|
||||
size_type)): Likewise.
|
||||
|
||||
2006-09-05 Paolo Carlini <pcarlini@suse.de>
|
||||
|
||||
* include/bits/basic_string.tcc (find(const _CharT*, size_type,
|
||||
|
@ -716,10 +716,14 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
|
||||
if (__n == 0)
|
||||
return __pos <= __size ? __pos : npos;
|
||||
|
||||
for (; __pos + __n <= __size; ++__pos)
|
||||
if (traits_type::eq(__data[__pos], __s[0])
|
||||
&& traits_type::compare(__data + __pos + 1, __s + 1, __n - 1) == 0)
|
||||
return __pos;
|
||||
if (__n <= __size)
|
||||
{
|
||||
for (; __pos + __n <= __size; ++__pos)
|
||||
if (traits_type::eq(__data[__pos], __s[0])
|
||||
&& traits_type::compare(__data + __pos + 1,
|
||||
__s + 1, __n - 1) == 0)
|
||||
return __pos;
|
||||
}
|
||||
return npos;
|
||||
}
|
||||
|
||||
|
@ -277,10 +277,14 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
|
||||
if (__n == 0)
|
||||
return __pos <= __size ? __pos : npos;
|
||||
|
||||
for (; __pos + __n <= __size; ++__pos)
|
||||
if (traits_type::eq(__data[__pos], __s[0])
|
||||
&& traits_type::compare(__data + __pos + 1, __s + 1, __n - 1) == 0)
|
||||
return __pos;
|
||||
if (__n <= __size)
|
||||
{
|
||||
for (; __pos + __n <= __size; ++__pos)
|
||||
if (traits_type::eq(__data[__pos], __s[0])
|
||||
&& traits_type::compare(__data + __pos + 1,
|
||||
__s + 1, __n - 1) == 0)
|
||||
return __pos;
|
||||
}
|
||||
return npos;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user