From commits-return-3585-apmail-stdcxx-commits-archive=stdcxx.apache.org@stdcxx.apache.org Thu May 07 09:43:10 2009 Return-Path: Delivered-To: apmail-stdcxx-commits-archive@www.apache.org Received: (qmail 14949 invoked from network); 7 May 2009 09:43:10 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 7 May 2009 09:43:10 -0000 Received: (qmail 54944 invoked by uid 500); 7 May 2009 09:43:10 -0000 Delivered-To: apmail-stdcxx-commits-archive@stdcxx.apache.org Received: (qmail 54922 invoked by uid 500); 7 May 2009 09:43:10 -0000 Mailing-List: contact commits-help@stdcxx.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@stdcxx.apache.org Delivered-To: mailing list commits@stdcxx.apache.org Received: (qmail 54913 invoked by uid 99); 7 May 2009 09:43:10 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 07 May 2009 09:43:10 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 07 May 2009 09:43:00 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 7F9BE23889BB; Thu, 7 May 2009 09:42:39 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r772571 - in /stdcxx/branches/4.3.x: include/string.cc tests/regress/21.string.find.stdcxx-1035.cpp tests/strings/21.string.find.cpp Date: Thu, 07 May 2009 09:42:39 -0000 To: commits@stdcxx.apache.org From: faridz@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20090507094239.7F9BE23889BB@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: faridz Date: Thu May 7 09:42:39 2009 New Revision: 772571 URL: http://svn.apache.org/viewvc?rev=772571&view=rev Log: 2009-05-07 Farid Zaripov Merged revs 771735, 771736, 771743 from 4.2.x branch. 2009-05-05 Farid Zaripov * tests/regress/21.string.find.stdcxx-1035.cpp: New regression test for STDCXX-1035. 2009-05-05 Farid Zaripov * tests/strings/21.string.find.cpp: Added new testcases to verify bug, described in STDCXX-1035 issue. 2009-05-05 Farid Zaripov 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. Added: stdcxx/branches/4.3.x/tests/regress/21.string.find.stdcxx-1035.cpp - copied unchanged from r771735, stdcxx/branches/4.2.x/tests/regress/21.string.find.stdcxx-1035.cpp Modified: stdcxx/branches/4.3.x/include/string.cc stdcxx/branches/4.3.x/tests/strings/21.string.find.cpp Modified: stdcxx/branches/4.3.x/include/string.cc URL: http://svn.apache.org/viewvc/stdcxx/branches/4.3.x/include/string.cc?rev=772571&r1=772570&r2=772571&view=diff ============================================================================== --- stdcxx/branches/4.3.x/include/string.cc (original) +++ stdcxx/branches/4.3.x/include/string.cc Thu May 7 09:42:39 2009 @@ -722,15 +722,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; Modified: stdcxx/branches/4.3.x/tests/strings/21.string.find.cpp URL: http://svn.apache.org/viewvc/stdcxx/branches/4.3.x/tests/strings/21.string.find.cpp?rev=772571&r1=772570&r2=772571&view=diff ============================================================================== --- stdcxx/branches/4.3.x/tests/strings/21.string.find.cpp (original) +++ stdcxx/branches/4.3.x/tests/strings/21.string.find.cpp Thu May 7 09:42:39 2009 @@ -91,6 +91,7 @@ TEST ("edfcbahjig", "cba", 3), TEST ("edfcbahcba", "cba", 3), TEST ("cbacbahjig", "cba", 0), + TEST ("abcbcbd", "bcbd", 3), TEST ("e\0cb\0\0g", "b\0\0g", 3), TEST ("e\0cb\0\0g", "ecb", NPOS), @@ -173,6 +174,7 @@ TEST ("edfcbahjig", "cba", 3), TEST ("edfcbahcba", "cba", 3), TEST ("cbacbahjig", "cba", 0), + TEST ("abcbcbd", "bcbd", 3), TEST ("e\0cb\0\0g", "b\0\0g", 3), TEST ("e\0cb\0\0g", "ecb", NPOS), @@ -262,6 +264,7 @@ TEST ("edfcbahcba", "cba", 1, 3), TEST ("edfcbahcba", "cba", 5, 7), TEST ("cbacbahjig", "cba", 5, NPOS), + TEST ("abcbcbd", "bcbd", 0, 3), TEST ("e\0cb\0\0g", "b\0\0g", 0, 3), TEST ("e\0cb\0\0g", "b\0\0g", 4, NPOS), @@ -367,6 +370,7 @@ TEST ("edfcbahcba", "cba", 5, 3, 7), TEST ("cbacbahjig", "cba", 5, 3, NPOS), TEST ("cbacbahjcg", "cba", 5, 1, 8), + TEST ("abcbcbd", "bcbd", 0, 4, 3), TEST ("e\0cb\0\0g", "b\0\0g", 0, 4, 3), TEST ("e\0cb\0\0g", "b\0\0g", 4, 4, NPOS), @@ -484,6 +488,7 @@ TEST ("edfcbahcba", "cba", 1, 3), TEST ("edfcbahcba", "cba", 5, 7), TEST ("cbacbahjig", "cba", 5, NPOS), + TEST ("abcbcbd", "bcbd", 0, 3), TEST ("e\0cb\0\0g", "b\0\0g", 0, 3), TEST ("e\0cb\0\0g", "b\0\0g", 4, NPOS),