stdcxx-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From far...@apache.org
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 GMT
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  <faridz@apache.org>

	Merged revs 771735, 771736, 771743 from 4.2.x branch.

	2009-05-05  Farid Zaripov  <faridz@apache.org>
	* tests/regress/21.string.find.stdcxx-1035.cpp: New regression
	test for STDCXX-1035.

	2009-05-05  Farid Zaripov  <faridz@apache.org>
	* tests/strings/21.string.find.cpp: Added new testcases
	to verify bug, described in STDCXX-1035 issue.

	2009-05-05  Farid Zaripov  <faridz@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.

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),



Mime
View raw message