--------------------- PatchSet 4651 Date: 2007/05/26 06:21:28 Author: amosjeffries Branch: ayjwork Tag: (none) Log: Document reason for casting oprator. Members: src/SqString.h:1.1.2.7->1.1.2.8 src/tests/testString.cc:1.2.12.4->1.2.12.5 Index: squid3/src/SqString.h =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/SqString.h,v retrieving revision 1.1.2.7 retrieving revision 1.1.2.8 diff -u -r1.1.2.7 -r1.1.2.8 --- squid3/src/SqString.h 25 May 2007 08:17:39 -0000 1.1.2.7 +++ squid3/src/SqString.h 26 May 2007 06:21:28 -0000 1.1.2.8 @@ -1,6 +1,6 @@ /* - * $Id: SqString.h,v 1.1.2.7 2007/05/25 08:17:39 amosjeffries Exp $ + * $Id: SqString.h,v 1.1.2.8 2007/05/26 06:21:28 amosjeffries Exp $ * * DEBUG: section 67 String * AUTHOR: Duane Wessels @@ -87,9 +87,18 @@ SqString (SqString const &); ~SqString(); - // - // operator to cast to a const char * - // + /** + * operator to cast to a char const * + * + * Initial attempts to overload str*() functions ran into problems + * with the default C++ conversion being 'UP' from char* to string types + * this causes large buffers to big to be string to fail on conversion. + * + * The alternative is to force string 'DOWN' to raw char* in places where + * the content would be implicitly cast. This adds the possibility of forcing + * safety checks and giving control over the casting outcome no matter + * when it occurs. + */ operator char const *() const { return c_str(); } SqString &operator =(char const *); Index: squid3/src/tests/testString.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/tests/testString.cc,v retrieving revision 1.2.12.4 retrieving revision 1.2.12.5 diff -u -r1.2.12.4 -r1.2.12.5 --- squid3/src/tests/testString.cc 25 May 2007 05:11:52 -0000 1.2.12.4 +++ squid3/src/tests/testString.cc 26 May 2007 06:21:29 -0000 1.2.12.5 @@ -82,7 +82,7 @@ void testString::testAppend() { - // FIXME: make more tests for this. + // FIXME: make tests for this. string aStr("hello"); aStr.append(" world");