[Cppunit-cvs] cppunit/src/cppunit Message.cpp,1.3,1.4 SourceLine.cpp,1.2,1.3
Brought to you by:
blep
From: Baptiste L. <bl...@us...> - 2004-11-19 20:00:54
|
Update of /cvsroot/cppunit/cppunit/src/cppunit In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19361/src/cppunit Modified Files: Message.cpp SourceLine.cpp Log Message: * added specific copy constructor implementatin to ensure string buffer are detached during copy (therefore providing thread-safe copy constructor for non thread-safe std::string copy constructor implementation). Index: Message.cpp =================================================================== RCS file: /cvsroot/cppunit/cppunit/src/cppunit/Message.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** Message.cpp 12 Jul 2002 05:59:57 -0000 1.3 --- Message.cpp 19 Nov 2004 20:00:44 -0000 1.4 *************** *** 10,13 **** --- 10,18 ---- } + Message::Message( const Message &other ) + { + *this = other; + } + Message::Message( const std::string &shortDescription ) *************** *** 43,46 **** --- 48,67 ---- } + Message & + Message::operator =( const Message &other ) + { + if ( this != &other ) + { + m_shortDescription = other.m_shortDescription.c_str(); + m_details.clear(); + Details::const_iterator it = other.m_details.begin(); + Details::const_iterator itEnd = other.m_details.end(); + while ( it != itEnd ) + m_details.push_back( (*it++).c_str() ); + } + + return *this; + } + const std::string & Index: SourceLine.cpp =================================================================== RCS file: /cvsroot/cppunit/cppunit/src/cppunit/SourceLine.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** SourceLine.cpp 12 Jul 2002 05:59:57 -0000 1.2 --- SourceLine.cpp 19 Nov 2004 20:00:44 -0000 1.3 *************** *** 11,22 **** SourceLine::SourceLine( const std::string &fileName, ! int lineNumber ) : ! m_fileName( fileName ), ! m_lineNumber( lineNumber ) { } SourceLine::~SourceLine() { --- 11,41 ---- + SourceLine::SourceLine( const SourceLine &other ) + : m_fileName( other.m_fileName.c_str() ) + , m_lineNumber( other.m_lineNumber ) + { + } + + SourceLine::SourceLine( const std::string &fileName, ! int lineNumber ) ! : m_fileName( fileName.c_str() ) ! , m_lineNumber( lineNumber ) { } + SourceLine & + SourceLine::operator =( const SourceLine &other ) + { + if ( this != &other ) + { + m_fileName = other.m_fileName.c_str(); + m_lineNumber = other.m_lineNumber; + } + return *this; + } + + SourceLine::~SourceLine() { |