|
From: <jfb...@us...> - 2009-03-03 16:29:15
|
Revision: 993
http://loki-lib.svn.sourceforge.net/loki-lib/?rev=993&view=rev
Author: jfbastien
Date: 2009-03-03 16:29:14 +0000 (Tue, 03 Mar 2009)
Log Message:
-----------
Bug 2657248: take two, this time fix it properly!
Modified Paths:
--------------
trunk/include/loki/flex/flex_string_shell.h
Modified: trunk/include/loki/flex/flex_string_shell.h
===================================================================
--- trunk/include/loki/flex/flex_string_shell.h 2009-03-03 13:32:21 UTC (rev 992)
+++ trunk/include/loki/flex/flex_string_shell.h 2009-03-03 16:29:14 UTC (rev 993)
@@ -807,25 +807,24 @@
const typename std::iterator_traits<FwdIterator>::difference_type n2 =
std::distance(s1, s2);
+ assert(n2 >= 0);
- // Empty replacement.
- if(0 == n2)
- return;
-
- assert(n2 > 0);
-
- // Handle aliased replace
- static const std::less_equal<const value_type*> le =
- std::less_equal<const value_type*>();
- const bool aliased = le(&*begin(), &*s1) && le(&*s1, &*end());
- if (aliased /* && capacity() < size() - n1 + n2 */)
+ // Make sure the replacement isn't empty.
+ if(0 != n2)
{
- // Aliased replace, copy to new string
- flex_string temp;
- temp.reserve(size() - n1 + n2);
- temp.append(begin(), i1).append(s1, s2).append(i2, end());
- swap(temp);
- return;
+ // Handle aliased replace
+ static const std::less_equal<const value_type*> le =
+ std::less_equal<const value_type*>();
+ const bool aliased = le(&*begin(), &*s1) && le(&*s1, &*end());
+ if (aliased /* && capacity() < size() - n1 + n2 */)
+ {
+ // Aliased replace, copy to new string
+ flex_string temp;
+ temp.reserve(size() - n1 + n2);
+ temp.append(begin(), i1).append(s1, s2).append(i2, end());
+ swap(temp);
+ return;
+ }
}
if (n1 > n2)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|