From: Claudio V. C. <ro...@us...> - 2008-03-13 10:39:02
|
Update of /cvsroot/firebird/firebird2/src/common/classes In directory sc8-pr-cvs17.sourceforge.net:/tmp/cvs-serv27188/src/common/classes Modified Files: fb_string.cpp fb_string.h Log Message: - Made some constructor explicit and discovered that for adding one byte to a string, a temporary string was being created on the fly. Unacceptable in loops. - Disabled constructor from hell for now. I wasn't the only one confused about the nature of the only argument: only looking at the signature one realizes it's a byte's value, not the initial length. Index: fb_string.cpp =================================================================== RCS file: /cvsroot/firebird/firebird2/src/common/classes/fb_string.cpp,v retrieving revision 1.36 retrieving revision 1.37 diff -b -U3 -r1.36 -r1.37 --- fb_string.cpp 16 Jan 2008 13:37:59 -0000 1.36 +++ fb_string.cpp 13 Mar 2008 10:38:14 -0000 1.37 @@ -77,7 +77,7 @@ } // namespace namespace Firebird { - const AbstractString::size_type AbstractString::npos = (AbstractString::size_type)(-1); + const AbstractString::size_type AbstractString::npos = (AbstractString::size_type)(~0); AbstractString::AbstractString(const AbstractString& v) { initialize(v.length()); Index: fb_string.h =================================================================== RCS file: /cvsroot/firebird/firebird2/src/common/classes/fb_string.h,v retrieving revision 1.11 retrieving revision 1.12 diff -b -U3 -r1.11 -r1.12 --- fb_string.h 3 Dec 2007 13:29:33 -0000 1.11 +++ fb_string.h 13 Mar 2008 10:38:15 -0000 1.12 @@ -401,9 +401,9 @@ inline StringBase<Comparator>(const StringType& v) : AbstractString(v) {} inline StringBase<Comparator>(const_pointer s, size_type n) : AbstractString(n, s) {} inline StringBase<Comparator>(const_pointer s) : AbstractString(strlen(s), s) {} - inline StringBase<Comparator>(const unsigned char* s) : AbstractString(strlen((char*)s), (char*)s) {} + inline explicit StringBase<Comparator>(const unsigned char* s) : AbstractString(strlen((char*)s), (char*)s) {} inline StringBase<Comparator>(size_type n, char_type c) : AbstractString(n, c) {} - inline StringBase<Comparator>(char_type c) : AbstractString(1, c) {} + //inline explicit StringBase<Comparator>(char_type c) : AbstractString(1, c) {} inline StringBase<Comparator>(const_iterator first, const_iterator last) : AbstractString(last - first, first) {} inline explicit StringBase<Comparator>(MemoryPool& p) : AbstractString(p) {} inline StringBase<Comparator>(MemoryPool& p, const AbstractString& v) : AbstractString(p, v) {} @@ -635,7 +635,7 @@ return rc; } inline string operator+(string::char_type c, const string& str) { - string rc(c); + string rc(1, c); rc += str; return rc; } @@ -647,7 +647,7 @@ return rc; } inline PathName operator+(PathName::char_type c, const PathName& str) { - PathName rc(c); + PathName rc(1, c); rc += str; return rc; } |