Update of /cvsroot/cppunit/cppunit2/include/cpptl
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23202/include/cpptl
Modified Files:
conststring.h
Log Message:
* fixed bug in ConstString copy constructor for length == 0
Index: conststring.h
===================================================================
RCS file: /cvsroot/cppunit/cppunit2/include/cpptl/conststring.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** conststring.h 27 Feb 2005 10:11:45 -0000 1.2
--- conststring.h 27 Feb 2005 15:26:27 -0000 1.3
***************
*** 9,12 ****
--- 9,14 ----
# endif
+ /// @todo optimize case where length == 0 in ConstString constructor.
+
namespace CppTL {
class StringConcatenator
***************
*** 618,624 ****
ConstString::ConstString( const ConstString &other )
: length_( other.length_ )
{
! buffer_ = new value_type[length_+1];
! memcpy( buffer_, other.buffer_, length_+1 );
}
--- 620,630 ----
ConstString::ConstString( const ConstString &other )
: length_( other.length_ )
+ , buffer_( 0 )
{
! if ( length_ > 0 )
! {
! buffer_ = new value_type[length_+1];
! memcpy( buffer_, other.buffer_, length_+1 );
! }
}
|