Author: faridz Date: Tue May 5 14:29:44 2009 New Revision: 771743 URL: http://svn.apache.org/viewvc?rev=771743&view=rev Log: 2009-05-05 Farid Zaripov <far...@apache.org>
STDCXX-1035 * include/string.cc (find): Initialize __first only on the first occurrence of the first element of the sought sequence. Look for the first occurrence of the first element of the sought sequence, starting from the last compared character in controlling sequence. Modified: stdcxx/branches/4.2.x/include/string.cc Modified: stdcxx/branches/4.2.x/include/string.cc URL: http://svn.apache.org/viewvc/stdcxx/branches/4.2.x/include/string.cc?rev=771743&r1=771742&r2=771743&view=diff ============================================================================== --- stdcxx/branches/4.2.x/include/string.cc (original) +++ stdcxx/branches/4.2.x/include/string.cc Tue May 5 14:29:44 2009 @@ -726,15 +726,15 @@ return size_type (__next - _C_data); if (traits_type::eq (*__n, *__s)) { - if (__next != __first && traits_type::eq (*__n, *__seq)) - __first = __n + 1; + if (const_pointer () == __first && __n != __next && traits_type::eq (*__n, *__seq)) + __first = __n; } else { if (const_pointer () == __first) { // look for the first occurrence of the first element // of the sought sequence in the rest of the cotrolling // sequence - __first = traits_type::find (__next + 1, __ext - 1, *__seq); + __first = traits_type::find (__n, __end - __n, *__seq); if (const_pointer () == __first) return npos;