You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by nm...@apache.org on 2007/01/26 22:11:37 UTC
svn commit: r500349 [1/2] - in
/incubator/activemq/activemq-cpp/trunk/activemq-cpp/src:
main/activemq/concurrent/ main/activemq/connector/openwire/marshal/
main/activemq/connector/openwire/utils/ main/activemq/connector/stomp/
main/activemq/connector/s...
Author: nmittler
Date: Fri Jan 26 13:11:34 2007
New Revision: 500349
URL: http://svn.apache.org/viewvc?view=rev&rev=500349
Log:
[AMQCPP-56] - make buffer lengths use size_t for 64-bit operating systems
Modified:
incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/concurrent/ThreadPool.cpp
incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/concurrent/ThreadPool.h
incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/marshal/PrimitiveMapMarshaller.cpp
incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/utils/BooleanStream.cpp
incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/utils/HexTable.cpp
incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/utils/HexTable.h
incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/utils/OpenwireStringSupport.cpp
incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/stomp/StompCommandReader.cpp
incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/stomp/StompCommandReader.h
incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/stomp/StompCommandWriter.cpp
incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/stomp/StompCommandWriter.h
incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/stomp/StompFrame.h
incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/stomp/commands/AbstractCommand.h
incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/stomp/commands/BytesMessageCommand.h
incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/stomp/commands/CommandConstants.cpp
incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/ActiveMQConnection.cpp
incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/ActiveMQSession.cpp
incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/ActiveMQSession.h
incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/io/BlockingByteArrayInputStream.cpp
incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/io/BlockingByteArrayInputStream.h
incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/io/BufferedInputStream.cpp
incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/io/BufferedInputStream.h
incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/io/BufferedOutputStream.cpp
incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/io/BufferedOutputStream.h
incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/io/ByteArrayInputStream.cpp
incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/io/ByteArrayInputStream.h
incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/io/ByteArrayOutputStream.cpp
incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/io/ByteArrayOutputStream.h
incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/io/DataInputStream.cpp
incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/io/DataInputStream.h
incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/io/DataOutputStream.cpp
incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/io/DataOutputStream.h
incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/io/FilterInputStream.h
incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/io/FilterOutputStream.h
incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/io/InputStream.h
incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/io/OutputStream.h
incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/io/Reader.h
incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/io/Writer.h
incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/network/BufferedSocket.cpp
incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/network/BufferedSocket.h
incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/network/ServerSocket.cpp
incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/network/ServerSocket.h
incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/network/Socket.h
incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/network/SocketFactory.cpp
incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/network/SocketInputStream.cpp
incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/network/SocketInputStream.h
incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/network/SocketOutputStream.cpp
incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/network/SocketOutputStream.h
incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/network/TcpSocket.cpp
incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/network/TcpSocket.h
incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/transport/CommandReader.h
incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/transport/CommandWriter.h
incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/util/Map.h
incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/util/PrimitiveMap.cpp
incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/util/PrimitiveMap.h
incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/util/Set.h
incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/cms/BytesMessage.h
incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/cms/Closeable.h
incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/cms/Connection.h
incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/cms/ConnectionFactory.h
incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/cms/Destination.h
incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/cms/ExceptionListener.h
incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/cms/MapMessage.h
incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/cms/MessageConsumer.h
incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/cms/MessageListener.h
incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/cms/Queue.h
incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/cms/Session.h
incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/cms/TemporaryQueue.h
incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/cms/TemporaryTopic.h
incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/cms/Topic.h
incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/concurrent/MutexTest.h
incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/concurrent/ThreadTest.h
incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/io/BufferedInputStreamTest.h
incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/io/BufferedOutputStreamTest.h
incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/network/SocketTest.h
incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/transport/IOTransportTest.h
incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/util/LongTest.h
Modified: incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/concurrent/ThreadPool.cpp
URL: http://svn.apache.org/viewvc/incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/concurrent/ThreadPool.cpp?view=diff&rev=500349&r1=500348&r2=500349
==============================================================================
--- incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/concurrent/ThreadPool.cpp (original)
+++ incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/concurrent/ThreadPool.cpp Fri Jan 26 13:11:34 2007
@@ -38,7 +38,7 @@
ThreadPool ThreadPool::instance;
////////////////////////////////////////////////////////////////////////////////
-ThreadPool::ThreadPool(void)
+ThreadPool::ThreadPool()
{
maxThreads = DEFAULT_MAX_POOL_SIZE;
blockSize = DEFAULT_MAX_BLOCK_SIZE;
@@ -48,7 +48,7 @@
}
////////////////////////////////////////////////////////////////////////////////
-ThreadPool::~ThreadPool(void)
+ThreadPool::~ThreadPool()
{
try
{
@@ -126,7 +126,7 @@
}
////////////////////////////////////////////////////////////////////////////////
-ThreadPool::Task ThreadPool::deQueueTask(void)
+ThreadPool::Task ThreadPool::deQueueTask()
throw ( exceptions::ActiveMQException )
{
try
@@ -176,7 +176,7 @@
}
////////////////////////////////////////////////////////////////////////////////
-void ThreadPool::reserve( unsigned long size )
+void ThreadPool::reserve( std::size_t size )
{
try
{
@@ -188,7 +188,7 @@
}
// How many do we reserve
- unsigned long allocCount = size - pool.size();
+ std::size_t allocCount = size - pool.size();
// Allocate the new Threads
AllocateThreads(allocCount);
@@ -199,7 +199,7 @@
}
////////////////////////////////////////////////////////////////////////////////
-void ThreadPool::setMaxThreads( unsigned long maxThreads )
+void ThreadPool::setMaxThreads( std::size_t maxThreads )
{
try
{
@@ -219,7 +219,7 @@
}
////////////////////////////////////////////////////////////////////////////////
-void ThreadPool::setBlockSize( unsigned long blockSize )
+void ThreadPool::setBlockSize( std::size_t blockSize )
{
try
{
@@ -239,7 +239,7 @@
}
////////////////////////////////////////////////////////////////////////////////
-void ThreadPool::AllocateThreads( unsigned long count )
+void ThreadPool::AllocateThreads( std::size_t count )
{
try
{
@@ -257,7 +257,7 @@
// Each time we create a thread we increment the free Threads
// counter, but before we call start so that the Thread doesn't
// get ahead of us.
- for(unsigned long i = 0; i < count; ++i)
+ for(std::size_t i = 0; i < count; ++i)
{
pool.push_back(new PooledThread(this));
pool.back()->setPooledThreadListener(this);
Modified: incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/concurrent/ThreadPool.h
URL: http://svn.apache.org/viewvc/incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/concurrent/ThreadPool.h?view=diff&rev=500349&r1=500348&r2=500349
==============================================================================
--- incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/concurrent/ThreadPool.h (original)
+++ incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/concurrent/ThreadPool.h Fri Jan 26 13:11:34 2007
@@ -66,16 +66,16 @@
util::Queue<Task> queue;
// Max number of Threads this Pool can contian
- unsigned long maxThreads;
+ std::size_t maxThreads;
// Max number of tasks that can be allocated at a time
- unsigned long blockSize;
+ std::size_t blockSize;
// boolean flag use to indocate that this object is shutting down.
bool shutdown;
// Count of threads that are currently free to perfom some work.
- unsigned long freeThreads;
+ std::size_t freeThreads;
// Mutex for locking operations that affect the pool.
Mutex poolLock;
@@ -91,8 +91,8 @@
public:
- ThreadPool(void);
- virtual ~ThreadPool(void);
+ ThreadPool();
+ virtual ~ThreadPool();
/**
* Queue a task to be completed by one of the Pooled Threads.
@@ -114,7 +114,7 @@
* @return object that derives from Runnable
* @throws ActiveMQException
*/
- virtual Task deQueueTask(void)
+ virtual Task deQueueTask()
throw ( exceptions::ActiveMQException );
/**
@@ -123,14 +123,14 @@
* number that might exist.
* @return integer number of threads in existance.
*/
- virtual unsigned long getPoolSize(void) const { return pool.size(); }
+ virtual std::size_t getPoolSize() const { return pool.size(); }
/**
* Returns the current backlog of items in the tasks queue, this
* is how much work is still waiting to get done.
* @return number of outstanding tasks.
*/
- virtual unsigned long getBacklog(void) const { return queue.size(); }
+ virtual std::size_t getBacklog() const { return queue.size(); }
/**
* Ensures that there is at least the specified number of Threads
@@ -140,13 +140,13 @@
* currently in the pool, than nothing is done.
* @param size the number of threads to reserve.
*/
- virtual void reserve( unsigned long size );
+ virtual void reserve( std::size_t size );
/**
* Get the Max Number of Threads this Pool can contain
* @return max size
*/
- virtual unsigned long getMaxThreads(void) const { return maxThreads; }
+ virtual std::size_t getMaxThreads() const { return maxThreads; }
/**
* Sets the Max number of threads this pool can contian.
@@ -154,21 +154,21 @@
* pool nothing is done.
* @param maxThreads total number of threads that can be pooled
*/
- virtual void setMaxThreads( unsigned long maxThreads );
+ virtual void setMaxThreads( std::size_t maxThreads );
/**
* Gets the Max number of threads that can be allocated at a time
* when new threads are needed.
* @return max Thread Block Size
*/
- virtual unsigned long getBlockSize(void) const { return blockSize; }
+ virtual std::size_t getBlockSize() const { return blockSize; }
/**
* Sets the Max number of Threads that can be allocated at a time
* when the Thread Pool determines that more Threads are needed.
* @param blockSize Max Thread Block Size
*/
- virtual void setBlockSize( unsigned long blockSize );
+ virtual void setBlockSize( std::size_t blockSize );
/**
* Returns the current number of available threads in the pool, threads
@@ -177,7 +177,7 @@
* after and be available again. This is informational only.
* @return totoal free threads
*/
- virtual unsigned long getFreeThreadCount(void) const {
+ virtual std::size_t getFreeThreadCount() const {
return freeThreads;
}
@@ -217,7 +217,7 @@
* Return the one and only Thread Pool instance.
* @return The Thread Pool Pointer
*/
- static ThreadPool* getInstance(void) {
+ static ThreadPool* getInstance() {
return &instance;
}
@@ -228,7 +228,7 @@
* <code>maxThreads</code>.
* @param count the number of threads to create
*/
- void AllocateThreads( unsigned long count );
+ void AllocateThreads( std::size_t count );
};
Modified: incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/marshal/PrimitiveMapMarshaller.cpp
URL: http://svn.apache.org/viewvc/incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/marshal/PrimitiveMapMarshaller.cpp?view=diff&rev=500349&r1=500348&r2=500349
==============================================================================
--- incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/marshal/PrimitiveMapMarshaller.cpp (original)
+++ incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/marshal/PrimitiveMapMarshaller.cpp Fri Jan 26 13:11:34 2007
@@ -48,7 +48,7 @@
}
else
{
- dataOut.writeInt( map->size() );
+ dataOut.writeInt( (int)map->size() );
std::vector<std::string> keys = map->getKeys();
std::vector<std::string>::const_iterator iter = keys.begin();
@@ -150,7 +150,7 @@
std::vector<unsigned char> data = value.getByteArray();
- dataOut.writeInt( data.size() );
+ dataOut.writeInt( (int)data.size() );
dataOut.write( data );
}
else if( value.getValueType() == PrimitiveMap::STRING_TYPE )
Modified: incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/utils/BooleanStream.cpp
URL: http://svn.apache.org/viewvc/incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/utils/BooleanStream.cpp?view=diff&rev=500349&r1=500348&r2=500349
==============================================================================
--- incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/utils/BooleanStream.cpp (original)
+++ incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/utils/BooleanStream.cpp Fri Jan 26 13:11:34 2007
@@ -96,10 +96,10 @@
try {
if( arrayLimit < 64 ) {
- dataOut->writeByte( arrayLimit );
+ dataOut->writeByte( (unsigned char)arrayLimit );
} else if( arrayLimit < 256 ) { // max value of unsigned char
dataOut->writeByte( 0xC0 );
- dataOut->writeByte( arrayLimit );
+ dataOut->writeByte( (unsigned char)arrayLimit );
} else {
dataOut->writeByte( 0x80 );
dataOut->writeShort( arrayLimit );
Modified: incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/utils/HexTable.cpp
URL: http://svn.apache.org/viewvc/incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/utils/HexTable.cpp?view=diff&rev=500349&r1=500348&r2=500349
==============================================================================
--- incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/utils/HexTable.cpp (original)
+++ incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/utils/HexTable.cpp Fri Jan 26 13:11:34 2007
@@ -45,27 +45,27 @@
}
////////////////////////////////////////////////////////////////////////////////
-const std::string& HexTable::operator[]( int index )
+const std::string& HexTable::operator[]( std::size_t index )
throw ( exceptions::IndexOutOfBoundsException ) {
if( size() < index ) {
throw IndexOutOfBoundsException(
__FILE__, __LINE__,
( string( "HexTable::operator[] - Index passed is out of Bounds" ) +
- Integer::toString( index ) ).c_str() );
+ Integer::toString( (int)index ) ).c_str() );
}
return table[index];
}
////////////////////////////////////////////////////////////////////////////////
-const std::string& HexTable::operator[]( int index ) const
+const std::string& HexTable::operator[]( std::size_t index ) const
throw ( exceptions::IndexOutOfBoundsException ) {
if( size() < index ) {
throw IndexOutOfBoundsException(
__FILE__, __LINE__,
( string( "HexTable::operator[] - Index passed is out of Bounds" ) +
- Integer::toString( index ) ).c_str() );
+ Integer::toString( (int)index ) ).c_str() );
}
return table[index];
Modified: incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/utils/HexTable.h
URL: http://svn.apache.org/viewvc/incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/utils/HexTable.h?view=diff&rev=500349&r1=500348&r2=500349
==============================================================================
--- incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/utils/HexTable.h (original)
+++ incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/utils/HexTable.h Fri Jan 26 13:11:34 2007
@@ -47,14 +47,14 @@
* @returns string contianing the hex value if the index
* @throws IndexOutOfBoundsException
*/
- virtual const std::string& operator[]( int index ) throw ( exceptions::IndexOutOfBoundsException );
- virtual const std::string& operator[]( int index ) const throw ( exceptions::IndexOutOfBoundsException );
+ virtual const std::string& operator[]( std::size_t index ) throw ( exceptions::IndexOutOfBoundsException );
+ virtual const std::string& operator[]( std::size_t index ) const throw ( exceptions::IndexOutOfBoundsException );
/**
* Returns the max size of this Table.
* @returns int size value
*/
- virtual int size() const{
+ virtual std::size_t size() const{
return table.size();
}
Modified: incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/utils/OpenwireStringSupport.cpp
URL: http://svn.apache.org/viewvc/incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/utils/OpenwireStringSupport.cpp?view=diff&rev=500349&r1=500348&r2=500349
==============================================================================
--- incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/utils/OpenwireStringSupport.cpp (original)
+++ incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/utils/OpenwireStringSupport.cpp Fri Jan 26 13:11:34 2007
@@ -131,7 +131,7 @@
__LINE__,
( std::string( "OpenwireStringSupport::writeString - Cannot marshall " ) +
"string longer than: 65536 characters, supplied steing was: " +
- Integer::toString( str->size() ) + " characters long." ).c_str() );
+ Integer::toString( (int)str->size() ) + " characters long." ).c_str() );
}
//short strlen = (short)str->size();
Modified: incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/stomp/StompCommandReader.cpp
URL: http://svn.apache.org/viewvc/incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/stomp/StompCommandReader.cpp?view=diff&rev=500349&r1=500348&r2=500349
==============================================================================
--- incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/stomp/StompCommandReader.cpp (original)
+++ incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/stomp/StompCommandReader.cpp Fri Jan 26 13:11:34 2007
@@ -43,7 +43,7 @@
}
////////////////////////////////////////////////////////////////////////////////
-Command* StompCommandReader::readCommand(void)
+Command* StompCommandReader::readCommand()
throw ( CommandIOException )
{
StompFrame* frame = NULL;
@@ -98,7 +98,7 @@
readStompHeaderLine();
// Ignore all white space before the command.
- int offset = -1;
+ std::size_t offset = -1;
for( size_t ix = 0; ix < buffer.size()-1; ++ix )
{
// Find the first non whitespace character
@@ -133,7 +133,7 @@
while( !endOfHeaders )
{
// Read in the next header line.
- int numChars = readStompHeaderLine();
+ std::size_t numChars = readStompHeaderLine();
if( numChars == 0 )
{
@@ -179,14 +179,14 @@
}
////////////////////////////////////////////////////////////////////////////////
-int StompCommandReader::readStompHeaderLine(void)
+std::size_t StompCommandReader::readStompHeaderLine()
throw ( CommandIOException )
{
try{
// Clear any data from the buffer.
buffer.clear();
- int count = 0;
+ std::size_t count = 0;
while( true )
{
@@ -309,7 +309,7 @@
}
////////////////////////////////////////////////////////////////////////////////
-int StompCommandReader::read( unsigned char* buffer, int count )
+std::size_t StompCommandReader::read( unsigned char* buffer, std::size_t count )
throw( io::IOException )
{
try{
@@ -328,7 +328,7 @@
}
////////////////////////////////////////////////////////////////////////////////
-unsigned char StompCommandReader::readByte(void) throw( io::IOException )
+unsigned char StompCommandReader::readByte() throw( io::IOException )
{
try{
if( inputStream == NULL )
Modified: incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/stomp/StompCommandReader.h
URL: http://svn.apache.org/viewvc/incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/stomp/StompCommandReader.h?view=diff&rev=500349&r1=500348&r2=500349
==============================================================================
--- incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/stomp/StompCommandReader.h (original)
+++ incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/stomp/StompCommandReader.h Fri Jan 26 13:11:34 2007
@@ -94,7 +94,7 @@
* @return The number of bytes read.
* @throws IOException thrown if an error occurs.
*/
- virtual int read( unsigned char* buffer, int count )
+ virtual std::size_t read( unsigned char* buffer, std::size_t count )
throw( io::IOException );
/**
@@ -127,7 +127,7 @@
* @return number of bytes read, zero if there was a problem.
* @throws StompConnectorException
*/
- int readStompHeaderLine() throw ( transport::CommandIOException );
+ std::size_t readStompHeaderLine() throw ( transport::CommandIOException );
/**
* Reads the Stomp Body from the Wire and store it in the frame.
Modified: incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/stomp/StompCommandWriter.cpp
URL: http://svn.apache.org/viewvc/incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/stomp/StompCommandWriter.cpp?view=diff&rev=500349&r1=500348&r2=500349
==============================================================================
--- incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/stomp/StompCommandWriter.cpp (original)
+++ incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/stomp/StompCommandWriter.cpp Fri Jan 26 13:11:34 2007
@@ -29,7 +29,7 @@
using namespace activemq::exceptions;
////////////////////////////////////////////////////////////////////////////////
-StompCommandWriter::StompCommandWriter(void)
+StompCommandWriter::StompCommandWriter()
{
outputStream = NULL;
}
@@ -63,7 +63,7 @@
// Write all the headers.
vector< pair<string,string> > headers = frame.getProperties().toArray();
- for( unsigned int ix=0; ix < headers.size(); ++ix )
+ for( std::size_t ix=0; ix < headers.size(); ++ix )
{
string& name = headers[ix].first;
string& value = headers[ix].second;
@@ -103,7 +103,7 @@
}
////////////////////////////////////////////////////////////////////////////////
-void StompCommandWriter::write( const unsigned char* buffer, int count )
+void StompCommandWriter::write( const unsigned char* buffer, std::size_t count )
throw( IOException )
{
if( outputStream == NULL )
@@ -130,7 +130,7 @@
}
////////////////////////////////////////////////////////////////////////////////
-void StompCommandWriter::write( const char* buffer, int count )
+void StompCommandWriter::write( const char* buffer, std::size_t count )
throw( io::IOException )
{
write( reinterpret_cast<const unsigned char*>( buffer ), count );
Modified: incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/stomp/StompCommandWriter.h
URL: http://svn.apache.org/viewvc/incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/stomp/StompCommandWriter.h?view=diff&rev=500349&r1=500348&r2=500349
==============================================================================
--- incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/stomp/StompCommandWriter.h (original)
+++ incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/stomp/StompCommandWriter.h Fri Jan 26 13:11:34 2007
@@ -48,7 +48,7 @@
/**
* Default Constructor
*/
- StompCommandWriter(void);
+ StompCommandWriter();
/**
* Constructor.
@@ -56,7 +56,7 @@
*/
StompCommandWriter( io::OutputStream* os );
- virtual ~StompCommandWriter(void) {}
+ virtual ~StompCommandWriter() {}
/**
* Sets the target output stream.
@@ -68,7 +68,7 @@
/**
* Gets the target output stream.
*/
- virtual io::OutputStream* getOutputStream(void){
+ virtual io::OutputStream* getOutputStream(){
return outputStream;
}
@@ -87,7 +87,7 @@
* @param count the number of bytes in the array to write.
* @throws IOException thrown if an error occurs.
*/
- virtual void write( const unsigned char* buffer, int count )
+ virtual void write( const unsigned char* buffer, std::size_t count )
throw( io::IOException );
/**
@@ -105,7 +105,7 @@
* @param count the number of bytes in the array to write.
* @throws IOException thrown if an error occurs.
*/
- virtual void write( const char* buffer, int count )
+ virtual void write( const char* buffer, std::size_t count )
throw( io::IOException );
};
Modified: incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/stomp/StompFrame.h
URL: http://svn.apache.org/viewvc/incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/stomp/StompFrame.h?view=diff&rev=500349&r1=500348&r2=500349
==============================================================================
--- incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/stomp/StompFrame.h (original)
+++ incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/stomp/StompFrame.h Fri Jan 26 13:11:34 2007
@@ -100,20 +100,20 @@
* Return the number of bytes contained in this frames body
* @return Body bytes length.
*/
- unsigned long long getBodyLength() const{ return (unsigned long long)body.size(); }
+ std::size_t getBodyLength() const{ return body.size(); }
/**
* Sets the body data of this frame as a byte sequence.
* @param bytes The byte buffer to be set in the body.
* @param numBytes The number of bytes in the buffer.
*/
- void setBody( const unsigned char* bytes, unsigned long long numBytes ){
+ void setBody( const unsigned char* bytes, std::size_t numBytes ){
// Remove old data
body.clear();
// Copy data to internal buffer.
- for( unsigned long long ix = 0; ix < numBytes; ++ix )
+ for( std::size_t ix = 0; ix < numBytes; ++ix )
{
body.push_back(bytes[ix]);
}
Modified: incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/stomp/commands/AbstractCommand.h
URL: http://svn.apache.org/viewvc/incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/stomp/commands/AbstractCommand.h?view=diff&rev=500349&r1=500348&r2=500349
==============================================================================
--- incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/stomp/commands/AbstractCommand.h (original)
+++ incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/stomp/commands/AbstractCommand.h Fri Jan 26 13:11:34 2007
@@ -250,7 +250,7 @@
* Fetch the number of bytes in the Stomp Frame Body
* @return number of bytes
*/
- virtual unsigned long long getNumBytes() const{
+ virtual std::size_t getNumBytes() const{
return getFrame().getBodyLength();
}
@@ -276,7 +276,7 @@
* be set
*/
virtual void setBytes( const unsigned char* bytes,
- const unsigned long long numBytes )
+ std::size_t numBytes )
{
getFrame().setBody( bytes, numBytes );
}
Modified: incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/stomp/commands/BytesMessageCommand.h
URL: http://svn.apache.org/viewvc/incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/stomp/commands/BytesMessageCommand.h?view=diff&rev=500349&r1=500348&r2=500349
==============================================================================
--- incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/stomp/commands/BytesMessageCommand.h (original)
+++ incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/stomp/commands/BytesMessageCommand.h Fri Jan 26 13:11:34 2007
@@ -121,7 +121,7 @@
* @throws MarshalException if the command is not
* in a state that can be marshaled.
*/
- virtual const StompFrame& marshal(void)
+ virtual const StompFrame& marshal()
throw (marshal::MarshalException)
{
// Before we send out the frame tag it with the content length
@@ -163,7 +163,7 @@
* @throws CMSException
*/
virtual void setBodyBytes( const unsigned char* buffer,
- const unsigned long long numBytes )
+ std::size_t numBytes )
throw( cms::CMSException ) {
checkWriteOnly();
@@ -190,7 +190,7 @@
* Returns the number of bytes contained in the body of this message.
* @return number of bytes.
*/
- virtual unsigned long long getBodyLength() const {
+ virtual std::size_t getBodyLength() const {
return this->getNumBytes();
}
@@ -255,7 +255,7 @@
* been reached
* @throws CMSException if an error occurs.
*/
- virtual int readBytes( std::vector<unsigned char>& value )
+ virtual std::size_t readBytes( std::vector<unsigned char>& value )
throw ( cms::CMSException ){
checkReadOnly();
return dataInputStream.read( value );
@@ -298,8 +298,9 @@
* been reached
* @throws CMSException
*/
- virtual int readBytes( unsigned char*& buffer, int length )
- throw ( cms::CMSException ){
+ virtual std::size_t readBytes( unsigned char*& buffer, std::size_t length )
+ throw ( cms::CMSException )
+ {
checkReadOnly();
return dataInputStream.read( buffer, 0, length );
}
@@ -313,8 +314,8 @@
* @throws CMSException
*/
virtual void writeBytes( const unsigned char* value,
- int offset,
- int length ) throw ( cms::CMSException ){
+ std::size_t offset,
+ std::size_t length ) throw ( cms::CMSException ){
checkWriteOnly();
dataOutputStream.write( value, offset, length );
}
Modified: incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/stomp/commands/CommandConstants.cpp
URL: http://svn.apache.org/viewvc/incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/stomp/commands/CommandConstants.cpp?view=diff&rev=500349&r1=500348&r2=500349
==============================================================================
--- incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/stomp/commands/CommandConstants.cpp (original)
+++ incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/stomp/commands/CommandConstants.cpp Fri Jan 26 13:11:34 2007
@@ -123,8 +123,8 @@
cms::Destination* CommandConstants::toDestination( const std::string& dest )
throw ( exceptions::IllegalArgumentException )
{
- int qpos = dest.find(queuePrefix);
- int tpos = dest.find(topicPrefix);
+ std::size_t qpos = dest.find(queuePrefix);
+ std::size_t tpos = dest.find(topicPrefix);
if(tpos == 0)
{
Modified: incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/ActiveMQConnection.cpp
URL: http://svn.apache.org/viewvc/incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/ActiveMQConnection.cpp?view=diff&rev=500349&r1=500348&r2=500349
==============================================================================
--- incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/ActiveMQConnection.cpp (original)
+++ incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/ActiveMQConnection.cpp Fri Jan 26 13:11:34 2007
@@ -22,6 +22,8 @@
#include <activemq/core/ActiveMQConsumer.h>
#include <activemq/exceptions/NullPointerException.h>
+#include <activemq/util/Config.h>
+
using namespace cms;
using namespace activemq;
using namespace activemq::core;
@@ -117,7 +119,7 @@
cms::Session* session = allSessions[ix];
try{
session->close();
- } catch( cms::CMSException& ex ){
+ } catch( cms::CMSException& ex AMQCPP_UNUSED ){
/* Absorb */
}
}
Modified: incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/ActiveMQSession.cpp
URL: http://svn.apache.org/viewvc/incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/ActiveMQSession.cpp?view=diff&rev=500349&r1=500348&r2=500349
==============================================================================
--- incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/ActiveMQSession.cpp (original)
+++ incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/ActiveMQSession.cpp Fri Jan 26 13:11:34 2007
@@ -27,6 +27,8 @@
#include <activemq/connector/TransactionInfo.h>
+#include <activemq/util/Config.h>
+
using namespace std;
using namespace cms;
using namespace activemq;
@@ -93,7 +95,7 @@
cms::Closeable* resource = allResources[ix];
try{
resource->close();
- } catch( cms::CMSException& ex ){
+ } catch( cms::CMSException& ex AMQCPP_UNUSED ){
/* Absorb */
}
}
@@ -426,7 +428,7 @@
////////////////////////////////////////////////////////////////////////////////
cms::BytesMessage* ActiveMQSession::createBytesMessage(
const unsigned char* bytes,
- unsigned long long bytesSize )
+ std::size_t bytesSize )
throw ( cms::CMSException )
{
try
Modified: incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/ActiveMQSession.h
URL: http://svn.apache.org/viewvc/incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/ActiveMQSession.h?view=diff&rev=500349&r1=500348&r2=500349
==============================================================================
--- incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/ActiveMQSession.h (original)
+++ incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/ActiveMQSession.h Fri Jan 26 13:11:34 2007
@@ -208,7 +208,7 @@
*/
virtual cms::BytesMessage* createBytesMessage(
const unsigned char* bytes,
- unsigned long long bytesSize )
+ std::size_t bytesSize )
throw ( cms::CMSException );
/**
Modified: incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/io/BlockingByteArrayInputStream.cpp
URL: http://svn.apache.org/viewvc/incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/io/BlockingByteArrayInputStream.cpp?view=diff&rev=500349&r1=500348&r2=500349
==============================================================================
--- incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/io/BlockingByteArrayInputStream.cpp (original)
+++ incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/io/BlockingByteArrayInputStream.cpp Fri Jan 26 13:11:34 2007
@@ -32,7 +32,7 @@
////////////////////////////////////////////////////////////////////////////////
BlockingByteArrayInputStream::BlockingByteArrayInputStream(
const unsigned char* buffer,
- int bufferSize ){
+ std::size_t bufferSize ){
closing = false;
setByteArray( buffer, bufferSize );
@@ -44,14 +44,14 @@
////////////////////////////////////////////////////////////////////////////////
void BlockingByteArrayInputStream::setByteArray( const unsigned char* lbuffer,
- int lbufferSize ){
+ std::size_t lbufferSize ){
synchronized( this ){
// Remove old data
this->buffer.clear();
// Copy data to internal buffer.
- for( int ix = 0; ix < lbufferSize; ++ix )
+ for( std::size_t ix = 0; ix < lbufferSize; ++ix )
{
this->buffer.push_back(lbuffer[ix]);
}
@@ -102,12 +102,12 @@
}
////////////////////////////////////////////////////////////////////////////////
-int BlockingByteArrayInputStream::read( unsigned char* buffer,
- int bufferSize )
+std::size_t BlockingByteArrayInputStream::read( unsigned char* buffer,
+ std::size_t bufferSize )
throw ( IOException ){
synchronized( this ){
- int ix = 0;
+ std::size_t ix = 0;
for( ; ix < bufferSize && !closing; ++ix, ++pos)
{
@@ -133,10 +133,10 @@
}
////////////////////////////////////////////////////////////////////////////////
-int BlockingByteArrayInputStream::skip( int num )
+std::size_t BlockingByteArrayInputStream::skip( std::size_t num )
throw ( io::IOException, exceptions::UnsupportedOperationException ){
- int ix = 0;
+ std::size_t ix = 0;
synchronized( this ){
Modified: incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/io/BlockingByteArrayInputStream.h
URL: http://svn.apache.org/viewvc/incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/io/BlockingByteArrayInputStream.h?view=diff&rev=500349&r1=500348&r2=500349
==============================================================================
--- incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/io/BlockingByteArrayInputStream.h (original)
+++ incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/io/BlockingByteArrayInputStream.h Fri Jan 26 13:11:34 2007
@@ -67,7 +67,7 @@
* @see setByteArray.
*/
BlockingByteArrayInputStream( const unsigned char* buffer,
- int bufferSize );
+ std::size_t bufferSize );
/**
* Destructor
@@ -83,7 +83,7 @@
* @param bufferSize The size of the new buffer.
*/
virtual void setByteArray( const unsigned char* buffer,
- int bufferSize );
+ std::size_t bufferSize );
/**
* Waits on a signal from this object, which is generated
@@ -151,7 +151,7 @@
* @return the data available in the internal buffer.
* @throws IOException if an error occurs.
*/
- virtual int available() const throw (IOException){
+ virtual std::size_t available() const throw (IOException){
return std::distance( pos, buffer.end() );
}
@@ -174,7 +174,7 @@
* @return the number of bytes read.
* @throws IOException f an error occurs.
*/
- virtual int read( unsigned char* buffer, int bufferSize )
+ virtual std::size_t read( unsigned char* buffer, std::size_t bufferSize )
throw (IOException);
/**
@@ -199,7 +199,8 @@
* @returns total butes skipped
* @throws IOException if an error occurs
*/
- virtual int skip( int num ) throw ( io::IOException, exceptions::UnsupportedOperationException );
+ virtual std::size_t skip( std::size_t num )
+ throw ( io::IOException, exceptions::UnsupportedOperationException );
};
Modified: incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/io/BufferedInputStream.cpp
URL: http://svn.apache.org/viewvc/incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/io/BufferedInputStream.cpp?view=diff&rev=500349&r1=500348&r2=500349
==============================================================================
--- incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/io/BufferedInputStream.cpp (original)
+++ incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/io/BufferedInputStream.cpp Fri Jan 26 13:11:34 2007
@@ -33,7 +33,7 @@
////////////////////////////////////////////////////////////////////////////////
BufferedInputStream::BufferedInputStream( InputStream* stream,
- unsigned int bufferSize,
+ std::size_t bufferSize,
bool own )
: FilterInputStream( stream, own )
{
@@ -51,7 +51,7 @@
}
////////////////////////////////////////////////////////////////////////////////
-void BufferedInputStream::init( unsigned int bufferSize ){
+void BufferedInputStream::init( std::size_t bufferSize ){
this->bufferSize = bufferSize;
@@ -85,8 +85,8 @@
}
////////////////////////////////////////////////////////////////////////////////
-int BufferedInputStream::read( unsigned char* targetBuffer,
- int targetBufferSize ) throw ( IOException ){
+std::size_t BufferedInputStream::read( unsigned char* targetBuffer,
+ std::size_t targetBufferSize ) throw ( IOException ){
try{
// If there's no data left, reset to pointers to the beginning of the
@@ -96,11 +96,11 @@
// If we still haven't filled the output buffer AND there is data
// on the input stream to be read, read a buffer's
// worth from the stream.
- int totalRead = 0;
+ std::size_t totalRead = 0;
while( totalRead < targetBufferSize ){
// Get the remaining bytes to copy.
- int bytesToCopy = min( tail-head, (targetBufferSize-totalRead) );
+ std::size_t bytesToCopy = min( tail-head, (targetBufferSize-totalRead) );
// Copy the data to the output buffer.
memcpy( targetBuffer+totalRead, this->buffer+head, bytesToCopy );
@@ -132,7 +132,7 @@
}
////////////////////////////////////////////////////////////////////////////////
-int BufferedInputStream::skip( int num )
+std::size_t BufferedInputStream::skip( std::size_t num )
throw ( IOException, exceptions::UnsupportedOperationException ){
try{
@@ -141,11 +141,11 @@
normalizeBuffer();
// loop until we've skipped the desired number of bytes
- int totalSkipped = 0;
+ std::size_t totalSkipped = 0;
while( totalSkipped < num ){
// Get the remaining bytes to copy.
- int bytesToSkip = min( tail-head, num-totalSkipped );
+ std::size_t bytesToSkip = min( tail-head, num-totalSkipped );
// Increment the head position.
head += bytesToSkip;
@@ -181,13 +181,13 @@
// Get the number of bytes currently available on the input stream
// that could be read without blocking.
- int available = inputStream->available();
+ std::size_t available = inputStream->available();
// Calculate the number of bytes that we can read. Always >= 1 byte!
- int bytesToRead = max( 1, min( available, getUnusedBytes() ) );
+ std::size_t bytesToRead = max( (std::size_t)1, min( available, getUnusedBytes() ) );
// Read the bytes from the input stream.
- int bytesRead = inputStream->read( getTail(), bytesToRead );
+ std::size_t bytesRead = inputStream->read( getTail(), bytesToRead );
if( bytesRead == 0 ){
throw IOException( __FILE__, __LINE__,
"BufferedInputStream::read() - failed reading bytes from stream");
Modified: incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/io/BufferedInputStream.h
URL: http://svn.apache.org/viewvc/incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/io/BufferedInputStream.h?view=diff&rev=500349&r1=500348&r2=500349
==============================================================================
--- incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/io/BufferedInputStream.h (original)
+++ incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/io/BufferedInputStream.h Fri Jan 26 13:11:34 2007
@@ -42,17 +42,17 @@
/**
* The buffer size.
*/
- unsigned int bufferSize;
+ std::size_t bufferSize;
/**
* The current head of the buffer.
*/
- int head;
+ std::size_t head;
/**
* The current tail of the buffer.
*/
- int tail;
+ std::size_t tail;
public:
@@ -70,7 +70,7 @@
* @param own indicates if we own the stream object, defaults to false.
*/
BufferedInputStream( InputStream* stream,
- unsigned int bufferSize,
+ std::size_t bufferSize,
bool own = false);
virtual ~BufferedInputStream();
@@ -81,7 +81,7 @@
* in the buffer and the data available on the target
* input stream.
*/
- virtual int available() const throw ( IOException ) {
+ virtual std::size_t available() const throw ( IOException ) {
return ( tail - head ) + inputStream->available();
}
@@ -101,7 +101,7 @@
* @return The number of bytes read.
* @throws IOException thrown if an error occurs.
*/
- virtual int read( unsigned char* buffer, int bufferSize )
+ virtual std::size_t read( unsigned char* buffer, std::size_t bufferSize )
throw ( IOException );
/**
@@ -120,7 +120,8 @@
* @returns total butes skipped
* @throws IOException if an error occurs
*/
- virtual int skip( int num ) throw ( io::IOException, exceptions::UnsupportedOperationException );
+ virtual std::size_t skip( std::size_t num )
+ throw ( io::IOException, exceptions::UnsupportedOperationException );
private:
@@ -128,7 +129,7 @@
* Initializes the internal structures.
* @param size of buffer to allocate
*/
- void init( unsigned int bufferSize );
+ void init( std::size_t bufferSize );
/**
* Populates the buffer with as much data as possible
@@ -141,7 +142,7 @@
* Returns the number of bytes that are currently unused
* in the buffer.
*/
- int getUnusedBytes() const{
+ std::size_t getUnusedBytes() const{
return bufferSize - tail;
}
Modified: incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/io/BufferedOutputStream.cpp
URL: http://svn.apache.org/viewvc/incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/io/BufferedOutputStream.cpp?view=diff&rev=500349&r1=500348&r2=500349
==============================================================================
--- incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/io/BufferedOutputStream.cpp (original)
+++ incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/io/BufferedOutputStream.cpp Fri Jan 26 13:11:34 2007
@@ -31,7 +31,7 @@
////////////////////////////////////////////////////////////////////////////////
BufferedOutputStream::BufferedOutputStream( OutputStream* stream,
- unsigned int bufSize,
+ std::size_t bufSize,
bool own )
: FilterOutputStream( stream, own )
{
@@ -49,7 +49,7 @@
}
////////////////////////////////////////////////////////////////////////////////
-void BufferedOutputStream::init( unsigned int bufSize ){
+void BufferedOutputStream::init( std::size_t bufSize ){
this->bufferSize = bufSize;
@@ -97,18 +97,18 @@
}
////////////////////////////////////////////////////////////////////////////////
-void BufferedOutputStream::write( const unsigned char* buffer, const int len )
+void BufferedOutputStream::write( const unsigned char* buffer, std::size_t len )
throw ( IOException )
{
// Iterate until all the data is written.
- for( int pos=0; pos < len; ){
+ for( std::size_t pos=0; pos < len; ){
if( tail >= (int)bufferSize ){
emptyBuffer();
}
// Get the number of bytes left to write.
- int bytesToWrite = min( (int)bufferSize-tail, len-pos );
+ std::size_t bytesToWrite = min( (int)bufferSize-tail, len-pos );
// Copy the data.
memcpy( this->buffer+tail, buffer+pos, bytesToWrite );
Modified: incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/io/BufferedOutputStream.h
URL: http://svn.apache.org/viewvc/incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/io/BufferedOutputStream.h?view=diff&rev=500349&r1=500348&r2=500349
==============================================================================
--- incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/io/BufferedOutputStream.h (original)
+++ incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/io/BufferedOutputStream.h Fri Jan 26 13:11:34 2007
@@ -40,17 +40,17 @@
/**
* The size of the internal buffer.
*/
- unsigned int bufferSize;
+ std::size_t bufferSize;
/**
* The current head of the buffer.
*/
- int head;
+ std::size_t head;
/**
* The current tail of the buffer.
*/
- int tail;
+ std::size_t tail;
public:
@@ -66,7 +66,7 @@
* @param bufSize the size for the internal buffer.
*/
BufferedOutputStream( OutputStream* stream,
- unsigned int bufSize,
+ std::size_t bufSize,
bool own = false);
virtual ~BufferedOutputStream();
@@ -84,7 +84,8 @@
* @param len The number of bytes from the buffer to be written.
* @throws IOException thrown if an error occurs.
*/
- virtual void write( const unsigned char* buffer, int len ) throw ( IOException );
+ virtual void write( const unsigned char* buffer, std::size_t len )
+ throw ( IOException );
/**
* Invokes flush on the target output stream.
@@ -103,7 +104,7 @@
/**
* Initializes the internal structures.
*/
- void init( unsigned int bufSize );
+ void init( std::size_t bufSize );
/**
* Writes the contents of the buffer to the output stream.
Modified: incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/io/ByteArrayInputStream.cpp
URL: http://svn.apache.org/viewvc/incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/io/ByteArrayInputStream.cpp?view=diff&rev=500349&r1=500348&r2=500349
==============================================================================
--- incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/io/ByteArrayInputStream.cpp (original)
+++ incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/io/ByteArrayInputStream.cpp Fri Jan 26 13:11:34 2007
@@ -34,7 +34,7 @@
////////////////////////////////////////////////////////////////////////////////
ByteArrayInputStream::ByteArrayInputStream( const unsigned char* buffer,
- int bufferSize ){
+ std::size_t bufferSize ){
setByteArray( buffer, bufferSize );
}
@@ -54,7 +54,7 @@
////////////////////////////////////////////////////////////////////////////////
void ByteArrayInputStream::setByteArray( const unsigned char* lbuffer,
- int lbufferSize ){
+ std::size_t lbufferSize ){
// We're using the default buffer.
activeBuffer = &defaultBuffer;
@@ -62,7 +62,7 @@
defaultBuffer.clear();
// Copy data to internal buffer.
- for( int ix = 0; ix < lbufferSize; ++ix )
+ for( std::size_t ix = 0; ix < lbufferSize; ++ix )
{
defaultBuffer.push_back(lbuffer[ix]);
}
@@ -91,10 +91,10 @@
}
////////////////////////////////////////////////////////////////////////////////
-int ByteArrayInputStream::read( unsigned char* buffer,
- int bufferSize )
+std::size_t ByteArrayInputStream::read( unsigned char* buffer,
+ std::size_t bufferSize )
throw ( IOException ){
- int ix = 0;
+ std::size_t ix = 0;
for( ; ix < bufferSize; ++ix, ++pos)
{
@@ -111,10 +111,10 @@
}
////////////////////////////////////////////////////////////////////////////////
-int ByteArrayInputStream::skip( int num )
+std::size_t ByteArrayInputStream::skip( std::size_t num )
throw ( IOException, exceptions::UnsupportedOperationException ){
- int ix = 0;
+ std::size_t ix = 0;
// Increment the position until we've skipped the desired number
// or we've hit the end of the buffer.
Modified: incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/io/ByteArrayInputStream.h
URL: http://svn.apache.org/viewvc/incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/io/ByteArrayInputStream.h?view=diff&rev=500349&r1=500348&r2=500349
==============================================================================
--- incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/io/ByteArrayInputStream.h (original)
+++ incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/io/ByteArrayInputStream.h Fri Jan 26 13:11:34 2007
@@ -74,7 +74,7 @@
* @param bufferSize the size of the buffer
*/
ByteArrayInputStream( const unsigned char* buffer,
- int bufferSize );
+ std::size_t bufferSize );
virtual ~ByteArrayInputStream();
@@ -96,7 +96,7 @@
* @param bufferSize the size of the buffer
*/
virtual void setByteArray( const unsigned char* buffer,
- int bufferSize );
+ std::size_t bufferSize );
/**
* Waits on a signal from this object, which is generated
@@ -163,7 +163,7 @@
* Indcates the number of bytes avaialable.
* @return The number of bytes until the end of the internal buffer.
*/
- virtual int available() const throw (IOException) {
+ virtual std::size_t available() const throw (IOException) {
if( activeBuffer == NULL ){
throw IOException( __FILE__, __LINE__, "buffer has not been initialized");
}
@@ -185,7 +185,7 @@
* @return The number of bytes read.
* @throws IOException thrown if an error occurs.
*/
- virtual int read( unsigned char* buffer, int bufferSize )
+ virtual std::size_t read( unsigned char* buffer, std::size_t bufferSize )
throw (IOException);
/**
@@ -216,7 +216,8 @@
* @returns total butes skipped
* @throws IOException if an error occurs
*/
- virtual int skip( int num ) throw ( io::IOException, exceptions::UnsupportedOperationException );
+ virtual std::size_t skip( std::size_t num )
+ throw ( io::IOException, exceptions::UnsupportedOperationException );
};
Modified: incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/io/ByteArrayOutputStream.cpp
URL: http://svn.apache.org/viewvc/incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/io/ByteArrayOutputStream.cpp?view=diff&rev=500349&r1=500348&r2=500349
==============================================================================
--- incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/io/ByteArrayOutputStream.cpp (original)
+++ incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/io/ByteArrayOutputStream.cpp Fri Jan 26 13:11:34 2007
@@ -55,11 +55,11 @@
////////////////////////////////////////////////////////////////////////////////
void ByteArrayOutputStream::write( const unsigned char* buffer,
- const int len )
+ std::size_t len )
throw ( IOException )
{
// Iterate until all the data is written.
- for( int ix = 0; ix < len; ++ix)
+ for( std::size_t ix = 0; ix < len; ++ix)
{
activeBuffer->push_back( buffer[ix] );
}
Modified: incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/io/ByteArrayOutputStream.h
URL: http://svn.apache.org/viewvc/incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/io/ByteArrayOutputStream.h?view=diff&rev=500349&r1=500348&r2=500349
==============================================================================
--- incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/io/ByteArrayOutputStream.h (original)
+++ incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/io/ByteArrayOutputStream.h Fri Jan 26 13:11:34 2007
@@ -87,7 +87,7 @@
* Get the Size of the Internal Buffer
* @return size of the internal buffer
*/
- virtual int getByteArraySize() const {
+ virtual std::size_t getByteArraySize() const {
return activeBuffer->size();
}
@@ -165,7 +165,7 @@
* @param len The number of bytes from the buffer to be written.
* @throws IOException thrown if an error occurs.
*/
- virtual void write( const unsigned char* buffer, int len )
+ virtual void write( const unsigned char* buffer, std::size_t len )
throw ( IOException );
/**
Modified: incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/io/DataInputStream.cpp
URL: http://svn.apache.org/viewvc/incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/io/DataInputStream.cpp?view=diff&rev=500349&r1=500348&r2=500349
==============================================================================
--- incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/io/DataInputStream.cpp (original)
+++ incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/io/DataInputStream.cpp Fri Jan 26 13:11:34 2007
@@ -32,7 +32,7 @@
DataInputStream::~DataInputStream() {}
////////////////////////////////////////////////////////////////////////////////
-int DataInputStream::read( std::vector<unsigned char>& buffer )
+std::size_t DataInputStream::read( std::vector<unsigned char>& buffer )
throw ( io::IOException ) {
try {
@@ -43,23 +43,21 @@
}
////////////////////////////////////////////////////////////////////////////////
-int DataInputStream::read( unsigned char* buffer, int offset, int length )
- throw ( io::IOException, exceptions::IndexOutOfBoundsException, exceptions::NullPointerException ) {
-
- if( length < 0 || offset < 0 ) {
- throw IndexOutOfBoundsException(
- __FILE__, __LINE__,
- "DataInputStream::read - len or offset params invalid" );
- }
-
- if( buffer == NULL ) {
- throw NullPointerException(
- __FILE__, __LINE__,
- "DataInputStream::read - Buffer is null" );
- }
+std::size_t DataInputStream::read( unsigned char* buffer,
+ std::size_t offset,
+ std::size_t length )
+ throw ( io::IOException, exceptions::IndexOutOfBoundsException,
+ exceptions::NullPointerException ) {
try {
- int read = 0;
+
+ if( buffer == NULL ) {
+ throw NullPointerException(
+ __FILE__, __LINE__,
+ "DataInputStream::read - Buffer is null" );
+ }
+
+ std::size_t read = 0;
try {
read = inputStream->read( &buffer[offset], length );
@@ -76,6 +74,7 @@
return read;
}
+ AMQ_CATCH_RETHROW( NullPointerException )
AMQ_CATCH_RETHROW( IOException )
AMQ_CATCHALL_THROW( IOException )
}
@@ -284,14 +283,15 @@
}
////////////////////////////////////////////////////////////////////////////////
-void DataInputStream::readFully( unsigned char* buffer, int offset, int length )
- throw ( io::IOException, io::EOFException, exceptions::IndexOutOfBoundsException, exceptions::NullPointerException ) {
+void DataInputStream::readFully( unsigned char* buffer,
+ std::size_t offset,
+ std::size_t length )
+ throw ( io::IOException,
+ io::EOFException,
+ exceptions::IndexOutOfBoundsException,
+ exceptions::NullPointerException )
+{
try {
- if( length < 0 || offset < 0 ) {
- throw IndexOutOfBoundsException(
- __FILE__, __LINE__,
- "DataInputStream::readFully - Len or Offset were invalid" );
- }
if( buffer == NULL ) {
throw NullPointerException(
@@ -299,10 +299,10 @@
"DataInputStream::read - Buffer is null" );
}
- int n = 0;
+ std::size_t n = 0;
while( n < length ) {
- int count = inputStream->read( &buffer[offset + n], length - n );
- if( count < 0 ) {
+ std::size_t count = inputStream->read( &buffer[offset + n], (length - n) );
+ if( count == -1 ) {
throw EOFException(
__FILE__, __LINE__,
"DataInputStream::readFully - Reached EOF" );
@@ -310,19 +310,20 @@
n += count;
}
}
+ AMQ_CATCH_RETHROW( NullPointerException )
AMQ_CATCH_RETHROW( IOException )
AMQ_CATCHALL_THROW( IOException )
}
////////////////////////////////////////////////////////////////////////////////
-int DataInputStream::skip( int num )
+std::size_t DataInputStream::skip( std::size_t num )
throw( io::IOException, exceptions::UnsupportedOperationException ) {
try {
- int total = 0;
- int cur = 0;
+ std::size_t total = 0;
+ std::size_t cur = 0;
while( ( total < num ) &&
- ( ( cur = (int)inputStream->skip( num-total ) ) > 0 ) ) {
+ ( ( cur = inputStream->skip( num-total ) ) > 0 ) ) {
total += cur;
}
Modified: incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/io/DataInputStream.h
URL: http://svn.apache.org/viewvc/incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/io/DataInputStream.h?view=diff&rev=500349&r1=500348&r2=500349
==============================================================================
--- incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/io/DataInputStream.h (original)
+++ incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/io/DataInputStream.h Fri Jan 26 13:11:34 2007
@@ -86,7 +86,7 @@
* more data because the stream is EOF.
* @throws IOException
*/
- virtual int read( std::vector< unsigned char >& buffer )
+ virtual std::size_t read( std::vector< unsigned char >& buffer )
throw ( io::IOException );
/**
@@ -130,8 +130,12 @@
* more data because the stream is EOF.
* @throws IOException
*/
- virtual int read( unsigned char* buffer, int offset, int length )
- throw ( io::IOException, exceptions::IndexOutOfBoundsException, exceptions::NullPointerException );
+ virtual std::size_t read( unsigned char* buffer,
+ std::size_t offset,
+ std::size_t length )
+ throw ( io::IOException,
+ exceptions::IndexOutOfBoundsException,
+ exceptions::NullPointerException );
/**
* Reads one input byte and returns true if that byte is nonzero,
@@ -320,8 +324,13 @@
* @throws IOException
* @throws EOFException
*/
- virtual void readFully( unsigned char* buffer, int offset, int length )
- throw ( io::IOException, io::EOFException, exceptions::IndexOutOfBoundsException, exceptions::NullPointerException );
+ virtual void readFully( unsigned char* buffer,
+ std::size_t offset,
+ std::size_t length )
+ throw ( io::IOException,
+ io::EOFException,
+ exceptions::IndexOutOfBoundsException,
+ exceptions::NullPointerException );
/**
* Makes an attempt to skip over n bytes of data from the input
@@ -334,7 +343,9 @@
* @param num - number of bytes to skip
* @return the total number of bytes skipped
*/
- virtual int skip( int num ) throw( io::IOException, exceptions::UnsupportedOperationException );
+ virtual std::size_t skip( std::size_t num )
+ throw( io::IOException,
+ exceptions::UnsupportedOperationException );
};
Modified: incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/io/DataOutputStream.cpp
URL: http://svn.apache.org/viewvc/incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/io/DataOutputStream.cpp?view=diff&rev=500349&r1=500348&r2=500349
==============================================================================
--- incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/io/DataOutputStream.cpp (original)
+++ incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/io/DataOutputStream.cpp Fri Jan 26 13:11:34 2007
@@ -64,7 +64,7 @@
}
////////////////////////////////////////////////////////////////////////////////
-void DataOutputStream::write( const unsigned char* buffer, int len )
+void DataOutputStream::write( const unsigned char* buffer, std::size_t len )
throw ( IOException ) {
try {
@@ -75,8 +75,10 @@
}
////////////////////////////////////////////////////////////////////////////////
-void DataOutputStream::write( const unsigned char* buffer, int offset, int len )
- throw ( IOException ) {
+void DataOutputStream::write( const unsigned char* buffer,
+ std::size_t offset,
+ std::size_t len ) throw ( IOException )
+{
try {
outputStream->write( buffer+offset, len );
@@ -116,7 +118,9 @@
}
////////////////////////////////////////////////////////////////////////////////
-void DataOutputStream::writeUnsignedShort( unsigned short value ) throw ( IOException ) {
+void DataOutputStream::writeUnsignedShort( unsigned short value )
+ throw ( IOException )
+{
try {
write( (unsigned char)( (value & 0xFF00) >> 8 ) );
write( (unsigned char)( (value & 0x00FF) >> 0 ) );
@@ -205,7 +209,7 @@
////////////////////////////////////////////////////////////////////////////////
void DataOutputStream::writeUTF( const std::string& value ) throw ( IOException ) {
try {
- this->writeUnsignedShort( value.length() );
+ this->writeUnsignedShort( (unsigned short)value.length() );
this->write( (const unsigned char*)value.c_str(), value.length() );
}
AMQ_CATCH_RETHROW( IOException )
Modified: incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/io/DataOutputStream.h
URL: http://svn.apache.org/viewvc/incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/io/DataOutputStream.h?view=diff&rev=500349&r1=500348&r2=500349
==============================================================================
--- incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/io/DataOutputStream.h (original)
+++ incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/io/DataOutputStream.h Fri Jan 26 13:11:34 2007
@@ -33,7 +33,7 @@
protected:
// The number of bytes written to the data output stream so far.
- unsigned int written;
+ std::size_t written;
public:
@@ -53,7 +53,7 @@
* overflows, it will be wrapped to Integer.MAX_VALUE.
* @return the value of the written field.
*/
- virtual unsigned int size() const {
+ virtual std::size_t size() const {
return written;
}
@@ -72,7 +72,7 @@
* @param len The number of bytes from the buffer to be written.
* @throws IOException thrown if an error occurs.
*/
- virtual void write( const unsigned char* buffer, int len )
+ virtual void write( const unsigned char* buffer, std::size_t len )
throw ( IOException );
/**
@@ -82,8 +82,9 @@
* @param len The number of bytes from the buffer to be written.
* @throws IOException thrown if an error occurs.
*/
- virtual void write( const unsigned char* buffer, int offset, int len )
- throw ( IOException );
+ virtual void write( const unsigned char* buffer,
+ std::size_t offset,
+ std::size_t len ) throw ( IOException );
/**
* Writes an array of bytes to the output stream.
Modified: incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/io/FilterInputStream.h
URL: http://svn.apache.org/viewvc/incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/io/FilterInputStream.h?view=diff&rev=500349&r1=500348&r2=500349
==============================================================================
--- incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/io/FilterInputStream.h (original)
+++ incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/io/FilterInputStream.h Fri Jan 26 13:11:34 2007
@@ -73,7 +73,7 @@
* returns the result.
* @return the number of bytes available without blocking.
*/
- virtual int available() const throw ( IOException ) {
+ virtual std::size_t available() const throw ( IOException ) {
try {
return inputStream->available();
}
@@ -108,7 +108,7 @@
* @return The number of bytes read or -1 if EOS is detected
* @throws IOException thrown if an error occurs.
*/
- virtual int read( unsigned char* buffer, int bufferSize )
+ virtual std::size_t read( unsigned char* buffer, std::size_t bufferSize )
throw ( IOException )
{
try {
Modified: incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/io/FilterOutputStream.h
URL: http://svn.apache.org/viewvc/incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/io/FilterOutputStream.h?view=diff&rev=500349&r1=500348&r2=500349
==============================================================================
--- incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/io/FilterOutputStream.h (original)
+++ incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/io/FilterOutputStream.h Fri Jan 26 13:11:34 2007
@@ -100,9 +100,9 @@
* @param len The number of bytes from the buffer to be written.
* @throws IOException thrown if an error occurs.
*/
- virtual void write( const unsigned char* buffer, int len ) throw ( IOException ) {
+ virtual void write( const unsigned char* buffer, std::size_t len ) throw ( IOException ) {
try {
- for( int ix = 0; ix < len; ++ix )
+ for( std::size_t ix = 0; ix < len; ++ix )
{
outputStream->write( buffer[ix] );
}
Modified: incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/io/InputStream.h
URL: http://svn.apache.org/viewvc/incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/io/InputStream.h?view=diff&rev=500349&r1=500348&r2=500349
==============================================================================
--- incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/io/InputStream.h (original)
+++ incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/io/InputStream.h Fri Jan 26 13:11:34 2007
@@ -44,7 +44,7 @@
* @return the number of bytes available on this input stream.
* @throws IOException if an error occurs.
*/
- virtual int available() const throw ( IOException ) = 0;
+ virtual std::size_t available() const throw ( IOException ) = 0;
/**
* Reads a single byte from the buffer. Blocks until
@@ -62,7 +62,7 @@
* @return The number of bytes read or -1 if EOF is detected
* @throws IOException thrown if an error occurs.
*/
- virtual int read( unsigned char* buffer, int bufferSize )
+ virtual std::size_t read( unsigned char* buffer, std::size_t bufferSize )
throw ( IOException ) = 0;
/**
@@ -81,7 +81,7 @@
* @returns total butes skipped
* @throws IOException if an error occurs
*/
- virtual int skip( int num ) throw ( io::IOException, exceptions::UnsupportedOperationException ) = 0;
+ virtual std::size_t skip( std::size_t num ) throw ( io::IOException, exceptions::UnsupportedOperationException ) = 0;
};
Modified: incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/io/OutputStream.h
URL: http://svn.apache.org/viewvc/incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/io/OutputStream.h?view=diff&rev=500349&r1=500348&r2=500349
==============================================================================
--- incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/io/OutputStream.h (original)
+++ incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/io/OutputStream.h Fri Jan 26 13:11:34 2007
@@ -50,7 +50,7 @@
* @param len The number of bytes from the buffer to be written.
* @throws IOException thrown if an error occurs.
*/
- virtual void write( const unsigned char* buffer, int len )
+ virtual void write( const unsigned char* buffer, std::size_t len )
throw ( IOException ) = 0;
/**
Modified: incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/io/Reader.h
URL: http://svn.apache.org/viewvc/incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/io/Reader.h?view=diff&rev=500349&r1=500348&r2=500349
==============================================================================
--- incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/io/Reader.h (original)
+++ incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/io/Reader.h Fri Jan 26 13:11:34 2007
@@ -51,7 +51,7 @@
* @return The number of bytes read.
* @throws IOException thrown if an error occurs.
*/
- virtual int read( unsigned char* buffer, int count )
+ virtual std::size_t read( unsigned char* buffer, std::size_t count )
throw( IOException ) = 0;
/**
Modified: incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/io/Writer.h
URL: http://svn.apache.org/viewvc/incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/io/Writer.h?view=diff&rev=500349&r1=500348&r2=500349
==============================================================================
--- incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/io/Writer.h (original)
+++ incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/io/Writer.h Fri Jan 26 13:11:34 2007
@@ -52,7 +52,8 @@
* @param count the number of bytes in the array to write.
* @throws IOException thrown if an error occurs.
*/
- virtual void write( const unsigned char* buffer, int count ) throw( IOException ) = 0;
+ virtual void write( const unsigned char* buffer,
+ std::size_t count ) throw( IOException ) = 0;
/**
* Writes a byte to the output stream.
Modified: incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/network/BufferedSocket.cpp
URL: http://svn.apache.org/viewvc/incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/network/BufferedSocket.cpp?view=diff&rev=500349&r1=500348&r2=500349
==============================================================================
--- incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/network/BufferedSocket.cpp (original)
+++ incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/network/BufferedSocket.cpp Fri Jan 26 13:11:34 2007
@@ -26,10 +26,20 @@
////////////////////////////////////////////////////////////////////////////////
BufferedSocket::BufferedSocket( Socket* socket,
- unsigned int inputBufferSize,
- unsigned int outputBufferSize,
+ int inputBufferSize,
+ int outputBufferSize,
bool own )
{
+ if(inputBufferSize < 0 || outputBufferSize < 0 )
+ {
+ throw IllegalArgumentException(
+ __FILE__, __LINE__,
+ "BufferedSocket::BufferedSocket - buffer sizes must be >=0! "
+ "Given input buffer size: %d, Given output buffer size: %d",
+ inputBufferSize,
+ outputBufferSize );
+ }
+
if(socket == NULL)
{
throw IllegalArgumentException(
@@ -44,7 +54,7 @@
}
////////////////////////////////////////////////////////////////////////////////
-BufferedSocket::~BufferedSocket(void)
+BufferedSocket::~BufferedSocket()
{
try
{
@@ -72,7 +82,7 @@
}
////////////////////////////////////////////////////////////////////////////////
-void BufferedSocket::connect( const char* host, const int port )
+void BufferedSocket::connect( const char* host, int port )
throw( SocketException )
{
try
@@ -88,9 +98,9 @@
// Now create the buffered streams that wrap around the socket.
inputStream = new BufferedInputStream(
- socket->getInputStream(), inputBufferSize );
+ socket->getInputStream(), (std::size_t)inputBufferSize );
outputStream = new BufferedOutputStream(
- socket->getOutputStream(), outputBufferSize );
+ socket->getOutputStream(), (std::size_t)outputBufferSize );
}
AMQ_CATCH_RETHROW( SocketException )
AMQ_CATCH_EXCEPTION_CONVERT( ActiveMQException, SocketException )
@@ -98,7 +108,7 @@
}
////////////////////////////////////////////////////////////////////////////////
-void BufferedSocket::close(void) throw( cms::CMSException )
+void BufferedSocket::close() throw( cms::CMSException )
{
try
{
Modified: incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/network/BufferedSocket.h
URL: http://svn.apache.org/viewvc/incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/network/BufferedSocket.h?view=diff&rev=500349&r1=500348&r2=500349
==============================================================================
--- incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/network/BufferedSocket.h (original)
+++ incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/network/BufferedSocket.h Fri Jan 26 13:11:34 2007
@@ -48,8 +48,8 @@
io::BufferedOutputStream* outputStream;
// Sizes for the Buffered Streams
- unsigned int inputBufferSize;
- unsigned int outputBufferSize;
+ int inputBufferSize;
+ int outputBufferSize;
public:
@@ -61,11 +61,11 @@
* @param own does this object own the passed socket
*/
BufferedSocket( Socket* socket,
- unsigned int inputBufferSize = 1000,
- unsigned int outputBufferSize = 1000,
+ int inputBufferSize = 1000,
+ int outputBufferSize = 1000,
bool own = true );
- virtual ~BufferedSocket(void);
+ virtual ~BufferedSocket();
/**
* Connects to the specified destination. Closes this socket if
@@ -74,7 +74,7 @@
* @param port The port of the server to connect to.
* @throws IOException Thrown if a failure occurred in the connect.
*/
- virtual void connect( const char* host, const int port )
+ virtual void connect( const char* host, int port )
throw( SocketException );
/**
@@ -121,7 +121,7 @@
* @param linger The linger time in seconds. If 0, linger is off.
* @throws SocketException if the operation fails.
*/
- virtual void setSoLinger( const int linger ) throw( SocketException ){
+ virtual void setSoLinger( int linger ) throw( SocketException ){
socket->setSoLinger( linger );
}
@@ -139,7 +139,7 @@
* @param keepAlive If true, enables the flag.
* @throws SocketException if the operation fails.
*/
- virtual void setKeepAlive( const bool keepAlive ) throw( SocketException ){
+ virtual void setKeepAlive( bool keepAlive ) throw( SocketException ){
socket->setKeepAlive( keepAlive );
}
@@ -157,7 +157,7 @@
* @param size Number of bytes to set the receive buffer to.
* @throws SocketException if the operation fails.
*/
- virtual void setReceiveBufferSize( const int size ) throw( SocketException ){
+ virtual void setReceiveBufferSize( int size ) throw( SocketException ){
socket->setReceiveBufferSize( size );
}
@@ -175,7 +175,7 @@
* @param reuse If true, sets the flag.
* @throws SocketException if the operation fails.
*/
- virtual void setReuseAddress( const bool reuse ) throw( SocketException ){
+ virtual void setReuseAddress( bool reuse ) throw( SocketException ){
socket->setReuseAddress( reuse );
}
@@ -193,7 +193,7 @@
* @param size The number of bytes to set the send buffer to.
* @throws SocketException if the operation fails.
*/
- virtual void setSendBufferSize( const int size ) throw( SocketException ){
+ virtual void setSendBufferSize( int size ) throw( SocketException ){
socket->setSendBufferSize( size );
}
@@ -211,7 +211,7 @@
* @param timeout The timeout in milliseconds for socket operations.<p>
* @throws SocketException Thrown if unable to set the information.
*/
- virtual void setSoTimeout( const int timeout ) throw( SocketException ){
+ virtual void setSoTimeout( int timeout ) throw( SocketException ){
socket->setSoTimeout( timeout );
}