You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by ta...@apache.org on 2010/07/30 22:54:14 UTC
svn commit: r980956 - in /activemq/activemq-cpp/trunk/activemq-cpp/src:
examples/topics/chat/Chat.cpp main/activemq/cmsutil/CmsTemplate.h
main/activemq/cmsutil/DynamicDestinationResolver.h
test/activemq/commands/ActiveMQMessageTest.cpp
Author: tabish
Date: Fri Jul 30 20:54:14 2010
New Revision: 980956
URL: http://svn.apache.org/viewvc?rev=980956&view=rev
Log:
Clean up some errors reported by CPPCheck
Modified:
activemq/activemq-cpp/trunk/activemq-cpp/src/examples/topics/chat/Chat.cpp
activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/cmsutil/CmsTemplate.h
activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/cmsutil/DynamicDestinationResolver.h
activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/commands/ActiveMQMessageTest.cpp
Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/examples/topics/chat/Chat.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/examples/topics/chat/Chat.cpp?rev=980956&r1=980955&r2=980956&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/examples/topics/chat/Chat.cpp (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/examples/topics/chat/Chat.cpp Fri Jul 30 20:54:14 2010
@@ -118,7 +118,7 @@ void Chat::run() {
#ifdef AIX
if( fgets( s, 120, stdin ) == NULL ) {
break;
- } else if ( feof( stdin ) || ( strlen(s) == 0 ) || ( s[0] == L'\n' ) ) {
+ } else if ( feof( stdin ) || ( *s == '\0' ) || ( s[0] == L'\n' ) ) {
break;
}
#else
@@ -127,16 +127,26 @@ void Chat::run() {
// If there was an error reading input, or
// the line was empty, exit the program.
- if( std::cin.fail() || (strlen(s) == 0) ) {
+ if( std::cin.fail() || (*s == '\0') ) {
break;
}
#endif
- else if( strlen(s) > 0 ) {
+ else if( *s != '\0' ) {
int cch = (int)( this->username.length() + strlen(s) + strlen(": ") + 1 );
char *text = new char[cch];
+ class finalizer {
+ private:
+ char* text;
+ public:
+ finalizer( char* p ) : text( p ) {}
+ ~finalizer() { delete [] text; }
+ };
+
+ finalizer fin( text );
+
if( text != NULL ) {
sprintf( text, "%s: %s", this->username.c_str(), s );
@@ -148,12 +158,9 @@ void Chat::run() {
this->producer->send( message.get() );
} catch( cms::CMSException& ex ) {
- delete [] text;
onException( ex );
exit(1);
}
-
- delete [] text;
}
}
}
Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/cmsutil/CmsTemplate.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/cmsutil/CmsTemplate.h?rev=980956&r1=980955&r2=980956&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/cmsutil/CmsTemplate.h (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/cmsutil/CmsTemplate.h Fri Jul 30 20:54:14 2010
@@ -96,10 +96,10 @@ namespace cmsutil {
CmsTemplate* parent;
cms::Destination* destination;
- protected:
+ private:
- ProducerExecutor( const ProducerExecutor& ) : SessionCallback() {}
- ProducerExecutor& operator= ( const ProducerExecutor& ) { return *this; }
+ ProducerExecutor( const ProducerExecutor& );
+ ProducerExecutor& operator= ( const ProducerExecutor& );
public:
Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/cmsutil/DynamicDestinationResolver.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/cmsutil/DynamicDestinationResolver.h?rev=980956&r1=980955&r2=980956&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/cmsutil/DynamicDestinationResolver.h (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/cmsutil/DynamicDestinationResolver.h Fri Jul 30 20:54:14 2010
@@ -42,10 +42,10 @@ namespace cmsutil {
decaf::util::StlMap<std::string, cms::Topic*> topicMap;
decaf::util::StlMap<std::string, cms::Queue*> queueMap;
- protected:
+ private:
- SessionResolver( const SessionResolver& ) {}
- SessionResolver& operator= ( const SessionResolver& ) { return *this; }
+ SessionResolver( const SessionResolver& );
+ SessionResolver& operator= ( const SessionResolver& );
public:
Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/commands/ActiveMQMessageTest.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/commands/ActiveMQMessageTest.cpp?rev=980956&r1=980955&r2=980956&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/commands/ActiveMQMessageTest.cpp (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/commands/ActiveMQMessageTest.cpp Fri Jul 30 20:54:14 2010
@@ -424,7 +424,7 @@ void ActiveMQMessageTest::testGetAndSetC
ActiveMQMessage msg;
msg.setIntProperty( "CMSXDeliveryCount", 1 );
int count = msg.getIntProperty( "CMSXDeliveryCount" );
- CPPUNIT_ASSERT_MESSAGE( "expected delivery count = 1 - got: " + count, count == 1 );
+ CPPUNIT_ASSERT_MESSAGE( "expected delivery count = 1", count == 1 );
}
////////////////////////////////////////////////////////////////////////////////