activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tab...@apache.org
Subject svn commit: r925692 [1/14] - in /activemq/activemq-cpp/trunk/activemq-cpp/src: main/ main/activemq/commands/ main/activemq/io/ main/activemq/wireformat/openwire/ main/activemq/wireformat/openwire/marshal/ main/decaf/internal/io/ main/decaf/internal/nio...
Date Sat, 20 Mar 2010 21:57:24 GMT
Author: tabish
Date: Sat Mar 20 21:57:20 2010
New Revision: 925692

URL: http://svn.apache.org/viewvc?rev=925692&view=rev
Log:
API refactoring and documentation cleanup.  Add more tests that cause exceptions to check for memory leaks during exceptions cleanup.

Removed:
    activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/nio/ByteArrayPerspective.cpp
    activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/nio/ByteArrayPerspective.h
    activemq/activemq-cpp/trunk/activemq-cpp/src/test/decaf/internal/nio/ByteArrayPerspectiveTest.cpp
    activemq/activemq-cpp/trunk/activemq-cpp/src/test/decaf/internal/nio/ByteArrayPerspectiveTest.h
Modified:
    activemq/activemq-cpp/trunk/activemq-cpp/src/main/Makefile.am
    activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/commands/ActiveMQBytesMessage.cpp
    activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/io/LoggingInputStream.cpp
    activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/io/LoggingInputStream.h
    activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/io/LoggingOutputStream.cpp
    activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/io/LoggingOutputStream.h
    activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/wireformat/openwire/OpenWireFormat.cpp
    activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/wireformat/openwire/marshal/PrimitiveTypesMarshaller.cpp
    activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/io/StandardErrorOutputStream.cpp
    activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/io/StandardErrorOutputStream.h
    activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/io/StandardInputStream.cpp
    activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/io/StandardInputStream.h
    activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/io/StandardOutputStream.cpp
    activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/io/StandardOutputStream.h
    activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/nio/BufferFactory.cpp
    activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/nio/BufferFactory.h
    activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/nio/ByteArrayBuffer.cpp
    activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/nio/ByteArrayBuffer.h
    activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/nio/CharArrayBuffer.cpp
    activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/nio/CharArrayBuffer.h
    activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/nio/DoubleArrayBuffer.cpp
    activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/nio/DoubleArrayBuffer.h
    activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/nio/FloatArrayBuffer.cpp
    activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/nio/FloatArrayBuffer.h
    activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/nio/IntArrayBuffer.cpp
    activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/nio/IntArrayBuffer.h
    activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/nio/LongArrayBuffer.cpp
    activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/nio/LongArrayBuffer.h
    activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/nio/ShortArrayBuffer.cpp
    activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/nio/ShortArrayBuffer.h
    activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/util/ByteArrayAdapter.cpp
    activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/util/ByteArrayAdapter.h
    activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/io/BlockingByteArrayInputStream.cpp
    activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/io/BlockingByteArrayInputStream.h
    activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/io/BufferedInputStream.cpp
    activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/io/BufferedInputStream.h
    activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/io/BufferedOutputStream.cpp
    activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/io/BufferedOutputStream.h
    activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/io/ByteArrayInputStream.cpp
    activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/io/ByteArrayInputStream.h
    activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/io/ByteArrayOutputStream.cpp
    activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/io/ByteArrayOutputStream.h
    activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/io/DataInput.h
    activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/io/DataInputStream.cpp
    activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/io/DataInputStream.h
    activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/io/DataOutputStream.cpp
    activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/io/DataOutputStream.h
    activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/io/FilterInputStream.cpp
    activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/io/FilterInputStream.h
    activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/io/FilterOutputStream.cpp
    activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/io/FilterOutputStream.h
    activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/io/InputStream.cpp
    activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/io/InputStream.h
    activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/io/InputStreamReader.cpp
    activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/io/InputStreamReader.h
    activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/io/OutputStream.cpp
    activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/io/OutputStream.h
    activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/io/OutputStreamWriter.cpp
    activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/io/OutputStreamWriter.h
    activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/io/PushbackInputStream.cpp
    activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/io/PushbackInputStream.h
    activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/io/Reader.cpp
    activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/io/Reader.h
    activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/io/Writer.cpp
    activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/io/Writer.h
    activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/lang/Appendable.h
    activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/lang/CharSequence.h
    activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/lang/String.cpp
    activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/lang/String.h
    activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/net/BufferedSocket.cpp
    activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/net/SocketInputStream.cpp
    activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/net/SocketInputStream.h
    activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/net/SocketOutputStream.cpp
    activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/net/SocketOutputStream.h
    activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/nio/Buffer.cpp
    activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/nio/Buffer.h
    activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/nio/ByteBuffer.cpp
    activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/nio/ByteBuffer.h
    activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/nio/CharBuffer.cpp
    activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/nio/CharBuffer.h
    activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/nio/DoubleBuffer.cpp
    activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/nio/DoubleBuffer.h
    activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/nio/FloatBuffer.cpp
    activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/nio/FloatBuffer.h
    activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/nio/IntBuffer.cpp
    activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/nio/IntBuffer.h
    activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/nio/LongBuffer.cpp
    activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/nio/LongBuffer.h
    activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/nio/ShortBuffer.cpp
    activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/nio/ShortBuffer.h
    activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/zip/Adler32.cpp
    activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/zip/Adler32.h
    activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/zip/CRC32.cpp
    activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/zip/CRC32.h
    activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/zip/CheckedInputStream.cpp
    activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/zip/CheckedInputStream.h
    activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/zip/CheckedOutputStream.cpp
    activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/zip/CheckedOutputStream.h
    activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/zip/Checksum.h
    activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/zip/Deflater.cpp
    activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/zip/Deflater.h
    activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/zip/DeflaterOutputStream.cpp
    activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/zip/DeflaterOutputStream.h
    activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/zip/Inflater.cpp
    activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/zip/Inflater.h
    activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/zip/InflaterInputStream.cpp
    activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/zip/InflaterInputStream.h
    activemq/activemq-cpp/trunk/activemq-cpp/src/test-integration/activemq/test/openwire/OpenwireTempDestinationTest.cpp
    activemq/activemq-cpp/trunk/activemq-cpp/src/test/Makefile.am
    activemq/activemq-cpp/trunk/activemq-cpp/src/test/decaf/internal/nio/BufferFactoryTest.cpp
    activemq/activemq-cpp/trunk/activemq-cpp/src/test/decaf/internal/nio/ByteArrayBufferTest.cpp
    activemq/activemq-cpp/trunk/activemq-cpp/src/test/decaf/internal/nio/ByteArrayBufferTest.h
    activemq/activemq-cpp/trunk/activemq-cpp/src/test/decaf/internal/nio/CharArrayBufferTest.cpp
    activemq/activemq-cpp/trunk/activemq-cpp/src/test/decaf/internal/nio/CharArrayBufferTest.h
    activemq/activemq-cpp/trunk/activemq-cpp/src/test/decaf/internal/nio/DoubleArrayBufferTest.cpp
    activemq/activemq-cpp/trunk/activemq-cpp/src/test/decaf/internal/nio/DoubleArrayBufferTest.h
    activemq/activemq-cpp/trunk/activemq-cpp/src/test/decaf/internal/nio/FloatArrayBufferTest.cpp
    activemq/activemq-cpp/trunk/activemq-cpp/src/test/decaf/internal/nio/FloatArrayBufferTest.h
    activemq/activemq-cpp/trunk/activemq-cpp/src/test/decaf/internal/nio/IntArrayBufferTest.cpp
    activemq/activemq-cpp/trunk/activemq-cpp/src/test/decaf/internal/nio/IntArrayBufferTest.h
    activemq/activemq-cpp/trunk/activemq-cpp/src/test/decaf/internal/nio/LongArrayBufferTest.cpp
    activemq/activemq-cpp/trunk/activemq-cpp/src/test/decaf/internal/nio/LongArrayBufferTest.h
    activemq/activemq-cpp/trunk/activemq-cpp/src/test/decaf/internal/nio/ShortArrayBufferTest.cpp
    activemq/activemq-cpp/trunk/activemq-cpp/src/test/decaf/internal/nio/ShortArrayBufferTest.h
    activemq/activemq-cpp/trunk/activemq-cpp/src/test/decaf/internal/util/ByteArrayAdapterTest.cpp
    activemq/activemq-cpp/trunk/activemq-cpp/src/test/decaf/internal/util/ByteArrayAdapterTest.h
    activemq/activemq-cpp/trunk/activemq-cpp/src/test/decaf/io/BufferedInputStreamTest.cpp
    activemq/activemq-cpp/trunk/activemq-cpp/src/test/decaf/io/BufferedOutputStreamTest.cpp
    activemq/activemq-cpp/trunk/activemq-cpp/src/test/decaf/io/ByteArrayInputStreamTest.cpp
    activemq/activemq-cpp/trunk/activemq-cpp/src/test/decaf/io/DataInputStreamTest.cpp
    activemq/activemq-cpp/trunk/activemq-cpp/src/test/decaf/io/DataOutputStreamTest.cpp
    activemq/activemq-cpp/trunk/activemq-cpp/src/test/decaf/io/FilterInputStreamTest.cpp
    activemq/activemq-cpp/trunk/activemq-cpp/src/test/decaf/io/FilterOutputStreamTest.cpp
    activemq/activemq-cpp/trunk/activemq-cpp/src/test/decaf/io/PushbackInputStreamTest.cpp
    activemq/activemq-cpp/trunk/activemq-cpp/src/test/decaf/io/ReaderTest.cpp
    activemq/activemq-cpp/trunk/activemq-cpp/src/test/decaf/io/WriterTest.cpp
    activemq/activemq-cpp/trunk/activemq-cpp/src/test/decaf/nio/BufferTest.cpp
    activemq/activemq-cpp/trunk/activemq-cpp/src/test/decaf/nio/BufferTest.h
    activemq/activemq-cpp/trunk/activemq-cpp/src/test/decaf/util/zip/CheckedInputStreamTest.cpp
    activemq/activemq-cpp/trunk/activemq-cpp/src/test/decaf/util/zip/DeflaterOutputStreamTest.cpp
    activemq/activemq-cpp/trunk/activemq-cpp/src/test/decaf/util/zip/InflaterInputStreamTest.cpp
    activemq/activemq-cpp/trunk/activemq-cpp/src/test/decaf/util/zip/InflaterTest.cpp
    activemq/activemq-cpp/trunk/activemq-cpp/src/test/testRegistry.cpp

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/Makefile.am
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/Makefile.am?rev=925692&r1=925691&r2=925692&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/Makefile.am (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/Makefile.am Sat Mar 20 21:57:20 2010
@@ -486,7 +486,6 @@ cc_sources = \
     decaf/internal/net/URIHelper.cpp \
     decaf/internal/nio/BufferFactory.cpp \
     decaf/internal/nio/ByteArrayBuffer.cpp \
-    decaf/internal/nio/ByteArrayPerspective.cpp \
     decaf/internal/nio/CharArrayBuffer.cpp \
     decaf/internal/nio/DoubleArrayBuffer.cpp \
     decaf/internal/nio/FloatArrayBuffer.cpp \
@@ -1138,7 +1137,6 @@ h_sources = \
     decaf/internal/net/URIType.h \
     decaf/internal/nio/BufferFactory.h \
     decaf/internal/nio/ByteArrayBuffer.h \
-    decaf/internal/nio/ByteArrayPerspective.h \
     decaf/internal/nio/CharArrayBuffer.h \
     decaf/internal/nio/DoubleArrayBuffer.h \
     decaf/internal/nio/FloatArrayBuffer.h \

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/commands/ActiveMQBytesMessage.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/commands/ActiveMQBytesMessage.cpp?rev=925692&r1=925691&r2=925692&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/commands/ActiveMQBytesMessage.cpp (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/commands/ActiveMQBytesMessage.cpp Sat Mar 20 21:57:20 2010
@@ -142,7 +142,7 @@ void ActiveMQBytesMessage::setBodyBytes(
     try{
 
         initializeWriting();
-        dataOut->write( buffer, numBytes, 0, numBytes );
+        dataOut->write( buffer, (int)numBytes, 0, (int)numBytes );
     }
     AMQ_CATCH_ALL_THROW_CMSEXCEPTION()
 }
@@ -286,7 +286,7 @@ void ActiveMQBytesMessage::writeBytes( c
 
     initializeWriting();
     try{
-        this->dataOut->write( value );
+        this->dataOut->write( &value[0], (int)value.size() );
     } catch( EOFException& ex ) {
         throw CMSExceptionSupport::createMessageEOFException( ex );
     } catch( Exception& ex ) {

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/io/LoggingInputStream.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/io/LoggingInputStream.cpp?rev=925692&r1=925691&r2=925692&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/io/LoggingInputStream.cpp (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/io/LoggingInputStream.cpp Sat Mar 20 21:57:20 2010
@@ -48,8 +48,8 @@ int LoggingInputStream::doReadByte() thr
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-int LoggingInputStream::doReadArrayBounded( unsigned char* buffer, std::size_t size,
-                                            std::size_t offset, std::size_t length )
+int LoggingInputStream::doReadArrayBounded( unsigned char* buffer, int size,
+                                            int offset, int length )
     throw ( decaf::io::IOException,
             decaf::lang::exceptions::IndexOutOfBoundsException,
             decaf::lang::exceptions::NullPointerException ) {
@@ -72,7 +72,7 @@ int LoggingInputStream::doReadArrayBound
                 "Given size{%d} - offset{%d} is less than length{%d}.", size, offset, length );
         }
 
-        std::size_t numRead = FilterInputStream::doReadArrayBounded( buffer, size, offset, length );
+        int numRead = FilterInputStream::doReadArrayBounded( buffer, size, offset, length );
 
         log( buffer, numRead );
 
@@ -85,16 +85,16 @@ int LoggingInputStream::doReadArrayBound
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-void LoggingInputStream::log( const unsigned char* buffer, size_t len ) {
+void LoggingInputStream::log( const unsigned char* buffer, int len ) {
 
     ostringstream ostream;
 
     ostream << "TCP Trace: Reading: " << endl << "[";
 
-    for( size_t ix=0; ix<len; ++ix ){
-        ostream << setw(2) << setfill('0') << std::hex << (int)buffer[ix];
+    for( int ix = 0; ix < len; ++ix ) {
+        ostream << setw( 2 ) << setfill( '0' ) << std::hex << (int)buffer[ix];
 
-        if( ((ix+1) % 2) == 0 ){
+        if( ( ( ix + 1 ) % 2 ) == 0 ) {
             ostream << ' ';
         }
     }

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/io/LoggingInputStream.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/io/LoggingInputStream.h?rev=925692&r1=925691&r2=925692&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/io/LoggingInputStream.h (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/io/LoggingInputStream.h Sat Mar 20 21:57:20 2010
@@ -48,8 +48,7 @@ namespace io{
 
         virtual int doReadByte() throw ( decaf::io::IOException );
 
-        virtual int doReadArrayBounded( unsigned char* buffer, std::size_t size,
-                                        std::size_t offset, std::size_t length )
+        virtual int doReadArrayBounded( unsigned char* buffer, int size, int offset, int length )
             throw ( decaf::io::IOException,
                     decaf::lang::exceptions::IndexOutOfBoundsException,
                     decaf::lang::exceptions::NullPointerException );
@@ -59,7 +58,7 @@ namespace io{
         /**
          * Logs the data in the buffer.
          */
-        void log( const unsigned char* buffer, std::size_t len );
+        void log( const unsigned char* buffer, int len );
 
     };
 

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/io/LoggingOutputStream.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/io/LoggingOutputStream.cpp?rev=925692&r1=925691&r2=925692&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/io/LoggingOutputStream.cpp (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/io/LoggingOutputStream.cpp Sat Mar 20 21:57:20 2010
@@ -47,8 +47,8 @@ void LoggingOutputStream::doWriteByte( c
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-void LoggingOutputStream::doWriteArrayBounded( const unsigned char* buffer, std::size_t size,
-                                               std::size_t offset, std::size_t length )
+void LoggingOutputStream::doWriteArrayBounded( const unsigned char* buffer, int size,
+                                               int offset, int length )
     throw ( decaf::io::IOException,
             decaf::lang::exceptions::NullPointerException,
             decaf::lang::exceptions::IndexOutOfBoundsException ) {
@@ -82,16 +82,16 @@ void LoggingOutputStream::doWriteArrayBo
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-void LoggingOutputStream::log( const unsigned char* buffer, size_t len ) {
+void LoggingOutputStream::log( const unsigned char* buffer, int len ) {
 
     // Write the buffer as hex to a string stream.
     ostringstream ostream;
     ostream << "TCP Trace: Writing:" << endl << '[';
 
-    for( size_t ix=0; ix<len; ++ix ){
-        ostream << setw(2) << setfill('0') << std::hex << (int)buffer[ix];
+    for( int ix = 0; ix < len; ++ix ) {
+        ostream << setw( 2 ) << setfill( '0' ) << std::hex << (int)buffer[ix];
 
-        if( ((ix+1) % 2) == 0 ){
+        if( ( ( ix + 1 ) % 2 ) == 0 ) {
             ostream << ' ';
         }
     }

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/io/LoggingOutputStream.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/io/LoggingOutputStream.h?rev=925692&r1=925691&r2=925692&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/io/LoggingOutputStream.h (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/io/LoggingOutputStream.h Sat Mar 20 21:57:20 2010
@@ -53,8 +53,7 @@ namespace io{
 
         virtual void doWriteByte( unsigned char c ) throw ( decaf::io::IOException );
 
-        virtual void doWriteArrayBounded( const unsigned char* buffer, std::size_t size,
-                                          std::size_t offset, std::size_t length )
+        virtual void doWriteArrayBounded( const unsigned char* buffer, int size, int offset, int length )
             throw ( decaf::io::IOException,
                     decaf::lang::exceptions::NullPointerException,
                     decaf::lang::exceptions::IndexOutOfBoundsException );
@@ -64,7 +63,7 @@ namespace io{
         /**
          * Logs the data in the buffer.
          */
-        void log( const unsigned char* buffer, std::size_t len );
+        void log( const unsigned char* buffer, int len );
 
     };
 

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/wireformat/openwire/OpenWireFormat.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/wireformat/openwire/OpenWireFormat.cpp?rev=925692&r1=925691&r2=925692&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/wireformat/openwire/OpenWireFormat.cpp (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/wireformat/openwire/OpenWireFormat.cpp Sat Mar 20 21:57:20 2010
@@ -412,7 +412,7 @@ void OpenWireFormat::tightMarshalNestedO
 
             MarshalAware* ma = dynamic_cast< MarshalAware* >( o );
             vector<unsigned char> sequence = ma->getMarshaledForm( this );
-            ds->write( sequence );
+            ds->write( &sequence[0], (int)sequence.size() );
 
         } else {
 

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/wireformat/openwire/marshal/PrimitiveTypesMarshaller.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/wireformat/openwire/marshal/PrimitiveTypesMarshaller.cpp?rev=925692&r1=925691&r2=925692&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/wireformat/openwire/marshal/PrimitiveTypesMarshaller.cpp (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/wireformat/openwire/marshal/PrimitiveTypesMarshaller.cpp Sat Mar 20 21:57:20 2010
@@ -274,7 +274,7 @@ void PrimitiveTypesMarshaller::marshalPr
             std::vector<unsigned char> data = value.getByteArray();
 
             dataOut.writeInt( (int)data.size() );
-            dataOut.write( data );
+            dataOut.write( &data[0], (int)data.size() );
 
         } else if( value.getType() == PrimitiveValueNode::STRING_TYPE ) {
 

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/io/StandardErrorOutputStream.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/io/StandardErrorOutputStream.cpp?rev=925692&r1=925691&r2=925692&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/io/StandardErrorOutputStream.cpp (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/io/StandardErrorOutputStream.cpp Sat Mar 20 21:57:20 2010
@@ -17,11 +17,9 @@
 
 #include "StandardErrorOutputStream.h"
 
-#include <apr.h>
-#include <apr_general.h>
-#include <apr_pools.h>
-
 using namespace decaf;
+using namespace decaf::lang;
+using namespace decaf::lang::exceptions;
 using namespace decaf::internal;
 using namespace decaf::internal::io;
 
@@ -41,8 +39,8 @@ void StandardErrorOutputStream::doWriteB
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-void StandardErrorOutputStream::doWriteArrayBounded( const unsigned char* buffer, std::size_t size,
-                                                     std::size_t offset, std::size_t length )
+void StandardErrorOutputStream::doWriteArrayBounded( const unsigned char* buffer, int size,
+                                                     int offset, int length )
     throw ( decaf::io::IOException,
             decaf::lang::exceptions::NullPointerException,
             decaf::lang::exceptions::IndexOutOfBoundsException ) {
@@ -57,13 +55,22 @@ void StandardErrorOutputStream::doWriteA
             "StandardErrorOutputStream::write - Passed buffer is null." );
     }
 
-    if( ( offset + length ) > size ) {
-        throw decaf::lang::exceptions::IndexOutOfBoundsException(
-            __FILE__, __LINE__,
-            "StandardErrorOutputStream::write - given offset + length is greater than buffer size.");
+    if( size < 0 ) {
+        throw IndexOutOfBoundsException(
+            __FILE__, __LINE__, "size parameter out of Bounds: %d.", size );
+    }
+
+    if( offset > size || offset < 0 ) {
+        throw IndexOutOfBoundsException(
+            __FILE__, __LINE__, "offset parameter out of Bounds: %d.", offset );
+    }
+
+    if( length < 0 || length > size - offset ) {
+        throw IndexOutOfBoundsException(
+            __FILE__, __LINE__, "length parameter out of Bounds: %d.", length );
     }
 
-    for( std::size_t i = 0; i < length; ++i ) {
+    for( int i = 0; i < length; ++i ) {
         std::cerr << buffer[i+offset];
     }
 }

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/io/StandardErrorOutputStream.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/io/StandardErrorOutputStream.h?rev=925692&r1=925691&r2=925692&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/io/StandardErrorOutputStream.h (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/io/StandardErrorOutputStream.h Sat Mar 20 21:57:20 2010
@@ -36,24 +36,15 @@ namespace io{
 
         virtual ~StandardErrorOutputStream();
 
-        /**
-         * Invokes flush on the target output stream.
-         * throws decaf::io::IOException if an error occurs
-         */
         virtual void flush() throw ( decaf::io::IOException );
 
-        /**
-         * Invokes close on the target output stream.
-         * throws IOException if an error occurs
-         */
         virtual void close() throw( decaf::io::IOException );
 
     protected:
 
         virtual void doWriteByte( unsigned char value ) throw ( decaf::io::IOException );
 
-        virtual void doWriteArrayBounded( const unsigned char* buffer, std::size_t size,
-                                          std::size_t offset, std::size_t length )
+        virtual void doWriteArrayBounded( const unsigned char* buffer, int size, int offset, int length )
             throw ( decaf::io::IOException,
                     decaf::lang::exceptions::NullPointerException,
                     decaf::lang::exceptions::IndexOutOfBoundsException );

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/io/StandardInputStream.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/io/StandardInputStream.cpp?rev=925692&r1=925691&r2=925692&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/io/StandardInputStream.cpp (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/io/StandardInputStream.cpp Sat Mar 20 21:57:20 2010
@@ -19,10 +19,6 @@
 
 #include <iostream>
 
-#include <apr.h>
-#include <apr_general.h>
-#include <apr_pools.h>
-
 using namespace std;
 using namespace decaf;
 using namespace decaf::lang;
@@ -39,7 +35,7 @@ StandardInputStream::~StandardInputStrea
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-std::size_t StandardInputStream::available() const throw ( decaf::io::IOException ) {
+int StandardInputStream::available() const throw ( decaf::io::IOException ) {
     return 1;
 }
 

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/io/StandardInputStream.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/io/StandardInputStream.h?rev=925692&r1=925691&r2=925692&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/io/StandardInputStream.h (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/io/StandardInputStream.h Sat Mar 20 21:57:20 2010
@@ -32,11 +32,7 @@ namespace io {
 
         virtual ~StandardInputStream();
 
-        /**
-         * Indicates the number of bytes available.
-         * @return The number of bytes until the end of the internal buffer.
-         */
-        virtual std::size_t available() const throw ( decaf::io::IOException );
+        virtual int available() const throw ( decaf::io::IOException );
 
     protected:
 

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/io/StandardOutputStream.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/io/StandardOutputStream.cpp?rev=925692&r1=925691&r2=925692&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/io/StandardOutputStream.cpp (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/io/StandardOutputStream.cpp Sat Mar 20 21:57:20 2010
@@ -17,11 +17,9 @@
 
 #include "StandardOutputStream.h"
 
-#include <apr.h>
-#include <apr_general.h>
-#include <apr_pools.h>
-
 using namespace decaf;
+using namespace decaf::lang;
+using namespace decaf::lang::exceptions;
 using namespace decaf::internal;
 using namespace decaf::internal::io;
 
@@ -41,8 +39,8 @@ void StandardOutputStream::doWriteByte( 
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-void StandardOutputStream::doWriteArrayBounded( const unsigned char* buffer, std::size_t size,
-                                                     std::size_t offset, std::size_t length )
+void StandardOutputStream::doWriteArrayBounded( const unsigned char* buffer, int size,
+                                                int offset, int length )
     throw ( decaf::io::IOException,
             decaf::lang::exceptions::NullPointerException,
             decaf::lang::exceptions::IndexOutOfBoundsException ) {
@@ -57,13 +55,22 @@ void StandardOutputStream::doWriteArrayB
             "StandardErrorOutputStream::write - Passed buffer is null." );
     }
 
-    if( ( offset + length ) > size ) {
-        throw decaf::lang::exceptions::IndexOutOfBoundsException(
-            __FILE__, __LINE__,
-            "StandardErrorOutputStream::write - given offset + length is greater than buffer size.");
+    if( size < 0 ) {
+        throw IndexOutOfBoundsException(
+            __FILE__, __LINE__, "size parameter out of Bounds: %d.", size );
+    }
+
+    if( offset > size || offset < 0 ) {
+        throw IndexOutOfBoundsException(
+            __FILE__, __LINE__, "offset parameter out of Bounds: %d.", offset );
+    }
+
+    if( length < 0 || length > size - offset ) {
+        throw IndexOutOfBoundsException(
+            __FILE__, __LINE__, "length parameter out of Bounds: %d.", length );
     }
 
-    for( std::size_t i = 0; i < length; ++i ) {
+    for( int i = 0; i < length; ++i ) {
         std::cout << buffer[i+offset];
     }
 }

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/io/StandardOutputStream.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/io/StandardOutputStream.h?rev=925692&r1=925691&r2=925692&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/io/StandardOutputStream.h (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/io/StandardOutputStream.h Sat Mar 20 21:57:20 2010
@@ -32,24 +32,15 @@ namespace io {
 
         virtual ~StandardOutputStream();
 
-        /**
-         * Invokes flush on the target output stream.
-         * throws IOException if an error occurs
-         */
         virtual void flush() throw ( decaf::io::IOException );
 
-        /**
-         * Invokes close on the target output stream.
-         * throws IOException if an error occurs
-         */
         virtual void close() throw( decaf::io::IOException );
 
     protected:
 
         virtual void doWriteByte( unsigned char value ) throw ( decaf::io::IOException );
 
-        virtual void doWriteArrayBounded( const unsigned char* buffer, std::size_t size,
-                                          std::size_t offset, std::size_t length )
+        virtual void doWriteArrayBounded( const unsigned char* buffer, int size, int offset, int length )
             throw ( decaf::io::IOException,
                     decaf::lang::exceptions::NullPointerException,
                     decaf::lang::exceptions::IndexOutOfBoundsException );

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/nio/BufferFactory.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/nio/BufferFactory.cpp?rev=925692&r1=925691&r2=925692&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/nio/BufferFactory.cpp (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/nio/BufferFactory.cpp Sat Mar 20 21:57:20 2010
@@ -33,25 +33,26 @@ using namespace decaf::lang;
 using namespace decaf::lang::exceptions;
 
 ////////////////////////////////////////////////////////////////////////////////
-ByteBuffer* BufferFactory::createByteBuffer( std::size_t capacity ) {
+ByteBuffer* BufferFactory::createByteBuffer( int capacity )
+    throw( decaf::lang::exceptions::IndexOutOfBoundsException ) {
 
     try{
         return new ByteArrayBuffer( capacity );
     }
-    DECAF_CATCH_RETHROW( Exception )
-    DECAF_CATCHALL_THROW( Exception )
+    DECAF_CATCH_RETHROW( IndexOutOfBoundsException )
+    DECAF_CATCHALL_THROW( IndexOutOfBoundsException )
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-ByteBuffer* BufferFactory::createByteBuffer( unsigned char* buffer,
-                                             std::size_t offset,
-                                             std::size_t length )
-    throw( lang::exceptions::NullPointerException ) {
+ByteBuffer* BufferFactory::createByteBuffer( unsigned char* buffer, int size, int offset, int length )
+    throw( decaf::lang::exceptions::NullPointerException,
+           decaf::lang::exceptions::IndexOutOfBoundsException ) {
 
     try{
-        return new ByteArrayBuffer( buffer, offset, length, false );
+        return new ByteArrayBuffer( buffer, size, offset, length, false );
     }
     DECAF_CATCH_RETHROW( NullPointerException )
+    DECAF_CATCH_RETHROW( IndexOutOfBoundsException )
     DECAF_CATCH_EXCEPTION_CONVERT( Exception, NullPointerException )
     DECAF_CATCHALL_THROW( NullPointerException )
 }
@@ -60,32 +61,33 @@ ByteBuffer* BufferFactory::createByteBuf
 ByteBuffer* BufferFactory::createByteBuffer( std::vector<unsigned char>& buffer ) {
 
     try{
-        return new ByteArrayBuffer( &buffer[0], 0, buffer.size(), false );
+        return new ByteArrayBuffer( &buffer[0], (int)buffer.size(), 0, (int)buffer.size(), false );
     }
     DECAF_CATCH_RETHROW( Exception )
     DECAF_CATCHALL_THROW( Exception )
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-CharBuffer* BufferFactory::createCharBuffer( std::size_t capacity ) {
+CharBuffer* BufferFactory::createCharBuffer( int capacity )
+    throw( decaf::lang::exceptions::IndexOutOfBoundsException ) {
 
     try{
         return new CharArrayBuffer( capacity );
     }
-    DECAF_CATCH_RETHROW( Exception )
-    DECAF_CATCHALL_THROW( Exception )
+    DECAF_CATCH_RETHROW( IndexOutOfBoundsException )
+    DECAF_CATCHALL_THROW( IndexOutOfBoundsException )
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-CharBuffer* BufferFactory::createCharBuffer( char* buffer,
-                                             std::size_t offset,
-                                             std::size_t length )
-    throw( lang::exceptions::NullPointerException ) {
+CharBuffer* BufferFactory::createCharBuffer( char* buffer, int size, int offset, int length )
+    throw( decaf::lang::exceptions::NullPointerException,
+           decaf::lang::exceptions::IndexOutOfBoundsException ) {
 
     try{
-        return new CharArrayBuffer( buffer, offset, length, false );
+        return new CharArrayBuffer( buffer, size, offset, length, false );
     }
     DECAF_CATCH_RETHROW( NullPointerException )
+    DECAF_CATCH_RETHROW( IndexOutOfBoundsException )
     DECAF_CATCH_EXCEPTION_CONVERT( Exception, NullPointerException )
     DECAF_CATCHALL_THROW( NullPointerException )
 }
@@ -94,32 +96,33 @@ CharBuffer* BufferFactory::createCharBuf
 CharBuffer* BufferFactory::createCharBuffer( std::vector<char>& buffer ) {
 
     try{
-        return new CharArrayBuffer( &buffer[0], 0, buffer.size(), false );
+        return new CharArrayBuffer( &buffer[0], (int)buffer.size(), 0, (int)buffer.size(), false );
     }
     DECAF_CATCH_RETHROW( Exception )
     DECAF_CATCHALL_THROW( Exception )
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-DoubleBuffer* BufferFactory::createDoubleBuffer( std::size_t capacity ) {
+DoubleBuffer* BufferFactory::createDoubleBuffer( int capacity )
+    throw( decaf::lang::exceptions::IndexOutOfBoundsException ) {
 
     try{
         return new DoubleArrayBuffer( capacity );
     }
-    DECAF_CATCH_RETHROW( Exception )
-    DECAF_CATCHALL_THROW( Exception )
+    DECAF_CATCH_RETHROW( IndexOutOfBoundsException )
+    DECAF_CATCHALL_THROW( IndexOutOfBoundsException )
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-DoubleBuffer* BufferFactory::createDoubleBuffer( double* buffer,
-                                                 std::size_t offset,
-                                                 std::size_t length )
-    throw( lang::exceptions::NullPointerException ) {
+DoubleBuffer* BufferFactory::createDoubleBuffer( double* buffer, int size, int offset, int length )
+    throw( decaf::lang::exceptions::NullPointerException,
+           decaf::lang::exceptions::IndexOutOfBoundsException ) {
 
     try{
-        return new DoubleArrayBuffer( buffer, offset, length, false );
+        return new DoubleArrayBuffer( buffer, size, offset, length, false );
     }
     DECAF_CATCH_RETHROW( NullPointerException )
+    DECAF_CATCH_RETHROW( IndexOutOfBoundsException )
     DECAF_CATCH_EXCEPTION_CONVERT( Exception, NullPointerException )
     DECAF_CATCHALL_THROW( NullPointerException )
 }
@@ -128,32 +131,33 @@ DoubleBuffer* BufferFactory::createDoubl
 DoubleBuffer* BufferFactory::createDoubleBuffer( std::vector<double>& buffer ) {
 
     try{
-        return new DoubleArrayBuffer( &buffer[0], 0, buffer.size(), false );
+        return new DoubleArrayBuffer( &buffer[0], (int)buffer.size(), 0, (int)buffer.size(), false );
     }
     DECAF_CATCH_RETHROW( Exception )
     DECAF_CATCHALL_THROW( Exception )
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-FloatBuffer* BufferFactory::createFloatBuffer( std::size_t capacity ) {
+FloatBuffer* BufferFactory::createFloatBuffer( int capacity )
+    throw( decaf::lang::exceptions::IndexOutOfBoundsException ) {
 
     try{
         return new FloatArrayBuffer( capacity );
     }
-    DECAF_CATCH_RETHROW( Exception )
-    DECAF_CATCHALL_THROW( Exception )
+    DECAF_CATCH_RETHROW( IndexOutOfBoundsException )
+    DECAF_CATCHALL_THROW( IndexOutOfBoundsException )
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-FloatBuffer* BufferFactory::createFloatBuffer( float* buffer,
-                                               std::size_t offset,
-                                               std::size_t length )
-    throw( lang::exceptions::NullPointerException ) {
+FloatBuffer* BufferFactory::createFloatBuffer( float* buffer, int size, int offset, int length )
+    throw( decaf::lang::exceptions::NullPointerException,
+           decaf::lang::exceptions::IndexOutOfBoundsException ) {
 
     try{
-        return new FloatArrayBuffer( buffer, offset, length, false );
+        return new FloatArrayBuffer( buffer, size, offset, length, false );
     }
     DECAF_CATCH_RETHROW( NullPointerException )
+    DECAF_CATCH_RETHROW( IndexOutOfBoundsException )
     DECAF_CATCH_EXCEPTION_CONVERT( Exception, NullPointerException )
     DECAF_CATCHALL_THROW( NullPointerException )
 }
@@ -162,32 +166,33 @@ FloatBuffer* BufferFactory::createFloatB
 FloatBuffer* BufferFactory::createFloatBuffer( std::vector<float>& buffer ) {
 
     try{
-        return new FloatArrayBuffer( &buffer[0], 0, buffer.size(), false );
+        return new FloatArrayBuffer( &buffer[0], (int)buffer.size(), 0, (int)buffer.size(), false );
     }
     DECAF_CATCH_RETHROW( Exception )
     DECAF_CATCHALL_THROW( Exception )
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-LongBuffer* BufferFactory::createLongBuffer( std::size_t capacity ) {
+LongBuffer* BufferFactory::createLongBuffer( int capacity )
+    throw( decaf::lang::exceptions::IndexOutOfBoundsException ) {
 
     try{
         return new LongArrayBuffer( capacity );
     }
-    DECAF_CATCH_RETHROW( Exception )
-    DECAF_CATCHALL_THROW( Exception )
+    DECAF_CATCH_RETHROW( IndexOutOfBoundsException )
+    DECAF_CATCHALL_THROW( IndexOutOfBoundsException )
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-LongBuffer* BufferFactory::createLongBuffer( long long* buffer,
-                                             std::size_t offset,
-                                             std::size_t length )
-    throw( lang::exceptions::NullPointerException ) {
+LongBuffer* BufferFactory::createLongBuffer( long long* buffer, int size,  int offset, int length )
+    throw( decaf::lang::exceptions::NullPointerException,
+           decaf::lang::exceptions::IndexOutOfBoundsException ) {
 
     try{
-        return new LongArrayBuffer( buffer, offset, length, false );
+        return new LongArrayBuffer( buffer, size, offset, length, false );
     }
     DECAF_CATCH_RETHROW( NullPointerException )
+    DECAF_CATCH_RETHROW( IndexOutOfBoundsException )
     DECAF_CATCH_EXCEPTION_CONVERT( Exception, NullPointerException )
     DECAF_CATCHALL_THROW( NullPointerException )
 }
@@ -196,32 +201,33 @@ LongBuffer* BufferFactory::createLongBuf
 LongBuffer* BufferFactory::createLongBuffer( std::vector<long long>& buffer ) {
 
     try{
-        return new LongArrayBuffer( &buffer[0], 0, buffer.size(), false );
+        return new LongArrayBuffer( &buffer[0], (int)buffer.size(), 0, (int)buffer.size(), false );
     }
     DECAF_CATCH_RETHROW( Exception )
     DECAF_CATCHALL_THROW( Exception )
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-IntBuffer* BufferFactory::createIntBuffer( std::size_t capacity ) {
+IntBuffer* BufferFactory::createIntBuffer( int capacity )
+    throw( decaf::lang::exceptions::IndexOutOfBoundsException ) {
 
     try{
         return new IntArrayBuffer( capacity );
     }
-    DECAF_CATCH_RETHROW( Exception )
-    DECAF_CATCHALL_THROW( Exception )
+    DECAF_CATCH_RETHROW( IndexOutOfBoundsException )
+    DECAF_CATCHALL_THROW( IndexOutOfBoundsException )
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-IntBuffer* BufferFactory::createIntBuffer( int* buffer,
-                                           std::size_t offset,
-                                           std::size_t length )
-    throw( lang::exceptions::NullPointerException ) {
+IntBuffer* BufferFactory::createIntBuffer( int* buffer, int size, int offset, int length )
+    throw( decaf::lang::exceptions::NullPointerException,
+           decaf::lang::exceptions::IndexOutOfBoundsException ) {
 
     try{
-        return new IntArrayBuffer( buffer, offset, length, false );
+        return new IntArrayBuffer( buffer, size, offset, length, false );
     }
     DECAF_CATCH_RETHROW( NullPointerException )
+    DECAF_CATCH_RETHROW( IndexOutOfBoundsException )
     DECAF_CATCH_EXCEPTION_CONVERT( Exception, NullPointerException )
     DECAF_CATCHALL_THROW( NullPointerException )
 }
@@ -230,32 +236,33 @@ IntBuffer* BufferFactory::createIntBuffe
 IntBuffer* BufferFactory::createIntBuffer( std::vector<int>& buffer ) {
 
     try{
-        return new IntArrayBuffer( &buffer[0], 0, buffer.size(), false );
+        return new IntArrayBuffer( &buffer[0], (int)buffer.size(), 0, (int)buffer.size(), false );
     }
     DECAF_CATCH_RETHROW( Exception )
     DECAF_CATCHALL_THROW( Exception )
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-ShortBuffer* BufferFactory::createShortBuffer( std::size_t capacity ) {
+ShortBuffer* BufferFactory::createShortBuffer( int capacity )
+    throw( decaf::lang::exceptions::IndexOutOfBoundsException ) {
 
     try{
         return new ShortArrayBuffer( capacity );
     }
-    DECAF_CATCH_RETHROW( Exception )
-    DECAF_CATCHALL_THROW( Exception )
+    DECAF_CATCH_RETHROW( IndexOutOfBoundsException )
+    DECAF_CATCHALL_THROW( IndexOutOfBoundsException )
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-ShortBuffer* BufferFactory::createShortBuffer( short* buffer,
-                                               std::size_t offset,
-                                               std::size_t length )
-    throw( lang::exceptions::NullPointerException ) {
+ShortBuffer* BufferFactory::createShortBuffer( short* buffer, int size, int offset, int length )
+    throw( decaf::lang::exceptions::NullPointerException,
+           decaf::lang::exceptions::IndexOutOfBoundsException ) {
 
     try{
-        return new ShortArrayBuffer( buffer, offset, length, false );
+        return new ShortArrayBuffer( buffer, size, offset, length, false );
     }
     DECAF_CATCH_RETHROW( NullPointerException )
+    DECAF_CATCH_RETHROW( IndexOutOfBoundsException )
     DECAF_CATCH_EXCEPTION_CONVERT( Exception, NullPointerException )
     DECAF_CATCHALL_THROW( NullPointerException )
 }
@@ -264,7 +271,7 @@ ShortBuffer* BufferFactory::createShortB
 ShortBuffer* BufferFactory::createShortBuffer( std::vector<short>& buffer ) {
 
     try{
-        return new ShortArrayBuffer( &buffer[0], 0, buffer.size(), false );
+        return new ShortArrayBuffer( &buffer[0], (int)buffer.size(), 0, (int)buffer.size(), false );
     }
     DECAF_CATCH_RETHROW( Exception )
     DECAF_CATCHALL_THROW( Exception )

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/nio/BufferFactory.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/nio/BufferFactory.h?rev=925692&r1=925691&r2=925692&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/nio/BufferFactory.h (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/nio/BufferFactory.h Sat Mar 20 21:57:20 2010
@@ -26,6 +26,8 @@
 #include <decaf/nio/IntBuffer.h>
 #include <decaf/nio/ShortBuffer.h>
 
+#include <decaf/lang/exceptions/IndexOutOfBoundsException.h>
+
 namespace decaf{
 namespace internal{
 namespace nio{
@@ -33,6 +35,8 @@ namespace nio{
     /**
      * Factory class used by static methods in the decaf::nio package to
      * create the various default version of the NIO interfaces.
+     *
+     * @since 1.0
      */
     class DECAF_API BufferFactory {
     public:
@@ -42,39 +46,58 @@ namespace nio{
         /**
          * Allocates a new byte buffer whose position will be zero its limit will
          * be its capacity and its mark is not set.
-         * @param capacity - the internal buffer's capacity.
+         *
+         * @param capacity
+         *      The internal buffer's capacity.
+         *
          * @returns a newly allocated ByteBuffer which the caller owns.
+         *
+         * @throws IndexOutOfBoundsException if the capacity specified is negative.
          */
-        static decaf::nio::ByteBuffer* createByteBuffer( std::size_t capacity );
+        static decaf::nio::ByteBuffer* createByteBuffer( int capacity )
+            throw( decaf::lang::exceptions::IndexOutOfBoundsException );
 
         /**
          * Wraps the passed buffer with a new ByteBuffer.
-         * <p>
+         *
          * The new buffer will be backed by the given byte array; that is, modifications
          * to the buffer will cause the array to be modified and vice versa. The new
-         * buffer's capacity will be array.length, its position will be offset, its limit
+         * buffer's capacity will be array length, its position will be offset, its limit
          * will be offset + length, and its mark will be undefined. Its backing array
          * will be the given array, and its array offset will be zero.
-         * @param buffer - The array that will back the new buffer
-         * @param offset - The offset of the subarray to be used
-         * @param length - The length of the subarray to be used
-         * @returns a new ByteBuffer that is backed by buffer, caller owns.
-         */
-        static decaf::nio::ByteBuffer* createByteBuffer( unsigned char* buffer,
-                                                         std::size_t offset,
-                                                         std::size_t length )
-            throw( lang::exceptions::NullPointerException );
+         *
+         * @param buffer
+         *      The array that will back the new buffer.
+         * @param size
+         *      The size of the specified buffer.
+         * @param offset
+         *      The offset of the subarray to be used.
+         * @param length
+         *      The length of the subarray to be used.
+         *
+         * @returns a new ByteBuffer that is backed by buffer, caller owns the returned pointer.
+         *
+         * @throws NullPointerException if the buffer given in Null.
+         * @throws IndexOutOfBoundsException if the capacity specified is negative.
+         */
+        static decaf::nio::ByteBuffer* createByteBuffer(
+                        unsigned char* buffer, int size, int offset, int length )
+            throw( decaf::lang::exceptions::NullPointerException,
+                   decaf::lang::exceptions::IndexOutOfBoundsException );
 
         /**
          * Wraps the passed STL Byte Vector in a ByteBuffer.
-         * <p>
+         *
          * The new buffer will be backed by the given byte array; modifications to the
          * buffer will cause the array to be modified and vice versa. The new buffer's
          * capacity and limit will be buffer.size(), its position will be zero, and its
          * mark will be undefined. Its backing array will be the given array, and its
          * array offset will be zero.
-         * @param buffer - The vector that will back the new buffer, the vector must
-         * have been sized to the desired size already by calling vector.resize( N ).
+         *
+         * @param buffer
+         *      The vector that will back the new buffer, the vector must have been
+         *      sized to the desired size already by calling vector.resize( N ).
+         *
          * @returns a new ByteBuffer that is backed by buffer, caller owns.
          */
         static decaf::nio::ByteBuffer* createByteBuffer( std::vector<unsigned char>& buffer );
@@ -82,39 +105,57 @@ namespace nio{
         /**
          * Allocates a new char buffer whose position will be zero its limit will
          * be its capacity and its mark is not set.
-         * @param capacity - the internal buffer's capacity.
+         *
+         * @param capacity
+         *      The internal buffer's capacity.
+         *
          * @returns a newly allocated CharBuffer which the caller owns.
+         *
+         * @throws IndexOutOfBoundsException if the capacity specified is negative.
          */
-        static decaf::nio::CharBuffer* createCharBuffer( std::size_t capacity );
+        static decaf::nio::CharBuffer* createCharBuffer( int capacity )
+            throw( decaf::lang::exceptions::IndexOutOfBoundsException );
 
         /**
          * Wraps the passed buffer with a new CharBuffer.
-         * <p>
+         *
          * The new buffer will be backed by the given byte array; that is, modifications
          * to the buffer will cause the array to be modified and vice versa. The new
          * buffer's capacity will be array.length, its position will be offset, its limit
          * will be offset + length, and its mark will be undefined. Its backing array
          * will be the given array, and its array offset will be zero.
-         * @param buffer - The array that will back the new buffer
-         * @param offset - The offset of the subarray to be used
-         * @param length - The length of the subarray to be used
-         * @returns a new CharBuffer that is backed by buffer, caller owns.
-         */
-        static decaf::nio::CharBuffer* createCharBuffer( char* buffer,
-                                                         std::size_t offset,
-                                                         std::size_t length )
-            throw( lang::exceptions::NullPointerException );
+         *
+         * @param buffer
+         *      The array that will back the new buffer.
+         * @param size
+         *      The size of the specified buffer.
+         * @param offset
+         *      The offset of the subarray to be used.
+         * @param length
+         *      The length of the subarray to be used.
+         *
+         * @returns a new CharBuffer that is backed by buffer, caller owns the returned pointer.
+         *
+         * @throws NullPointerException if the buffer given in Null.
+         * @throws IndexOutOfBoundsException if the capacity specified is negative.
+         */
+        static decaf::nio::CharBuffer* createCharBuffer( char* buffer, int size, int offset, int length )
+            throw( decaf::lang::exceptions::NullPointerException,
+                   decaf::lang::exceptions::IndexOutOfBoundsException );
 
         /**
          * Wraps the passed STL Byte Vector in a CharBuffer.
-         * <p>
+         *
          * The new buffer will be backed by the given byte array; modifications to the
          * buffer will cause the array to be modified and vice versa. The new buffer's
          * capacity and limit will be buffer.size(), its position will be zero, and its
          * mark will be undefined. Its backing array will be the given array, and its
          * array offset will be zero.
-         * @param buffer - The vector that will back the new buffer, the vector must
-         * have been sized to the desired size already by calling vector.resize( N ).
+         *
+         * @param buffer
+         *      The vector that will back the new buffer, the vector must have been
+         *      sized to the desired size already by calling vector.resize( N ).
+         *
          * @returns a new CharBuffer that is backed by buffer, caller owns.
          */
         static decaf::nio::CharBuffer* createCharBuffer( std::vector<char>& buffer );
@@ -122,39 +163,57 @@ namespace nio{
         /**
          * Allocates a new double buffer whose position will be zero its limit will
          * be its capacity and its mark is not set.
-         * @param capacity - the internal buffer's capacity.
+         *
+         * @param capacity
+         *      The internal buffer's capacity.
+         *
          * @returns a newly allocated DoubleBuffer which the caller owns.
+         *
+         * @throws IndexOutOfBoundsException if the capacity specified is negative.
          */
-        static decaf::nio::DoubleBuffer* createDoubleBuffer( std::size_t capacity );
+        static decaf::nio::DoubleBuffer* createDoubleBuffer( int capacity )
+            throw( decaf::lang::exceptions::IndexOutOfBoundsException );
 
         /**
          * Wraps the passed buffer with a new DoubleBuffer.
-         * <p>
+         *
          * The new buffer will be backed by the given byte array; that is, modifications
          * to the buffer will cause the array to be modified and vice versa. The new
          * buffer's capacity will be array.length, its position will be offset, its limit
          * will be offset + length, and its mark will be undefined. Its backing array
          * will be the given array, and its array offset will be zero.
-         * @param buffer - The array that will back the new buffer
-         * @param offset - The offset of the subarray to be used
-         * @param length - The length of the subarray to be used
-         * @returns a new DoubleBuffer that is backed by buffer, caller owns.
-         */
-        static decaf::nio::DoubleBuffer* createDoubleBuffer( double* buffer,
-                                                             std::size_t offset,
-                                                             std::size_t length )
-            throw( lang::exceptions::NullPointerException );
+         *
+         * @param buffer
+         *      The array that will back the new buffer.
+         * @param size
+         *      The size of the specified buffer.
+         * @param offset
+         *      The offset of the subarray to be used.
+         * @param length
+         *      The length of the subarray to be used.
+         *
+         * @returns a new DoubleBuffer that is backed by buffer, caller owns the returned pointer.
+         *
+         * @throws NullPointerException if the buffer given in Null.
+         * @throws IndexOutOfBoundsException if the capacity specified is negative.
+         */
+        static decaf::nio::DoubleBuffer* createDoubleBuffer( double* buffer, int size, int offset, int length )
+            throw( decaf::lang::exceptions::NullPointerException,
+                   decaf::lang::exceptions::IndexOutOfBoundsException );
 
         /**
          * Wraps the passed STL Double Vector in a DoubleBuffer.
-         * <p>
+         *
          * The new buffer will be backed by the given byte array; modifications to the
          * buffer will cause the array to be modified and vice versa. The new buffer's
          * capacity and limit will be buffer.size(), its position will be zero, and its
          * mark will be undefined. Its backing array will be the given array, and its
          * array offset will be zero.
-         * @param buffer - The vector that will back the new buffer, the vector must
-         * have been sized to the desired size already by calling vector.resize( N ).
+         *
+         * @param buffer
+         *      The vector that will back the new buffer, the vector must have been
+         *      sized to the desired size already by calling vector.resize( N ).
+         *
          * @returns a new DoubleBuffer that is backed by buffer, caller owns.
          */
         static decaf::nio::DoubleBuffer* createDoubleBuffer( std::vector<double>& buffer );
@@ -162,40 +221,58 @@ namespace nio{
         /**
          * Allocates a new float buffer whose position will be zero its limit will
          * be its capacity and its mark is not set.
-         * @param capacity - the internal buffer's capacity.
-         * @returns a newly allocated DoubleBuffer which the caller owns.
+         *
+         * @param capacity
+         *      The internal buffer's capacity.
+         *
+         * @returns a newly allocated FloatBuffer which the caller owns.
+         *
+         * @throws IndexOutOfBoundsException if the capacity specified is negative.
          */
-        static decaf::nio::FloatBuffer* createFloatBuffer( std::size_t capacity );
+        static decaf::nio::FloatBuffer* createFloatBuffer( int capacity )
+            throw( decaf::lang::exceptions::IndexOutOfBoundsException );
 
         /**
          * Wraps the passed buffer with a new FloatBuffer.
-         * <p>
+         *
          * The new buffer will be backed by the given byte array; that is, modifications
          * to the buffer will cause the array to be modified and vice versa. The new
          * buffer's capacity will be array.length, its position will be offset, its limit
          * will be offset + length, and its mark will be undefined. Its backing array
          * will be the given array, and its array offset will be zero.
-         * @param buffer - The array that will back the new buffer
-         * @param offset - The offset of the subarray to be used
-         * @param length - The length of the subarray to be used
-         * @returns a new DoubleBuffer that is backed by buffer, caller owns.
-         */
-        static decaf::nio::FloatBuffer* createFloatBuffer( float* buffer,
-                                                           std::size_t offset,
-                                                           std::size_t length )
-            throw( lang::exceptions::NullPointerException );
+         *
+         * @param buffer
+         *      The array that will back the new buffer.
+         * @param size
+         *      The size of the specified buffer.
+         * @param offset
+         *      The offset of the subarray to be used.
+         * @param length
+         *      The length of the subarray to be used.
+         *
+         * @returns a new FloatBuffer that is backed by buffer, caller owns the returned pointer.
+         *
+         * @throws NullPointerException if the buffer given in Null.
+         * @throws IndexOutOfBoundsException if the capacity specified is negative.
+         */
+        static decaf::nio::FloatBuffer* createFloatBuffer( float* buffer, int size, int offset, int length )
+            throw( decaf::lang::exceptions::NullPointerException,
+                   decaf::lang::exceptions::IndexOutOfBoundsException );
 
         /**
          * Wraps the passed STL Float Vector in a FloatBuffer.
-         * <p>
+         *
          * The new buffer will be backed by the given byte array; modifications to the
          * buffer will cause the array to be modified and vice versa. The new buffer's
          * capacity and limit will be buffer.size(), its position will be zero, and its
          * mark will be undefined. Its backing array will be the given array, and its
          * array offset will be zero.
-         * @param buffer - The vector that will back the new buffer, the vector must
-         * have been sized to the desired size already by calling vector.resize( N ).
-         * @returns a new DoubleBuffer that is backed by buffer, caller owns.
+         *
+         * @param buffer
+         *      The vector that will back the new buffer, the vector must have been
+         *      sized to the desired size already by calling vector.resize( N ).
+         *
+         * @returns a new FloatBuffer that is backed by buffer, caller owns.
          */
         static decaf::nio::FloatBuffer* createFloatBuffer( std::vector<float>& buffer );
 
@@ -204,117 +281,168 @@ namespace nio{
          * be its capacity and its mark is not set.
          * @param capacity - the internal buffer's capacity.
          * @returns a newly allocated DoubleBuffer which the caller owns.
+         *
+         * @throws IndexOutOfBoundsException if the capacity specified is negative.
          */
-        static decaf::nio::LongBuffer* createLongBuffer( std::size_t capacity );
+        static decaf::nio::LongBuffer* createLongBuffer( int capacity )
+            throw( decaf::lang::exceptions::IndexOutOfBoundsException );
 
         /**
          * Wraps the passed buffer with a new LongBuffer.
-         * <p>
+         *
          * The new buffer will be backed by the given byte array; that is, modifications
          * to the buffer will cause the array to be modified and vice versa. The new
          * buffer's capacity will be array.length, its position will be offset, its limit
          * will be offset + length, and its mark will be undefined. Its backing array
          * will be the given array, and its array offset will be zero.
-         * @param buffer - The array that will back the new buffer
-         * @param offset - The offset of the subarray to be used
-         * @param length - The length of the subarray to be used
-         * @returns a new DoubleBuffer that is backed by buffer, caller owns.
-         */
-        static decaf::nio::LongBuffer* createLongBuffer( long long* buffer,
-                                                           std::size_t offset,
-                                                           std::size_t length )
-            throw( lang::exceptions::NullPointerException );
+         *
+         * @param buffer
+         *      The array that will back the new buffer.
+         * @param size
+         *      The size of the specified buffer.
+         * @param offset
+         *      The offset of the subarray to be used.
+         * @param length
+         *      The length of the subarray to be used.
+         *
+         * @returns a new LongBuffer that is backed by buffer, caller owns the returned pointer.
+         *
+         * @throws NullPointerException if the buffer given in Null.
+         * @throws IndexOutOfBoundsException if the capacity specified is negative.
+         */
+        static decaf::nio::LongBuffer* createLongBuffer( long long* buffer, int size, int offset, int length )
+            throw( decaf::lang::exceptions::NullPointerException,
+                   decaf::lang::exceptions::IndexOutOfBoundsException );
 
         /**
          * Wraps the passed STL Long Vector in a LongBuffer.
-         * <p>
+         *
          * The new buffer will be backed by the given byte array; modifications to the
          * buffer will cause the array to be modified and vice versa. The new buffer's
          * capacity and limit will be buffer.size(), its position will be zero, and its
          * mark will be undefined. Its backing array will be the given array, and its
          * array offset will be zero.
-         * @param buffer - The vector that will back the new buffer, the vector must
-         * have been sized to the desired size already by calling vector.resize( N ).
-         * @returns a new DoubleBuffer that is backed by buffer, caller owns.
+         *
+         * @param buffer
+         *      The vector that will back the new buffer, the vector must have been
+         *      sized to the desired size already by calling vector.resize( N ).
+         *
+         * @returns a new LongBuffer that is backed by buffer, caller owns.
          */
         static decaf::nio::LongBuffer* createLongBuffer( std::vector<long long>& buffer );
 
         /**
          * Allocates a new int buffer whose position will be zero its limit will
          * be its capacity and its mark is not set.
-         * @param capacity - the internal buffer's capacity.
-         * @returns a newly allocated DoubleBuffer which the caller owns.
+         *
+         * @param capacity
+         *      The internal buffer's capacity.
+         *
+         * @returns a newly allocated IntBuffer which the caller owns.
+         *
+         * @throws IndexOutOfBoundsException if the capacity specified is negative.
          */
-        static decaf::nio::IntBuffer* createIntBuffer( std::size_t capacity );
+        static decaf::nio::IntBuffer* createIntBuffer( int capacity )
+            throw( decaf::lang::exceptions::IndexOutOfBoundsException );
 
         /**
          * Wraps the passed buffer with a new IntBuffer.
-         * <p>
+         *
          * The new buffer will be backed by the given byte array; that is, modifications
          * to the buffer will cause the array to be modified and vice versa. The new
          * buffer's capacity will be array.length, its position will be offset, its limit
          * will be offset + length, and its mark will be undefined. Its backing array
          * will be the given array, and its array offset will be zero.
-         * @param buffer - The array that will back the new buffer
-         * @param offset - The offset of the subarray to be used
-         * @param length - The length of the subarray to be used
-         * @returns a new DoubleBuffer that is backed by buffer, caller owns.
-         */
-        static decaf::nio::IntBuffer* createIntBuffer( int* buffer,
-                                                       std::size_t offset,
-                                                       std::size_t length )
-            throw( lang::exceptions::NullPointerException );
+         *
+         * @param buffer
+         *      The array that will back the new buffer.
+         * @param size
+         *      The size of the specified buffer.
+         * @param offset
+         *      The offset of the subarray to be used.
+         * @param length
+         *      The length of the subarray to be used.
+         *
+         * @returns a new IntBuffer that is backed by buffer, caller owns the returned pointer.
+         *
+         * @throws NullPointerException if the buffer given in Null.
+         * @throws IndexOutOfBoundsException if the capacity specified is negative.
+         */
+        static decaf::nio::IntBuffer* createIntBuffer( int* buffer, int size,  int offset, int length )
+            throw( decaf::lang::exceptions::NullPointerException,
+                   decaf::lang::exceptions::IndexOutOfBoundsException );
 
         /**
          * Wraps the passed STL int Vector in a IntBuffer.
-         * <p>
+         *
          * The new buffer will be backed by the given byte array; modifications to the
          * buffer will cause the array to be modified and vice versa. The new buffer's
          * capacity and limit will be buffer.size(), its position will be zero, and its
          * mark will be undefined. Its backing array will be the given array, and its
          * array offset will be zero.
-         * @param buffer - The vector that will back the new buffer, the vector must
-         * have been sized to the desired size already by calling vector.resize( N ).
-         * @returns a new DoubleBuffer that is backed by buffer, caller owns.
+         *
+         * @param buffer
+         *      The vector that will back the new buffer, the vector must have been
+         *      sized to the desired size already by calling vector.resize( N ).
+         *
+         * @returns a new IntBuffer that is backed by buffer, caller owns.
          */
         static decaf::nio::IntBuffer* createIntBuffer( std::vector<int>& buffer );
 
         /**
          * Allocates a new short buffer whose position will be zero its limit will
          * be its capacity and its mark is not set.
-         * @param capacity - the internal buffer's capacity.
-         * @returns a newly allocated DoubleBuffer which the caller owns.
+         *
+         * @param capacity
+         *      The internal buffer's capacity.
+         *
+         * @returns a newly allocated ShortBuffer which the caller owns.
+         *
+         * @throws IndexOutOfBoundsException if the capacity specified is negative.
          */
-        static decaf::nio::ShortBuffer* createShortBuffer( std::size_t capacity );
+        static decaf::nio::ShortBuffer* createShortBuffer( int capacity )
+            throw( decaf::lang::exceptions::IndexOutOfBoundsException );
 
         /**
          * Wraps the passed buffer with a new ShortBuffer.
-         * <p>
+         *
          * The new buffer will be backed by the given byte array; that is, modifications
          * to the buffer will cause the array to be modified and vice versa. The new
          * buffer's capacity will be array.length, its position will be offset, its limit
          * will be offset + length, and its mark will be undefined. Its backing array
          * will be the given array, and its array offset will be zero.
-         * @param buffer - The array that will back the new buffer
-         * @param offset - The offset of the subarray to be used
-         * @param length - The length of the subarray to be used
-         * @returns a new DoubleBuffer that is backed by buffer, caller owns.
-         */
-        static decaf::nio::ShortBuffer* createShortBuffer( short* buffer,
-                                                           std::size_t offset,
-                                                           std::size_t length )
-            throw( lang::exceptions::NullPointerException );
+         *
+         * @param buffer
+         *      The array that will back the new buffer.
+         * @param size
+         *      The size of the specified buffer.
+         * @param offset
+         *      The offset of the subarray to be used.
+         * @param length
+         *      The length of the subarray to be used.
+         *
+         * @returns a new ShortBuffer that is backed by buffer, caller owns the returned pointer.
+         *
+         * @throws NullPointerException if the buffer given in Null.
+         * @throws IndexOutOfBoundsException if the capacity specified is negative.
+         */
+        static decaf::nio::ShortBuffer* createShortBuffer( short* buffer, int size, int offset, int length )
+            throw( decaf::lang::exceptions::NullPointerException,
+                   decaf::lang::exceptions::IndexOutOfBoundsException );
 
         /**
          * Wraps the passed STL Short Vector in a ShortBuffer.
-         * <p>
+         *
          * The new buffer will be backed by the given byte array; modifications to the
          * buffer will cause the array to be modified and vice versa. The new buffer's
          * capacity and limit will be buffer.size(), its position will be zero, and its
          * mark will be undefined. Its backing array will be the given array, and its
          * array offset will be zero.
-         * @param buffer - The vector that will back the new buffer, the vector must
-         * have been sized to the desired size already by calling vector.resize( N ).
+         *
+         * @param buffer
+         *      The vector that will back the new buffer, the vector must have been
+         *      sized to the desired size already by calling vector.resize( N ).
+         *
          * @returns a new DoubleBuffer that is backed by buffer, caller owns.
          */
         static decaf::nio::ShortBuffer* createShortBuffer( std::vector<short>& buffer );

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/nio/ByteArrayBuffer.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/nio/ByteArrayBuffer.cpp?rev=925692&r1=925691&r2=925692&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/nio/ByteArrayBuffer.cpp (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/nio/ByteArrayBuffer.cpp Sat Mar 20 21:57:20 2010
@@ -30,53 +30,70 @@ using namespace decaf::lang::exceptions;
 using namespace decaf::internal::nio;
 
 ////////////////////////////////////////////////////////////////////////////////
-ByteArrayBuffer::ByteArrayBuffer( std::size_t capacity, bool readOnly )
- : decaf::nio::ByteBuffer( capacity ) {
+ByteArrayBuffer::ByteArrayBuffer( int size, bool readOnly )
+    throw( decaf::lang::exceptions::IllegalArgumentException ) : decaf::nio::ByteBuffer( size ) {
 
     // Allocate using the ByteArray, not read-only initially.  Take a reference to it.
-    this->_array = new ByteArrayPerspective( capacity );
+    this->_array.reset( new ByteArrayAdapter( size ) );
     this->offset = 0;
+    this->length = size;
     this->readOnly = readOnly;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-ByteArrayBuffer::ByteArrayBuffer( unsigned char* array, std::size_t offset,
-                                  std::size_t capacity, bool readOnly )
-    throw( decaf::lang::exceptions::NullPointerException )
-    : decaf::nio::ByteBuffer( capacity ) {
+ByteArrayBuffer::ByteArrayBuffer( unsigned char* array, int size, int offset, int length, bool readOnly )
+    throw( decaf::lang::exceptions::NullPointerException,
+           decaf::lang::exceptions::IndexOutOfBoundsException ) :
+    decaf::nio::ByteBuffer( length ) {
 
     try{
 
+        if( offset < 0 || offset > size ) {
+            throw IndexOutOfBoundsException(
+                __FILE__, __LINE__, "Offset parameter if out of bounds, %d", offset );
+        }
+
+        if( length < 0 || offset + length > size ) {
+            throw IndexOutOfBoundsException(
+                __FILE__, __LINE__, "length parameter if out of bounds, %d", length );
+        }
+
         // Allocate using the ByteArray, not read-only initially.
-        this->_array = new ByteArrayPerspective( array, capacity, false );
+        this->_array.reset( new ByteArrayAdapter( array, size, false ) );
         this->offset = offset;
+        this->length = length;
         this->readOnly = readOnly;
     }
     DECAF_CATCH_RETHROW( NullPointerException )
+    DECAF_CATCH_RETHROW( IndexOutOfBoundsException )
     DECAF_CATCH_EXCEPTION_CONVERT( Exception, NullPointerException )
     DECAF_CATCHALL_THROW( NullPointerException )
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-ByteArrayBuffer::ByteArrayBuffer( ByteArrayPerspective& array, std::size_t offset,
-                                  std::size_t length, bool readOnly )
-    throw( decaf::lang::exceptions::IndexOutOfBoundsException )
-    : decaf::nio::ByteBuffer( length ) {
+ByteArrayBuffer::ByteArrayBuffer( const Pointer<ByteArrayAdapter>& array, int offset, int length, bool readOnly )
+    throw( decaf::lang::exceptions::NullPointerException,
+           decaf::lang::exceptions::IndexOutOfBoundsException ) : decaf::nio::ByteBuffer( length ) {
 
     try{
-        if( offset > array.getCapacity() ) {
+
+        if( offset < 0 || offset > array->getCapacity() ) {
             throw IndexOutOfBoundsException(
-                __FILE__, __LINE__,
-                "ByteArrayBuffer::ByteArrayBuffer - offset %d is greater than capacity %d",
-                offset, array.getCapacity() );
+                __FILE__, __LINE__, "Offset parameter if out of bounds, %d", offset );
         }
 
-        // Allocate using the ByteArray, not read-only initially.
-        this->_array = array.takeRef();
+        if( length < 0 || offset + length > array->getCapacity() ) {
+            throw IndexOutOfBoundsException(
+                __FILE__, __LINE__, "length parameter if out of bounds, %d", length );
+        }
+
+        this->_array = array;
         this->offset = offset;
+        this->length = length;
         this->readOnly = readOnly;
     }
     DECAF_CATCH_RETHROW( NullPointerException )
+    DECAF_CATCH_RETHROW( IndexOutOfBoundsException )
     DECAF_CATCH_EXCEPTION_CONVERT( Exception, NullPointerException )
     DECAF_CATCHALL_THROW( NullPointerException )
 }
@@ -86,8 +103,9 @@ ByteArrayBuffer::ByteArrayBuffer( const 
     : decaf::nio::ByteBuffer( other ) {
 
     // get the byte buffer of the caller and take a reference
-    this->_array = other._array->takeRef();
+    this->_array = other._array;
     this->offset = other.offset;
+    this->length = other.length;
     this->readOnly = other.readOnly;
 }
 
@@ -95,16 +113,6 @@ ByteArrayBuffer::ByteArrayBuffer( const 
 ByteArrayBuffer::~ByteArrayBuffer() {
 
     try{
-
-        // Return this object's reference to the buffer.
-        this->_array->returnRef();
-
-        // If there are no other Buffers out there that reference it then we
-        // delete it now, the internal unsigned char* array will be deleted
-        // if we where the owner.
-        if( this->_array->getReferences() == 0 ) {
-            delete this->_array;
-        }
     }
     DECAF_CATCH_NOTHROW( Exception )
     DECAF_CATCHALL_NOTHROW()
@@ -137,7 +145,7 @@ unsigned char* ByteArrayBuffer::array()
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-std::size_t ByteArrayBuffer::arrayOffset() const
+int ByteArrayBuffer::arrayOffset() const
     throw( decaf::nio::ReadOnlyBufferException,
            lang::exceptions::UnsupportedOperationException ) {
 
@@ -190,7 +198,7 @@ ByteArrayBuffer& ByteArrayBuffer::compac
 
         // copy from the current pos to the beginning all the remaining bytes
         // the set pos to the
-        for( std::size_t ix = 0; ix < this->remaining(); ++ix ) {
+        for( int ix = 0; ix < this->remaining(); ++ix ) {
             this->put( ix, this->get( this->position() + ix ) );
         }
 
@@ -227,7 +235,7 @@ unsigned char ByteArrayBuffer::get() con
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-unsigned char ByteArrayBuffer::get( std::size_t index ) const
+unsigned char ByteArrayBuffer::get( int index ) const
     throw ( lang::exceptions::IndexOutOfBoundsException ) {
 
     try{
@@ -259,7 +267,7 @@ double ByteArrayBuffer::getDouble() thro
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-double ByteArrayBuffer::getDouble( std::size_t index ) const
+double ByteArrayBuffer::getDouble( int index ) const
     throw ( lang::exceptions::IndexOutOfBoundsException ) {
 
     try{
@@ -286,7 +294,7 @@ float ByteArrayBuffer::getFloat() throw(
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-float ByteArrayBuffer::getFloat( std::size_t index ) const
+float ByteArrayBuffer::getFloat( int index ) const
     throw ( lang::exceptions::IndexOutOfBoundsException ) {
 
     try{
@@ -314,12 +322,12 @@ long long ByteArrayBuffer::getLong() thr
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-long long ByteArrayBuffer::getLong( std::size_t index ) const
+long long ByteArrayBuffer::getLong( int index ) const
     throw ( lang::exceptions::IndexOutOfBoundsException ) {
 
     try{
 
-        if( (offset + index + sizeof(long long)) > this->limit() ) {
+        if( ( offset + index + (int)sizeof(long long) ) > this->limit() ) {
             throw IndexOutOfBoundsException(
                 __FILE__, __LINE__,
                 "ByteArrayBuffer::getLong(i) - Not enough data to fill a long long." );
@@ -347,12 +355,12 @@ int ByteArrayBuffer::getInt() throw( dec
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-int ByteArrayBuffer::getInt( std::size_t index ) const
+int ByteArrayBuffer::getInt( int index ) const
     throw ( lang::exceptions::IndexOutOfBoundsException ) {
 
     try{
 
-        if( (offset + index + sizeof(int)) > this->limit() ) {
+        if( (offset + index + (int)sizeof(int)) > this->limit() ) {
             throw IndexOutOfBoundsException(
                 __FILE__, __LINE__,
                 "ByteArrayBuffer::getInt(i) - Not enough data to fill an int." );
@@ -380,12 +388,12 @@ short ByteArrayBuffer::getShort() throw(
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-short ByteArrayBuffer::getShort( std::size_t index ) const
+short ByteArrayBuffer::getShort( int index ) const
     throw ( lang::exceptions::IndexOutOfBoundsException )  {
 
     try{
 
-        if( (offset + index + sizeof(short)) > this->limit() ) {
+        if( (offset + index + (int)sizeof(short)) > this->limit() ) {
             throw IndexOutOfBoundsException(
                 __FILE__, __LINE__,
                 "ByteArrayBuffer::getShort(i) - Not enough data to fill a short." );
@@ -414,7 +422,7 @@ ByteArrayBuffer& ByteArrayBuffer::put( u
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-ByteArrayBuffer& ByteArrayBuffer::put( std::size_t index, unsigned char value )
+ByteArrayBuffer& ByteArrayBuffer::put( int index, unsigned char value )
     throw( lang::exceptions::IndexOutOfBoundsException,
            decaf::nio::ReadOnlyBufferException ) {
 
@@ -458,7 +466,7 @@ ByteArrayBuffer& ByteArrayBuffer::putCha
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-ByteArrayBuffer& ByteArrayBuffer::putChar( std::size_t index, char value )
+ByteArrayBuffer& ByteArrayBuffer::putChar( int index, char value )
     throw( lang::exceptions::IndexOutOfBoundsException,
            decaf::nio::ReadOnlyBufferException ) {
 
@@ -490,7 +498,7 @@ ByteArrayBuffer& ByteArrayBuffer::putDou
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-ByteArrayBuffer& ByteArrayBuffer::putDouble( std::size_t index, double value )
+ByteArrayBuffer& ByteArrayBuffer::putDouble( int index, double value )
     throw( lang::exceptions::IndexOutOfBoundsException,
            decaf::nio::ReadOnlyBufferException ) {
 
@@ -522,7 +530,7 @@ ByteArrayBuffer& ByteArrayBuffer::putFlo
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-ByteArrayBuffer& ByteArrayBuffer::putFloat( std::size_t index, float value )
+ByteArrayBuffer& ByteArrayBuffer::putFloat( int index, float value )
     throw( lang::exceptions::IndexOutOfBoundsException,
            decaf::nio::ReadOnlyBufferException ) {
 
@@ -554,7 +562,7 @@ ByteArrayBuffer& ByteArrayBuffer::putLon
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-ByteArrayBuffer& ByteArrayBuffer::putLong( std::size_t index, long long value )
+ByteArrayBuffer& ByteArrayBuffer::putLong( int index, long long value )
     throw( lang::exceptions::IndexOutOfBoundsException,
            decaf::nio::ReadOnlyBufferException ) {
 
@@ -593,7 +601,7 @@ ByteArrayBuffer& ByteArrayBuffer::putInt
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-ByteArrayBuffer& ByteArrayBuffer::putInt( std::size_t index, int value )
+ByteArrayBuffer& ByteArrayBuffer::putInt( int index, int value )
     throw( lang::exceptions::IndexOutOfBoundsException,
            decaf::nio::ReadOnlyBufferException ) {
 
@@ -632,7 +640,7 @@ ByteArrayBuffer& ByteArrayBuffer::putSho
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-ByteArrayBuffer& ByteArrayBuffer::putShort( std::size_t index, short value )
+ByteArrayBuffer& ByteArrayBuffer::putShort( int index, short value )
     throw( lang::exceptions::IndexOutOfBoundsException,
            decaf::nio::ReadOnlyBufferException ) {
 
@@ -659,7 +667,7 @@ ByteArrayBuffer* ByteArrayBuffer::slice(
 
     try{
 
-        return new ByteArrayBuffer( *(this->_array),
+        return new ByteArrayBuffer( this->_array,
                                     this->offset + this->position(),
                                     this->remaining(),
                                     this->isReadOnly() );



Mime
View raw message