Author: wyoung
Date: Wed Jul 11 23:20:36 2007
New Revision: 1664
URL: http://svn.gna.org/viewcvs/mysqlpp?rev=1664&view=rev
Log:
Fixed a bug in new const_string memory handling: wasn't copying the
trailing null in the C string case. Fixed.
Modified:
trunk/lib/const_string.h
Modified: trunk/lib/const_string.h
URL:
http://svn.gna.org/viewcvs/mysqlpp/trunk/lib/const_string.h?rev=1664&r1=1663&r2=1664&view=diff
==============================================================================
--- trunk/lib/const_string.h (original)
+++ trunk/lib/const_string.h Wed Jul 11 23:20:36 2007
@@ -94,7 +94,7 @@
/// \brief Initialize string from existing C string
const_string(const char* str) :
str_data_(0),
- length_(size_type(strlen(str)))
+ length_(size_type(strlen(str) + 1))
{
str_data_ = new char[length_];
memcpy(str_data_, str, length_);
@@ -103,7 +103,7 @@
/// \brief Initialize string from existing C string of known length
const_string(const char* str, size_type len) :
str_data_(0),
- length_(size_type(len))
+ length_(size_type(len + 1))
{
str_data_ = new char[length_];
memcpy(str_data_, str, length_);
_______________________________________________
Mysqlpp-commits mailing list
[email protected]
https://mail.gna.org/listinfo/mysqlpp-commits