Return-Path: Delivered-To: apmail-activemq-commits-archive@www.apache.org Received: (qmail 90475 invoked from network); 20 Mar 2010 21:58:20 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 20 Mar 2010 21:58:20 -0000 Received: (qmail 91795 invoked by uid 500); 20 Mar 2010 21:58:20 -0000 Delivered-To: apmail-activemq-commits-archive@activemq.apache.org Received: (qmail 91771 invoked by uid 500); 20 Mar 2010 21:58:20 -0000 Mailing-List: contact commits-help@activemq.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@activemq.apache.org Delivered-To: mailing list commits@activemq.apache.org Received: (qmail 91764 invoked by uid 99); 20 Mar 2010 21:58:20 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 20 Mar 2010 21:58:20 +0000 X-ASF-Spam-Status: No, hits=-1053.6 required=10.0 tests=ALL_TRUSTED,AWL X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 20 Mar 2010 21:58:15 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 219962388BA2; Sat, 20 Mar 2010 21:57:29 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r925692 [11/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/ni... Date: Sat, 20 Mar 2010 21:57:24 -0000 To: commits@activemq.apache.org From: tabish@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20100320215729.219962388BA2@eris.apache.org> Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/nio/ShortBuffer.cpp URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/nio/ShortBuffer.cpp?rev=925692&r1=925691&r2=925692&view=diff ============================================================================== --- activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/nio/ShortBuffer.cpp (original) +++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/nio/ShortBuffer.cpp Sat Mar 20 21:57:20 2010 @@ -29,16 +29,16 @@ using namespace decaf::lang::exceptions; using namespace decaf::internal::nio; //////////////////////////////////////////////////////////////////////////////// -ShortBuffer::ShortBuffer( std::size_t capacity ) - : Buffer( capacity ) { +ShortBuffer::ShortBuffer( int capacity ) + throw( decaf::lang::exceptions::IllegalArgumentException ) : Buffer( capacity ) { } //////////////////////////////////////////////////////////////////////////////// -ShortBuffer* ShortBuffer::allocate( std::size_t capacity ) { +ShortBuffer* ShortBuffer::allocate( int capacity ) + throw( decaf::lang::exceptions::IllegalArgumentException ) { try{ - return BufferFactory::createShortBuffer( capacity ); } DECAF_CATCH_RETHROW( Exception ) @@ -46,8 +46,9 @@ ShortBuffer* ShortBuffer::allocate( std: } //////////////////////////////////////////////////////////////////////////////// -ShortBuffer* ShortBuffer::wrap( short* buffer, std::size_t offset, std::size_t length ) - throw( lang::exceptions::NullPointerException ) { +ShortBuffer* ShortBuffer::wrap( short* buffer, int size, int offset, int length ) + throw( decaf::lang::exceptions::IndexOutOfBoundsException, + decaf::lang::exceptions::NullPointerException ) { try{ @@ -57,7 +58,7 @@ ShortBuffer* ShortBuffer::wrap( short* b "ShortBuffer::wrap - Passed Buffer is Null."); } - return BufferFactory::createShortBuffer( buffer, offset, length ); + return BufferFactory::createShortBuffer( buffer, size, offset, length ); } DECAF_CATCH_RETHROW( NullPointerException ) DECAF_CATCH_EXCEPTION_CONVERT( Exception, NullPointerException ) @@ -75,7 +76,7 @@ ShortBuffer* ShortBuffer::wrap( std::vec "ShortBuffer::wrap - Passed Buffer is Empty."); } - return BufferFactory::createShortBuffer( &buffer[0], 0, buffer.size() ); + return BufferFactory::createShortBuffer( &buffer[0], (int)buffer.size(), 0, (int)buffer.size() ); } DECAF_CATCH_RETHROW( NullPointerException ) DECAF_CATCH_EXCEPTION_CONVERT( Exception, NullPointerException ) @@ -102,7 +103,7 @@ ShortBuffer& ShortBuffer::get( std::vect try{ if( !buffer.empty() ) { - this->get( &buffer[0], 0, buffer.size() ); + this->get( &buffer[0], (int)buffer.size(), 0, (int)buffer.size() ); } return *this; } @@ -112,9 +113,10 @@ ShortBuffer& ShortBuffer::get( std::vect } //////////////////////////////////////////////////////////////////////////////// -ShortBuffer& ShortBuffer::get( short* buffer, std::size_t offset, std::size_t length ) +ShortBuffer& ShortBuffer::get( short* buffer, int size, int offset, int length ) throw( BufferUnderflowException, - lang::exceptions::NullPointerException ) { + decaf::lang::exceptions::IndexOutOfBoundsException, + decaf::lang::exceptions::NullPointerException ) { try{ @@ -128,19 +130,26 @@ ShortBuffer& ShortBuffer::get( short* bu "ShortBuffer::get - Passed Buffer is Null" ); } + if( size < 0 || offset < 0 || length < 0 || (long long)offset + (long long)length > (long long)size ) { + throw IndexOutOfBoundsException( + __FILE__, __LINE__, "Arguments violate array bounds." ); + } + if( length > remaining() ) { throw BufferUnderflowException( __FILE__, __LINE__, "ShortBuffer::get - Not enough data to fill length = %d", length ); } - for( std::size_t ix = 0; ix < length; ++ix ){ + for( int ix = 0; ix < length; ++ix ){ buffer[offset + ix] = this->get(); } return *this; } DECAF_CATCH_RETHROW( BufferUnderflowException ) + DECAF_CATCH_RETHROW( IndexOutOfBoundsException ) + DECAF_CATCH_RETHROW( NullPointerException ) DECAF_CATCH_EXCEPTION_CONVERT( Exception, BufferUnderflowException ) DECAF_CATCHALL_THROW( BufferUnderflowException ) } @@ -184,9 +193,10 @@ ShortBuffer& ShortBuffer::put( ShortBuff } //////////////////////////////////////////////////////////////////////////////// -ShortBuffer& ShortBuffer::put( const short* buffer, std::size_t offset, std::size_t length ) +ShortBuffer& ShortBuffer::put( const short* buffer, int size, int offset, int length ) throw( BufferOverflowException, ReadOnlyBufferException, - lang::exceptions::NullPointerException ) { + decaf::lang::exceptions::IndexOutOfBoundsException, + decaf::lang::exceptions::NullPointerException ) { try{ @@ -206,6 +216,11 @@ ShortBuffer& ShortBuffer::put( const sho "ShortBuffer::put - Passed Buffer is Null."); } + if( size < 0 || offset < 0 || length < 0 || (long long)offset + (long long)length > (long long)size ) { + throw IndexOutOfBoundsException( + __FILE__, __LINE__, "Arguments violate array bounds." ); + } + if( length > this->remaining() ) { throw BufferOverflowException( __FILE__, __LINE__, @@ -213,7 +228,7 @@ ShortBuffer& ShortBuffer::put( const sho } // read length bytes starting from the offset - for( std::size_t ix = 0; ix < length; ++ix ) { + for( int ix = 0; ix < length; ++ix ) { this->put( buffer[ix + offset] ); } @@ -222,6 +237,7 @@ ShortBuffer& ShortBuffer::put( const sho DECAF_CATCH_RETHROW( BufferOverflowException ) DECAF_CATCH_RETHROW( ReadOnlyBufferException ) DECAF_CATCH_RETHROW( NullPointerException ) + DECAF_CATCH_RETHROW( IndexOutOfBoundsException ) DECAF_CATCH_EXCEPTION_CONVERT( Exception, BufferOverflowException ) DECAF_CATCHALL_THROW( BufferOverflowException ) } @@ -233,7 +249,7 @@ ShortBuffer& ShortBuffer::put( std::vect try{ if( !buffer.empty() ) { - this->put( &buffer[0], 0, buffer.size() ); + this->put( &buffer[0], (int)buffer.size(), 0, (int)buffer.size() ); } return *this; @@ -249,8 +265,8 @@ int ShortBuffer::compareTo( const ShortB int compareRemaining = Math::min( (int)remaining(), (int)value.remaining() ); - std::size_t thisPos = this->position(); - std::size_t otherPos = value.position(); + int thisPos = this->position(); + int otherPos = value.position(); short thisVal, otherVal; while( compareRemaining > 0 ) { @@ -281,8 +297,8 @@ bool ShortBuffer::equals( const ShortBuf return false; } - std::size_t myPosition = this->position(); - std::size_t otherPosition = value.position(); + int myPosition = this->position(); + int otherPosition = value.position(); bool equalSoFar = true; while( equalSoFar && ( myPosition < this->limit() ) ) { Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/nio/ShortBuffer.h URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/nio/ShortBuffer.h?rev=925692&r1=925691&r2=925692&view=diff ============================================================================== --- activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/nio/ShortBuffer.h (original) +++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/nio/ShortBuffer.h Sat Mar 20 21:57:20 2010 @@ -55,9 +55,14 @@ namespace nio{ * Creates a ShortBuffer object that has its backing array allocated internally * and is then owned and deleted when this object is deleted. The array is * initially created with all elements initialized to zero. - * @param capacity - size and limit of the Buffer in doubles + * + * @param capacity + * The size and limit of the Buffer in doubles + * + * @throws IllegalArguementException if capacity is negative. */ - ShortBuffer( std::size_t capacity ); + ShortBuffer( int capacity ) + throw( decaf::lang::exceptions::IllegalArgumentException ); public: @@ -70,13 +75,15 @@ namespace nio{ /** * Returns the short array that backs this buffer (optional operation). - *

+ * * Modifications to this buffer's content will cause the returned array's content * to be modified, and vice versa. - *

+ * * Invoke the hasArray method before invoking this method in order to ensure that * this buffer has an accessible backing array. + * * @returns the array that backs this Buffer + * * @throws ReadOnlyBufferException if this Buffer is read only. * @throws UnsupportedOperationException if the underlying store has no array. */ @@ -87,63 +94,69 @@ namespace nio{ /** * Returns the offset within this buffer's backing array of the first element of * the buffer (optional operation). - *

+ * * Invoke the hasArray method before invoking this method in order to ensure that * this buffer has an accessible backing array. + * * @returns The offset into the backing array where index zero starts. + * * @throws ReadOnlyBufferException if this Buffer is read only. * @throws UnsupportedOperationException if the underlying store has no array. */ - virtual std::size_t arrayOffset() + virtual int arrayOffset() throw( decaf::lang::exceptions::UnsupportedOperationException, ReadOnlyBufferException ) = 0; /** * Creates a new, read-only short buffer that shares this buffer's content. - *

+ * * The content of the new buffer will be that of this buffer. Changes to this * buffer's content will be visible in the new buffer; the new buffer itself, * however, will be read-only and will not allow the shared content to be * modified. The two buffers' position, limit, and mark values will be * independent. - *

+ * * If this buffer is itself read-only then this method behaves in exactly the * same way as the duplicate method. - *

+ * * The new buffer's capacity, limit, position, and mark values will be * identical to those of this buffer. + * * @return The new, read-only short buffer which the caller then owns. */ virtual ShortBuffer* asReadOnlyBuffer() const = 0; /** * Compacts this buffer - *

+ * * The bytes between the buffer's current position and its limit, if any, are * copied to the beginning of the buffer. That is, the byte at index * p = position() is copied to index zero, the byte at index p + 1 is copied * to index one, and so forth until the byte at index limit() - 1 is copied * to index n = limit() - 1 - p. The buffer's position is then set to n+1 and * its limit is set to its capacity. The mark, if defined, is discarded. - *

+ * * The buffer's position is set to the number of bytes copied, rather than to * zero, so that an invocation of this method can be followed immediately by * an invocation of another relative put method. - * @returns a reference to this ShortBuffer - * @throws ReadOnlyBufferException - If this buffer is read-only + * + * @returns a reference to this ShortBuffer. + * + * @throws ReadOnlyBufferException if this buffer is read-only. */ virtual ShortBuffer& compact() throw( ReadOnlyBufferException ) = 0; /** * Creates a new short buffer that shares this buffer's content. - *

+ * * The content of the new buffer will be that of this buffer. Changes to this * buffer's content will be visible in the new buffer, and vice versa; the two * buffers' position, limit, and mark values will be independent. - *

+ * * The new buffer's capacity, limit, position, and mark values will be identical * to those of this buffer. The new buffer will be read-only if, and only if, * this buffer is read-only. + * * @returns a new short Buffer which the caller owns. */ virtual ShortBuffer* duplicate() = 0; @@ -151,67 +164,86 @@ namespace nio{ /** * Relative get method. Reads the value at this buffer's current position, * and then increments the position. - * @returns the short at the current position - * @throws BufferUnderflowException if there no more data to return + * + * @returns the short at the current position. + * + * @throws BufferUnderflowException if there no more data to return. */ virtual short get() throw ( BufferUnderflowException ) = 0; /** * Absolute get method. Reads the value at the given index. - * @param index - the index in the Buffer where the short is to be read - * @returns the short that is located at the given index - * @throws IndexOutOfBoundsException - If index is not smaller than the - * buffer's limit + * + * @param index + * The index in the Buffer where the short is to be read. + * + * @returns the short that is located at the given index. + * + * @throws IndexOutOfBoundsException if index is not smaller than the + * buffer's limit, or the index is negative. */ - virtual short get( std::size_t index ) const - throw ( lang::exceptions::IndexOutOfBoundsException ) = 0; + virtual short get( int index ) const + throw ( decaf::lang::exceptions::IndexOutOfBoundsException ) = 0; /** * Relative bulk get method. - *

+ * * This method transfers values from this buffer into the given destination * vector. An invocation of this method of the form src.get(a) behaves in * exactly the same way as the invocation. The vector must be sized to the * amount of data that is to be read, that is to say, the caller should call * buffer.resize( N ) before calling this get method. - * @returns a reference to this Buffer - * @throws BufferUnderflowException - If there are fewer than length shorts - * remaining in this buffer + * + * @returns a reference to this Buffer. + * + * @throws BufferUnderflowException if there are fewer than length shorts + * remaining in this buffer. */ ShortBuffer& get( std::vector buffer ) throw ( BufferUnderflowException ); /** * Relative bulk get method. - *

+ * * This method transfers shorts from this buffer into the given destination array. * If there are fewer shorts remaining in the buffer than are required to satisfy * the request, that is, if length > remaining(), then no bytes are transferred * and a BufferUnderflowException is thrown. - *

+ * * Otherwise, this method copies length shorts from this buffer into the given * array, starting at the current position of this buffer and at the given offset * in the array. The position of this buffer is then incremented by length. - *

- * @param buffer - pointer to an allocated buffer to fill - * @param offset - position in the buffer to start filling - * @param length - amount of data to put in the passed buffer - * @returns a reference to this Buffer - * @throws BufferUnderflowException - If there are fewer than length shorts - * remaining in this buffer + * + * @param buffer + * The pointer to an allocated buffer to fill. + * @param size + * The size of the buffer provided. + * @param offset + * The position in the buffer to start filling. + * @param length + * The amount of data to put in the passed buffer. + * + * @returns a reference to this Buffer. + * + * @throws BufferUnderflowException if there are fewer than length shorts + * remaining in this buffer * @throws NullPointerException if the passed buffer is null. + * @throws IndexOutOfBoundsException if the preconditions of size, offset, or length + * are not met. */ - ShortBuffer& get( short* buffer, std::size_t offset, std::size_t length ) + ShortBuffer& get( short* buffer, int size, int offset, int length ) throw( BufferUnderflowException, - lang::exceptions::NullPointerException ); + decaf::lang::exceptions::IndexOutOfBoundsException, + decaf::lang::exceptions::NullPointerException ); /** * Tells whether or not this buffer is backed by an accessible short array. * If this method returns true then the array and arrayOffset methods may safely * be invoked. Subclasses should override this method if they do not have a * backing array as this class always returns true. + * * @returns true if, and only if, this buffer is backed by an array and is not - * read-only + * read-only. */ virtual bool hasArray() const = 0; @@ -220,49 +252,68 @@ namespace nio{ * this buffer. If there are more shorts remaining in the source buffer than in * this buffer, that is, if src.remaining() > remaining(), then no shorts are * transferred and a BufferOverflowException is thrown. - *

+ * * Otherwise, this method copies n = src.remaining() shorts from the given * buffer into this buffer, starting at each buffer's current position. The * positions of both buffers are then incremented by n. - * @param src - the buffer to take shorts from an place in this one. - * @returns a reference to this buffer - * @throws BufferOverflowException - If there is insufficient space in this - * buffer for the remaining shorts in the source buffer - * @throws IllegalArgumentException - If the source buffer is this buffer - * @throws ReadOnlyBufferException - If this buffer is read-only + * + * @param src + * The buffer to take shorts from an place in this one. + * + * @returns a reference to this buffer. + * + * @throws BufferOverflowException if there is insufficient space in this + * buffer for the remaining shorts in the source buffer. + * @throws IllegalArgumentException if the source buffer is this buffer. + * @throws ReadOnlyBufferException if this buffer is read-only. */ ShortBuffer& put( ShortBuffer& src ) throw( BufferOverflowException, ReadOnlyBufferException, - lang::exceptions::IllegalArgumentException ); + decaf::lang::exceptions::IllegalArgumentException ); /** * This method transfers shorts into this buffer from the given source array. * If there are more shorts to be copied from the array than remain in this buffer, * that is, if length > remaining(), then no shorts are transferred and a * BufferOverflowException is thrown. - *

+ * * Otherwise, this method copies length bytes from the given array into this * buffer, starting at the given offset in the array and at the current position * of this buffer. The position of this buffer is then incremented by length. - * @param buffer- The array from which shorts are to be read - * @param offset- The offset within the array of the first short to be read; - * @param length - The number of shorts to be read from the given array - * @returns a reference to this buffer - * @throws BufferOverflowException - If there is insufficient space in this buffer - * @throws ReadOnlyBufferException - If this buffer is read-only + * + * @param buffer + * The array from which shorts are to be read. + * @param size + * The size of the buffer passed. + * @param offset + * The offset within the array of the first char to be read. + * @param length + * The number of shorts to be read from the given array. + * + * @returns a reference to this buffer. + * + * @throws BufferOverflowException if there is insufficient space in this buffer + * @throws ReadOnlyBufferException if this buffer is read-only * @throws NullPointerException if the passed buffer is null. + * @throws IndexOutOfBoundsException if the preconditions of size, offset, or length + * are not met. */ - ShortBuffer& put( const short* buffer, std::size_t offset, std::size_t length ) + ShortBuffer& put( const short* buffer, int size, int offset, int length ) throw( BufferOverflowException, ReadOnlyBufferException, - lang::exceptions::NullPointerException ); + decaf::lang::exceptions::IndexOutOfBoundsException, + decaf::lang::exceptions::NullPointerException ); /** * This method transfers the entire content of the given source shorts array into - * this buffer. This is the same as calling put( &buffer[0], 0, buffer.size() - * @param buffer - The buffer whose contents are copied to this ShortBuffer - * @returns a reference to this buffer - * @throws BufferOverflowException - If there is insufficient space in this buffer - * @throws ReadOnlyBufferException - If this buffer is read-only + * this buffer. This is the same as calling put( &buffer[0], 0, buffer.size(). + * + * @param buffer + * The buffer whose contents are copied to this ShortBuffer. + * + * @returns a reference to this buffer. + * + * @throws BufferOverflowException if there is insufficient space in this buffer. + * @throws ReadOnlyBufferException if this buffer is read-only. */ ShortBuffer& put( std::vector& buffer ) throw( BufferOverflowException, ReadOnlyBufferException ); @@ -270,26 +321,35 @@ namespace nio{ /** * Writes the given shorts into this buffer at the current position, and then * increments the position. - * @param value - the shorts value to be written - * @returns a reference to this buffer - * @throws BufferOverflowException - If this buffer's current position is not - * smaller than its limit - * @throws ReadOnlyBufferException - If this buffer is read-only + * + * @param value + * The shorts value to be written. + * + * @returns a reference to this buffer. + * + * @throws BufferOverflowException if this buffer's current position is not + * smaller than its limit. + * @throws ReadOnlyBufferException if this buffer is read-only. */ virtual ShortBuffer& put( short value ) throw( BufferOverflowException, ReadOnlyBufferException ) = 0; /** * Writes the given shorts into this buffer at the given index. - * @param index - position in the Buffer to write the data - * @param value - the shorts to write. - * @returns a reference to this buffer - * @throws IndexOutOfBoundsException - If index greater than the buffer's limit - * minus the size of the type being written. - * @throws ReadOnlyBufferException - If this buffer is read-only + * + * @param index + * The position in the Buffer to write the data. + * @param value + * The shorts to write. + * + * @returns a reference to this buffer. + * + * @throws IndexOutOfBoundsException if index greater than the buffer's limit + * minus the size of the type being written. + * @throws ReadOnlyBufferException if this buffer is read-only. */ - virtual ShortBuffer& put( std::size_t index, short value ) - throw( lang::exceptions::IndexOutOfBoundsException, + virtual ShortBuffer& put( int index, short value ) + throw( decaf::lang::exceptions::IndexOutOfBoundsException, ReadOnlyBufferException ) = 0; /** @@ -298,10 +358,11 @@ namespace nio{ * current position. Changes to this buffer's content will be visible in the new * buffer, and vice versa; the two buffers' position, limit, and mark values will * be independent. - *

+ * * The new buffer's position will be zero, its capacity and its limit will be the * number of bytes remaining in this buffer, and its mark will be undefined. The * new buffer will be read-only if, and only if, this buffer is read-only. + * * @returns the newly create ShortBuffer which the caller owns. */ virtual ShortBuffer* slice() const = 0; @@ -309,32 +370,22 @@ namespace nio{ public: // Comparable /** - * Compares this object with the specified object for order. Returns a - * negative integer, zero, or a positive integer as this object is less - * than, equal to, or greater than the specified object. - * @param value - the Object to be compared. - * @returns a negative integer, zero, or a positive integer as this - * object is less than, equal to, or greater than the specified object. + * {@inheritDoc} */ virtual int compareTo( const ShortBuffer& value ) const; /** - * @return true if this value is considered equal to the passed value. + * {@inheritDoc} */ virtual bool equals( const ShortBuffer& value ) const; /** - * Compares equality between this object and the one passed. - * @param value - the value to be compared to this one. - * @return true if this object is equal to the one passed. + * {@inheritDoc} */ virtual bool operator==( const ShortBuffer& value ) const; /** - * Compares this object to another and returns true if this object - * is considered to be less than the one passed. This - * @param value - the value to be compared to this one. - * @return true if this object is equal to the one passed. + * {@inheritDoc} */ virtual bool operator<( const ShortBuffer& value ) const; @@ -342,41 +393,60 @@ namespace nio{ /** * Allocates a new Double buffer. - *

+ * * The new buffer's position will be zero, its limit will be its capacity, and * its mark will be undefined. It will have a backing array, and its array offset * will be zero. - * @param capacity - The size of the Double buffer in shorts + * + * @param capacity + * The size of the Double buffer in shorts. + * * @returns the ShortBuffer that was allocated, caller owns. */ - static ShortBuffer* allocate( std::size_t capacity ); + static ShortBuffer* allocate( int capacity ) + throw( decaf::lang::exceptions::IllegalArgumentException ); /** * Wraps the passed buffer with a new ShortBuffer. - *

+ * * The new buffer will be backed by the given short 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 array - 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 + * + * @param array + * The array that will back the new buffer. + * @param size + * The size of the passed in array. + * @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. - */ - static ShortBuffer* wrap( short* array, std::size_t offset, std::size_t length ) - throw( lang::exceptions::NullPointerException ); + * + * @throws NullPointerException if the array pointer is NULL. + * @throws IndexOutOfBoundsException if the preconditions of size, offset, or length + * are not met. + */ + static ShortBuffer* wrap( short* array, int size, int offset, int length ) + throw( decaf::lang::exceptions::NullPointerException, + decaf::lang::exceptions::IndexOutOfBoundsException ); /** * Wraps the passed STL short Vector in a ShortBuffer. - *

+ * * The new buffer will be backed by the given short 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 ShortBuffer that is backed by buffer, caller owns. */ static ShortBuffer* wrap( std::vector& buffer ); Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/zip/Adler32.cpp URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/zip/Adler32.cpp?rev=925692&r1=925691&r2=925692&view=diff ============================================================================== --- activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/zip/Adler32.cpp (original) +++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/zip/Adler32.cpp Sat Mar 20 21:57:20 2010 @@ -50,15 +50,10 @@ void Adler32::update( const std::vector< } //////////////////////////////////////////////////////////////////////////////// -void Adler32::update( const std::vector& buffer, std::size_t offset, std::size_t length ) +void Adler32::update( const std::vector& buffer, int offset, int length ) throw( decaf::lang::exceptions::IndexOutOfBoundsException ) { - if( offset + length > buffer.size() ) { - throw IndexOutOfBoundsException( - __FILE__, __LINE__, "Given offset + length exceeds the length of the buffer." ); - } - - this->update( &buffer[0], buffer.size(), offset, length ); + this->update( &buffer[0], (int)buffer.size(), offset, length ); } //////////////////////////////////////////////////////////////////////////////// @@ -67,13 +62,28 @@ void Adler32::update( int byte ) { } //////////////////////////////////////////////////////////////////////////////// -void Adler32::update( const unsigned char* buffer, std::size_t size, std::size_t offset, std::size_t length ) +void Adler32::update( const unsigned char* buffer, int size, int offset, int length ) throw( decaf::lang::exceptions::NullPointerException, decaf::lang::exceptions::IndexOutOfBoundsException ) { - if( offset + length > size ) { + if( size < 0 ) { + throw IndexOutOfBoundsException( + __FILE__, __LINE__, "size parameter out of Bounds: %d.", size ); + } + + if( offset > size || offset < 0 ) { throw IndexOutOfBoundsException( - __FILE__, __LINE__, "Given offset + length exceeds the length of the buffer." ); + __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 ); + } + + if( buffer == NULL ) { + throw NullPointerException( + __FILE__, __LINE__, "Buffer pointer passed was NULL." ); } this->value = adler32( (uLong)this->value, (const Bytef*)( buffer + offset ), (uInt)length ); Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/zip/Adler32.h URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/zip/Adler32.h?rev=925692&r1=925691&r2=925692&view=diff ============================================================================== --- activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/zip/Adler32.h (original) +++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/zip/Adler32.h Sat Mar 20 21:57:20 2010 @@ -72,7 +72,7 @@ namespace zip { * * @throw IndexOutOfBoundsException if offset + length > size of the buffer. */ - virtual void update( const std::vector& buffer, std::size_t offset, std::size_t length ) + virtual void update( const std::vector& buffer, int offset, int length ) throw( decaf::lang::exceptions::IndexOutOfBoundsException ); /** @@ -90,8 +90,7 @@ namespace zip { * @throw NullPointerException if the passed buffer is NULL. * @throw IndexOutOfBoundsException if offset + length > size of the buffer. */ - virtual void update( const unsigned char* buffer, std::size_t size, - std::size_t offset, std::size_t length ) + virtual void update( const unsigned char* buffer, int size, int offset, int length ) throw( decaf::lang::exceptions::NullPointerException, decaf::lang::exceptions::IndexOutOfBoundsException ); Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/zip/CRC32.cpp URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/zip/CRC32.cpp?rev=925692&r1=925691&r2=925692&view=diff ============================================================================== --- activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/zip/CRC32.cpp (original) +++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/zip/CRC32.cpp Sat Mar 20 21:57:20 2010 @@ -50,15 +50,15 @@ void CRC32::update( const std::vector& buffer, std::size_t offset, std::size_t length ) +void CRC32::update( const std::vector& buffer, int offset, int length ) throw( decaf::lang::exceptions::IndexOutOfBoundsException ) { - if( offset + length > buffer.size() ) { + if( offset + length > (int)buffer.size() ) { throw IndexOutOfBoundsException( __FILE__, __LINE__, "Given offset + length exceeds the length of the buffer." ); } - this->update( &buffer[0], buffer.size(), offset, length ); + this->update( &buffer[0], (int)buffer.size(), offset, length ); } //////////////////////////////////////////////////////////////////////////////// @@ -67,7 +67,7 @@ void CRC32::update( int byte ) { } //////////////////////////////////////////////////////////////////////////////// -void CRC32::update( const unsigned char* buffer, std::size_t size, std::size_t offset, std::size_t length ) +void CRC32::update( const unsigned char* buffer, int size, int offset, int length ) throw( decaf::lang::exceptions::NullPointerException, decaf::lang::exceptions::IndexOutOfBoundsException ) { Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/zip/CRC32.h URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/zip/CRC32.h?rev=925692&r1=925691&r2=925692&view=diff ============================================================================== --- activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/zip/CRC32.h (original) +++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/zip/CRC32.h Sat Mar 20 21:57:20 2010 @@ -71,7 +71,7 @@ namespace zip { * * @throw IndexOutOfBoundsException if offset + length > size of the buffer. */ - virtual void update( const std::vector& buffer, std::size_t offset, std::size_t length ) + virtual void update( const std::vector& buffer, int offset, int length ) throw( decaf::lang::exceptions::IndexOutOfBoundsException ); /** @@ -89,8 +89,8 @@ namespace zip { * @throw NullPointerException if the passed buffer is NULL. * @throw IndexOutOfBoundsException if offset + length > size of the buffer. */ - virtual void update( const unsigned char* buffer, std::size_t size, - std::size_t offset, std::size_t length ) + virtual void update( const unsigned char* buffer, int size, + int offset, int length ) throw( decaf::lang::exceptions::NullPointerException, decaf::lang::exceptions::IndexOutOfBoundsException ); Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/zip/CheckedInputStream.cpp URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/zip/CheckedInputStream.cpp?rev=925692&r1=925691&r2=925692&view=diff ============================================================================== --- activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/zip/CheckedInputStream.cpp (original) +++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/zip/CheckedInputStream.cpp Sat Mar 20 21:57:20 2010 @@ -41,11 +41,11 @@ CheckedInputStream::~CheckedInputStream( } //////////////////////////////////////////////////////////////////////////////// -std::size_t CheckedInputStream::skip( std::size_t num ) throw( decaf::io::IOException ) { +long long CheckedInputStream::skip( long long num ) throw( decaf::io::IOException ) { try{ - if( num == 0 ) { + if( num <= 0 ) { return 0; } @@ -55,8 +55,8 @@ std::size_t CheckedInputStream::skip( st } // Perform smaller reads then the indicated amount - std::size_t remaining = Math::min( (int)num, 2048 ); - std::size_t skipped = 0; + int remaining = Math::min( (int)num, 2048 ); + long long skipped = 0; std::vector buffer( remaining ); @@ -76,7 +76,7 @@ std::size_t CheckedInputStream::skip( st this->sum->update( buffer, 0, remaining ); skipped += result; - remaining = ( num - skipped ) > buffer.size() ? buffer.size() : num - skipped; + remaining = ( num - skipped ) > (long long)buffer.size() ? (int)buffer.size() : num - skipped; } return skipped; @@ -108,8 +108,7 @@ int CheckedInputStream::doReadByte() thr } //////////////////////////////////////////////////////////////////////////////// -int CheckedInputStream::doReadArrayBounded( unsigned char* buffer, std::size_t size, - std::size_t offset, std::size_t length ) +int CheckedInputStream::doReadArrayBounded( unsigned char* buffer, int size, int offset, int length ) throw ( decaf::io::IOException, decaf::lang::exceptions::IndexOutOfBoundsException, decaf::lang::exceptions::NullPointerException ) { @@ -121,9 +120,19 @@ int CheckedInputStream::doReadArrayBound __FILE__, __LINE__, "Buffer passed was NULL" ); } - if( ( offset + length ) > size ) { + if( size < 0 ) { throw IndexOutOfBoundsException( - __FILE__, __LINE__, "Offset + Length exceeds buffer size." ); + __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 ); } if( length == 0 ) { Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/zip/CheckedInputStream.h URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/zip/CheckedInputStream.h?rev=925692&r1=925691&r2=925692&view=diff ============================================================================== --- activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/zip/CheckedInputStream.h (original) +++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/zip/CheckedInputStream.h Sat Mar 20 21:57:20 2010 @@ -72,14 +72,13 @@ namespace zip { * * Adds the skipped bytes into the Checksum. */ - virtual std::size_t skip( std::size_t num ) throw( decaf::io::IOException ); + virtual long long skip( long long num ) throw( decaf::io::IOException ); protected: 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 ); Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/zip/CheckedOutputStream.cpp URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/zip/CheckedOutputStream.cpp?rev=925692&r1=925691&r2=925692&view=diff ============================================================================== --- activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/zip/CheckedOutputStream.cpp (original) +++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/zip/CheckedOutputStream.cpp Sat Mar 20 21:57:20 2010 @@ -56,8 +56,8 @@ void CheckedOutputStream::doWriteByte( u } //////////////////////////////////////////////////////////////////////////////// -void CheckedOutputStream::doWriteArrayBounded( const unsigned char* buffer, std::size_t size, - std::size_t offset, std::size_t length ) +void CheckedOutputStream::doWriteArrayBounded( const unsigned char* buffer, int size, + int offset, int length ) throw ( decaf::io::IOException, decaf::lang::exceptions::NullPointerException, decaf::lang::exceptions::IndexOutOfBoundsException ) { @@ -69,9 +69,19 @@ void CheckedOutputStream::doWriteArrayBo __FILE__, __LINE__, "The buffer passed was NULL." ); } - if( offset + length > size ) { + if( size < 0 ) { throw IndexOutOfBoundsException( - __FILE__, __LINE__, "Given offset + length exceeds the buffer size." ); + __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 ); } if( isClosed() ) { Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/zip/CheckedOutputStream.h URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/zip/CheckedOutputStream.h?rev=925692&r1=925691&r2=925692&view=diff ============================================================================== --- activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/zip/CheckedOutputStream.h (original) +++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/zip/CheckedOutputStream.h Sat Mar 20 21:57:20 2010 @@ -68,8 +68,7 @@ namespace zip { 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/util/zip/Checksum.h URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/zip/Checksum.h?rev=925692&r1=925691&r2=925692&view=diff ============================================================================== --- activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/zip/Checksum.h (original) +++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/zip/Checksum.h Sat Mar 20 21:57:20 2010 @@ -69,7 +69,7 @@ namespace zip { * * @throw IndexOutOfBoundsException if offset + length > size of the buffer. */ - virtual void update( const std::vector& buffer, std::size_t offset, std::size_t length ) + virtual void update( const std::vector& buffer, int offset, int length ) throw( decaf::lang::exceptions::IndexOutOfBoundsException ) = 0; /** @@ -87,8 +87,7 @@ namespace zip { * @throw NullPointerException if the passed buffer is NULL. * @throw IndexOutOfBoundsException if offset + length > size of the buffer. */ - virtual void update( const unsigned char* buffer, std::size_t size, - std::size_t offset, std::size_t length ) + virtual void update( const unsigned char* buffer, int size, int offset, int length ) throw( decaf::lang::exceptions::NullPointerException, decaf::lang::exceptions::IndexOutOfBoundsException ) = 0; Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/zip/Deflater.cpp URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/zip/Deflater.cpp?rev=925692&r1=925691&r2=925692&view=diff ============================================================================== --- activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/zip/Deflater.cpp (original) +++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/zip/Deflater.cpp Sat Mar 20 21:57:20 2010 @@ -180,7 +180,7 @@ Deflater::~Deflater() { } //////////////////////////////////////////////////////////////////////////////// -void Deflater::setInput( const unsigned char* buffer, std::size_t size, std::size_t offset, std::size_t length ) +void Deflater::setInput( const unsigned char* buffer, int size, int offset, int length ) throw( decaf::lang::exceptions::NullPointerException, decaf::lang::exceptions::IndexOutOfBoundsException, decaf::lang::exceptions::IllegalStateException ) { @@ -218,7 +218,7 @@ void Deflater::setInput( const unsigned } //////////////////////////////////////////////////////////////////////////////// -void Deflater::setInput( const std::vector& buffer, std::size_t offset, std::size_t length ) +void Deflater::setInput( const std::vector& buffer, int offset, int length ) throw( decaf::lang::exceptions::IndexOutOfBoundsException, decaf::lang::exceptions::IllegalStateException ) { @@ -237,7 +237,7 @@ void Deflater::setInput( const std::vect } //////////////////////////////////////////////////////////////////////////////// -void Deflater::setDictionary( const unsigned char* buffer, std::size_t size, std::size_t offset, std::size_t length ) +void Deflater::setDictionary( const unsigned char* buffer, int size, int offset, int length ) throw( decaf::lang::exceptions::NullPointerException, decaf::lang::exceptions::IndexOutOfBoundsException, decaf::lang::exceptions::IllegalStateException ) { @@ -276,7 +276,7 @@ void Deflater::setDictionary( const unsi } //////////////////////////////////////////////////////////////////////////////// -void Deflater::setDictionary( const std::vector& buffer, std::size_t offset, std::size_t length ) +void Deflater::setDictionary( const std::vector& buffer, int offset, int length ) throw( decaf::lang::exceptions::IndexOutOfBoundsException, decaf::lang::exceptions::IllegalStateException ) { @@ -350,7 +350,7 @@ bool Deflater::finished() const { } //////////////////////////////////////////////////////////////////////////////// -std::size_t Deflater::deflate( unsigned char* buffer, std::size_t size, std::size_t offset, std::size_t length ) +int Deflater::deflate( unsigned char* buffer, int size, int offset, int length ) throw( decaf::lang::exceptions::NullPointerException, decaf::lang::exceptions::IndexOutOfBoundsException, decaf::lang::exceptions::IllegalStateException ) { @@ -367,12 +367,22 @@ std::size_t Deflater::deflate( unsigned __FILE__, __LINE__, "The Deflator has already been ended." ); } - if( offset + length > size ) { + if( size < 0 ) { throw IndexOutOfBoundsException( - __FILE__, __LINE__, "Given offset + length greater than the size of the buffer." ); + __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 ); } - std::size_t outStart = this->data->stream->total_out; + int outStart = this->data->stream->total_out; this->data->stream->next_out = buffer + offset; this->data->stream->avail_out = (uInt)length; @@ -393,7 +403,7 @@ std::size_t Deflater::deflate( unsigned } //////////////////////////////////////////////////////////////////////////////// -std::size_t Deflater::deflate( std::vector& buffer, std::size_t offset, std::size_t length ) +int Deflater::deflate( std::vector& buffer, int offset, int length ) throw( decaf::lang::exceptions::IndexOutOfBoundsException, decaf::lang::exceptions::IllegalStateException ) { @@ -401,7 +411,7 @@ std::size_t Deflater::deflate( std::vect } //////////////////////////////////////////////////////////////////////////////// -std::size_t Deflater::deflate( std::vector& buffer ) +int Deflater::deflate( std::vector& buffer ) throw( decaf::lang::exceptions::IllegalStateException ){ return this->deflate( &buffer[0], buffer.size(), 0, buffer.size() ); Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/zip/Deflater.h URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/zip/Deflater.h?rev=925692&r1=925691&r2=925692&view=diff ============================================================================== --- activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/zip/Deflater.h (original) +++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/zip/Deflater.h Sat Mar 20 21:57:20 2010 @@ -138,7 +138,7 @@ namespace zip { * @throws IndexOutOfBoundsException if the offset + length > size of the buffer. * @throws IllegalStateException if in the end state. */ - void setInput( const unsigned char* buffer, std::size_t size, std::size_t offset, std::size_t length ) + void setInput( const unsigned char* buffer, int size, int offset, int length ) throw( decaf::lang::exceptions::NullPointerException, decaf::lang::exceptions::IndexOutOfBoundsException, decaf::lang::exceptions::IllegalStateException ); @@ -157,7 +157,7 @@ namespace zip { * @throws IndexOutOfBoundsException if the offset + length > size of the buffer. * @throws IllegalStateException if in the end state. */ - void setInput( const std::vector& buffer, std::size_t offset, std::size_t length ) + void setInput( const std::vector& buffer, int offset, int length ) throw( decaf::lang::exceptions::IndexOutOfBoundsException, decaf::lang::exceptions::IllegalStateException ); @@ -192,7 +192,7 @@ namespace zip { * @throws IndexOutOfBoundsException if the offset + length > size of the buffer. * @throws IllegalStateException if in the end state. */ - void setDictionary( const unsigned char* buffer, std::size_t size, std::size_t offset, std::size_t length ) + void setDictionary( const unsigned char* buffer, int size, int offset, int length ) throw( decaf::lang::exceptions::NullPointerException, decaf::lang::exceptions::IndexOutOfBoundsException, decaf::lang::exceptions::IllegalStateException ); @@ -213,7 +213,7 @@ namespace zip { * @throws IndexOutOfBoundsException if the offset + length > size of the buffer. * @throws IllegalStateException if in the end state. */ - void setDictionary( const std::vector& buffer, std::size_t offset, std::size_t length ) + void setDictionary( const std::vector& buffer, int offset, int length ) throw( decaf::lang::exceptions::IndexOutOfBoundsException, decaf::lang::exceptions::IllegalStateException ); @@ -294,7 +294,7 @@ namespace zip { * @throws IndexOutOfBoundsException if the offset + length > size of the buffer. * @throws IllegalStateException if in the end state. */ - std::size_t deflate( unsigned char* buffer, std::size_t size, std::size_t offset, std::size_t length ) + int deflate( unsigned char* buffer, int size, int offset, int length ) throw( decaf::lang::exceptions::NullPointerException, decaf::lang::exceptions::IndexOutOfBoundsException, decaf::lang::exceptions::IllegalStateException ); @@ -316,7 +316,7 @@ namespace zip { * @throws IndexOutOfBoundsException if the offset + length > size of the buffer. * @throws IllegalStateException if in the end state. */ - std::size_t deflate( std::vector& buffer, std::size_t offset, std::size_t length ) + int deflate( std::vector& buffer, int offset, int length ) throw( decaf::lang::exceptions::IndexOutOfBoundsException, decaf::lang::exceptions::IllegalStateException ); @@ -332,7 +332,7 @@ namespace zip { * * @throws IllegalStateException if in the end state. */ - std::size_t deflate( std::vector& buffer ) + int deflate( std::vector& buffer ) throw( decaf::lang::exceptions::IllegalStateException ); /** Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/zip/DeflaterOutputStream.cpp URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/zip/DeflaterOutputStream.cpp?rev=925692&r1=925691&r2=925692&view=diff ============================================================================== --- activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/zip/DeflaterOutputStream.cpp (original) +++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/zip/DeflaterOutputStream.cpp Sat Mar 20 21:57:20 2010 @@ -54,7 +54,7 @@ DeflaterOutputStream::DeflaterOutputStre //////////////////////////////////////////////////////////////////////////////// DeflaterOutputStream::DeflaterOutputStream( OutputStream* outputStream, Deflater* deflater, - std::size_t bufferSize, bool own ) + int bufferSize, bool own ) : FilterOutputStream( outputStream, own ) { if( deflater == NULL ) { @@ -96,7 +96,7 @@ void DeflaterOutputStream::finish() thro return; } - std::size_t result; + int result; this->deflater->finish(); while( !this->deflater->finished() ) { @@ -140,8 +140,8 @@ void DeflaterOutputStream::doWriteByte( } //////////////////////////////////////////////////////////////////////////////// -void DeflaterOutputStream::doWriteArrayBounded( const unsigned char* buffer, std::size_t size, - std::size_t offset, std::size_t length ) +void DeflaterOutputStream::doWriteArrayBounded( const unsigned char* buffer, int size, + int offset, int length ) throw ( decaf::io::IOException, decaf::lang::exceptions::NullPointerException, decaf::lang::exceptions::IndexOutOfBoundsException ) { @@ -158,9 +158,19 @@ void DeflaterOutputStream::doWriteArrayB __FILE__, __LINE__, "Buffer passed was NULL." ); } - if( offset + length > size ) { + if( size < 0 ) { throw IndexOutOfBoundsException( - __FILE__, __LINE__, "Offset + length exceeds the buffer size." ); + __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 ); } if( length == 0 ) { @@ -192,10 +202,10 @@ void DeflaterOutputStream::deflate() thr try{ - std::size_t result; + int result; do{ - result = this->deflater->deflate( &buf[0], buf.size(), 0, buf.size() ); - this->outputStream->write( &buf[0], buf.size(), 0, result ); + result = this->deflater->deflate( &buf[0], (int)buf.size(), 0, (int)buf.size() ); + this->outputStream->write( &buf[0], (int)buf.size(), 0, result ); } while( !this->deflater->needsInput() ); } DECAF_CATCH_RETHROW( IOException ) Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/zip/DeflaterOutputStream.h URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/zip/DeflaterOutputStream.h?rev=925692&r1=925691&r2=925692&view=diff ============================================================================== --- activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/zip/DeflaterOutputStream.h (original) +++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/zip/DeflaterOutputStream.h Sat Mar 20 21:57:20 2010 @@ -100,7 +100,7 @@ namespace zip { * @throws IllegalArgumentException if bufferSize is 0. */ DeflaterOutputStream( decaf::io::OutputStream* outputStream, Deflater* deflater, - std::size_t bufferSize, bool own = false ); + int bufferSize, bool own = false ); virtual ~DeflaterOutputStream(); @@ -123,8 +123,8 @@ namespace zip { 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/util/zip/Inflater.cpp URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/zip/Inflater.cpp?rev=925692&r1=925691&r2=925692&view=diff ============================================================================== --- activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/zip/Inflater.cpp (original) +++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/zip/Inflater.cpp Sat Mar 20 21:57:20 2010 @@ -150,7 +150,7 @@ Inflater::~Inflater() { } //////////////////////////////////////////////////////////////////////////////// -void Inflater::setInput( const unsigned char* buffer, std::size_t size, std::size_t offset, std::size_t length ) +void Inflater::setInput( const unsigned char* buffer, int size, int offset, int length ) throw( decaf::lang::exceptions::NullPointerException, decaf::lang::exceptions::IndexOutOfBoundsException, decaf::lang::exceptions::IllegalStateException ) { @@ -182,7 +182,7 @@ void Inflater::setInput( const unsigned } //////////////////////////////////////////////////////////////////////////////// -void Inflater::setInput( const std::vector& buffer, std::size_t offset, std::size_t length ) +void Inflater::setInput( const std::vector& buffer, int offset, int length ) throw( decaf::lang::exceptions::IndexOutOfBoundsException, decaf::lang::exceptions::IllegalStateException ) { @@ -205,7 +205,7 @@ void Inflater::setInput( const std::vect } //////////////////////////////////////////////////////////////////////////////// -std::size_t Inflater::getRemaining() const { +int Inflater::getRemaining() const { if( this->data->stream != NULL ) { return this->data->stream->avail_in; @@ -215,7 +215,7 @@ std::size_t Inflater::getRemaining() con } //////////////////////////////////////////////////////////////////////////////// -void Inflater::setDictionary( const unsigned char* buffer, std::size_t size, std::size_t offset, std::size_t length ) +void Inflater::setDictionary( const unsigned char* buffer, int size, int offset, int length ) throw( decaf::lang::exceptions::NullPointerException, decaf::lang::exceptions::IndexOutOfBoundsException, decaf::lang::exceptions::IllegalArgumentException, @@ -257,7 +257,7 @@ void Inflater::setDictionary( const unsi } //////////////////////////////////////////////////////////////////////////////// -void Inflater::setDictionary( const std::vector& buffer, std::size_t offset, std::size_t length ) +void Inflater::setDictionary( const std::vector& buffer, int offset, int length ) throw( decaf::lang::exceptions::IndexOutOfBoundsException, decaf::lang::exceptions::IllegalStateException, decaf::lang::exceptions::IllegalArgumentException ) { @@ -307,7 +307,7 @@ bool Inflater::finished() const { } //////////////////////////////////////////////////////////////////////////////// -std::size_t Inflater::inflate( unsigned char* buffer, std::size_t size, std::size_t offset, std::size_t length ) +int Inflater::inflate( unsigned char* buffer, int size, int offset, int length ) throw( decaf::lang::exceptions::NullPointerException, decaf::lang::exceptions::IndexOutOfBoundsException, decaf::lang::exceptions::IllegalStateException, @@ -325,12 +325,22 @@ std::size_t Inflater::inflate( unsigned __FILE__, __LINE__, "The Inflater end method has already been called." ); } - if( offset + length > size ) { + if( size < 0 ) { throw IndexOutOfBoundsException( - __FILE__, __LINE__, "The offset + length given is greater than the specified buffer size." ); + __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 ); } - std::size_t outStart = this->data->stream->total_out; + int outStart = this->data->stream->total_out; this->data->stream->next_out = buffer + offset; this->data->stream->avail_out = (uInt)length; @@ -363,7 +373,7 @@ std::size_t Inflater::inflate( unsigned } //////////////////////////////////////////////////////////////////////////////// -std::size_t Inflater::inflate( std::vector& buffer, std::size_t offset, std::size_t length ) +int Inflater::inflate( std::vector& buffer, int offset, int length ) throw( decaf::lang::exceptions::IndexOutOfBoundsException, decaf::lang::exceptions::IllegalStateException, decaf::util::zip::DataFormatException ) { @@ -376,7 +386,7 @@ std::size_t Inflater::inflate( std::vect } //////////////////////////////////////////////////////////////////////////////// -std::size_t Inflater::inflate( std::vector& buffer ) +int Inflater::inflate( std::vector& buffer ) throw( decaf::lang::exceptions::IllegalStateException, decaf::util::zip::DataFormatException ){ Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/zip/Inflater.h URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/zip/Inflater.h?rev=925692&r1=925691&r2=925692&view=diff ============================================================================== --- activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/zip/Inflater.h (original) +++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/zip/Inflater.h Sat Mar 20 21:57:20 2010 @@ -94,7 +94,7 @@ namespace zip { * @throws IndexOutOfBoundsException if the offset + length > size of the buffer. * @throws IllegalStateException if in the end state. */ - void setInput( const unsigned char* buffer, std::size_t size, std::size_t offset, std::size_t length ) + void setInput( const unsigned char* buffer, int size, int offset, int length ) throw( decaf::lang::exceptions::NullPointerException, decaf::lang::exceptions::IndexOutOfBoundsException, decaf::lang::exceptions::IllegalStateException ); @@ -113,7 +113,7 @@ namespace zip { * @throws IndexOutOfBoundsException if the offset + length > size of the buffer. * @throws IllegalStateException if in the end state. */ - void setInput( const std::vector& buffer, std::size_t offset, std::size_t length ) + void setInput( const std::vector& buffer, int offset, int length ) throw( decaf::lang::exceptions::IndexOutOfBoundsException, decaf::lang::exceptions::IllegalStateException ); @@ -135,7 +135,7 @@ namespace zip { * * @returns the total number of bytes remaining in the input buffer */ - std::size_t getRemaining() const; + int getRemaining() const; /** * Sets the preset dictionary to the given array of bytes. Should be called when inflate() @@ -158,7 +158,7 @@ namespace zip { * @throws IllegalArgumentException if the given dictionary doesn't match thre required * dictionaries checksum value. */ - void setDictionary( const unsigned char* buffer, std::size_t size, std::size_t offset, std::size_t length ) + void setDictionary( const unsigned char* buffer, int size, int offset, int length ) throw( decaf::lang::exceptions::NullPointerException, decaf::lang::exceptions::IndexOutOfBoundsException, decaf::lang::exceptions::IllegalArgumentException, @@ -182,7 +182,7 @@ namespace zip { * @throws IllegalArgumentException if the given dictionary doesn't match thre required * dictionaries checksum value. */ - void setDictionary( const std::vector& buffer, std::size_t offset, std::size_t length ) + void setDictionary( const std::vector& buffer, int offset, int length ) throw( decaf::lang::exceptions::IndexOutOfBoundsException, decaf::lang::exceptions::IllegalArgumentException, decaf::lang::exceptions::IllegalStateException ); @@ -246,7 +246,7 @@ namespace zip { * @throws IndexOutOfBoundsException if the offset + length > size of the buffer. * @throws DataFormatException if the compressed data format is invalid. */ - std::size_t inflate( unsigned char* buffer, std::size_t size, std::size_t offset, std::size_t length ) + int inflate( unsigned char* buffer, int size, int offset, int length ) throw( decaf::lang::exceptions::NullPointerException, decaf::lang::exceptions::IllegalStateException, decaf::lang::exceptions::IndexOutOfBoundsException, @@ -269,7 +269,7 @@ namespace zip { * @throws IndexOutOfBoundsException if the offset + length > size of the buffer. * @throws DataFormatException if the compressed data format is invalid. */ - std::size_t inflate( std::vector& buffer, std::size_t offset, std::size_t length ) + int inflate( std::vector& buffer, int offset, int length ) throw( decaf::lang::exceptions::IllegalStateException, decaf::lang::exceptions::IndexOutOfBoundsException, decaf::util::zip::DataFormatException ); @@ -286,7 +286,7 @@ namespace zip { * @throws IllegalStateException if in the end state. * @throws DataFormatException if the compressed data format is invalid. */ - std::size_t inflate( std::vector& buffer ) + int inflate( std::vector& buffer ) throw( decaf::lang::exceptions::IllegalStateException, decaf::util::zip::DataFormatException ); Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/zip/InflaterInputStream.cpp URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/zip/InflaterInputStream.cpp?rev=925692&r1=925691&r2=925692&view=diff ============================================================================== --- activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/zip/InflaterInputStream.cpp (original) +++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/zip/InflaterInputStream.cpp Sat Mar 20 21:57:20 2010 @@ -57,7 +57,7 @@ InflaterInputStream::InflaterInputStream //////////////////////////////////////////////////////////////////////////////// InflaterInputStream::InflaterInputStream( InputStream* inputStream, Inflater* inflater, - std::size_t bufferSize, bool own ) + int bufferSize, bool own ) : FilterInputStream( inputStream, own ) { if( inflater == NULL ) { @@ -65,7 +65,7 @@ InflaterInputStream::InflaterInputStream __FILE__, __LINE__, "Inflater passed was NULL." ); } - if( bufferSize == 0 ) { + if( bufferSize <= 0 ) { throw IllegalArgumentException( __FILE__, __LINE__, "Cannot create a zero sized buffer." ); } @@ -106,14 +106,18 @@ void InflaterInputStream::mark( int read } //////////////////////////////////////////////////////////////////////////////// -std::size_t InflaterInputStream::skip( std::size_t num ) +long long InflaterInputStream::skip( long long num ) throw ( decaf::io::IOException, decaf::lang::exceptions::UnsupportedOperationException ) { try{ - std::size_t count = 0; - std::size_t remaining = (std::size_t)Math::min( (long long)num, (long long)buff.size() ); + if( num <= 0 ) { + return 0; + } + + long long count = 0; + long long remaining = (std::size_t)Math::min( num, (long long)buff.size() ); std::vector buffer( remaining ); @@ -123,7 +127,7 @@ std::size_t InflaterInputStream::skip( s return count; } count += x; - remaining = ( num - count ) < buffer.size() ? num - count : buffer.size(); + remaining = ( num - count ) < (long long)buffer.size() ? num - count : buffer.size(); } return count; @@ -148,7 +152,7 @@ void InflaterInputStream::close() throw } //////////////////////////////////////////////////////////////////////////////// -std::size_t InflaterInputStream::available() const throw ( decaf::io::IOException ) { +int InflaterInputStream::available() const throw ( decaf::io::IOException ) { try{ @@ -184,8 +188,7 @@ int InflaterInputStream::doReadByte() th } //////////////////////////////////////////////////////////////////////////////// -int InflaterInputStream::doReadArrayBounded( unsigned char* buffer, std::size_t size, - std::size_t offset, std::size_t length ) +int InflaterInputStream::doReadArrayBounded( unsigned char* buffer, int size, int offset, int length ) throw ( decaf::io::IOException, decaf::lang::exceptions::IndexOutOfBoundsException, decaf::lang::exceptions::NullPointerException ) { @@ -197,9 +200,19 @@ int InflaterInputStream::doReadArrayBoun __FILE__, __LINE__, "Buffer passed was NULL." ); } - if( offset + length > 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__, "Offset plus Length exceeds Buffer Size." ); + __FILE__, __LINE__, "length parameter out of Bounds: %d.", length ); } if( length == 0 ) { @@ -225,12 +238,12 @@ int InflaterInputStream::doReadArrayBoun // It may also be true if the next read() should return -1. try { - std::size_t result = inflater->inflate( buffer, size, offset, length ); + int result = inflater->inflate( buffer, size, offset, length ); atEOF = inflater->finished(); if( result > 0 ) { - return (int)result; + return result; } else if( atEOF ) { return -1; } else if( inflater->needsDictionary() ) { @@ -251,7 +264,7 @@ int InflaterInputStream::doReadArrayBoun } IOException ex( __FILE__, __LINE__, "Error from Inflater" ); - ex.initCause( e.clone() ); + ex.initCause( &e ); throw ex; } Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/zip/InflaterInputStream.h URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/zip/InflaterInputStream.h?rev=925692&r1=925691&r2=925692&view=diff ============================================================================== --- activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/zip/InflaterInputStream.h (original) +++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/zip/InflaterInputStream.h Sat Mar 20 21:57:20 2010 @@ -104,7 +104,7 @@ namespace zip { * @throws IllegalArgumentException if the bufferSize value is zero. */ InflaterInputStream( decaf::io::InputStream* inputStream, Inflater* inflater, - std::size_t bufferSize, bool own = false ); + int bufferSize, bool own = false ); virtual ~InflaterInputStream(); @@ -113,7 +113,7 @@ namespace zip { * * Until EOF this method always returns 1, thereafter it always returns 0. */ - virtual std::size_t available() const throw ( decaf::io::IOException ); + virtual int available() const throw ( decaf::io::IOException ); /** * {@inheritDoc} @@ -127,7 +127,7 @@ namespace zip { * * Skips the specified amount of uncompressed input data. */ - virtual std::size_t skip( std::size_t num ) + virtual long long skip( long long num ) throw ( decaf::io::IOException, decaf::lang::exceptions::UnsupportedOperationException ); @@ -165,8 +165,7 @@ namespace zip { 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 ); Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/test-integration/activemq/test/openwire/OpenwireTempDestinationTest.cpp URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/test-integration/activemq/test/openwire/OpenwireTempDestinationTest.cpp?rev=925692&r1=925691&r2=925692&view=diff ============================================================================== --- activemq/activemq-cpp/trunk/activemq-cpp/src/test-integration/activemq/test/openwire/OpenwireTempDestinationTest.cpp (original) +++ activemq/activemq-cpp/trunk/activemq-cpp/src/test-integration/activemq/test/openwire/OpenwireTempDestinationTest.cpp Sat Mar 20 21:57:20 2010 @@ -208,34 +208,29 @@ void OpenwireTempDestinationTest::testBa /////////////////////////////////////////////////////////////////////////////// void OpenwireTempDestinationTest::testTwoConnections() { - try { + std::string destination = "REQUEST-TOPIC"; - std::string destination = "REQUEST-TOPIC"; + auto_ptr requester( + new Requester( cmsProvider->getBrokerURL(), destination, 10 ) ); + auto_ptr responder( + new Responder( cmsProvider->getBrokerURL(), destination, 10 ) ); - auto_ptr requester( - new Requester( cmsProvider->getBrokerURL(), destination, 10 ) ); - auto_ptr responder( - new Responder( cmsProvider->getBrokerURL(), destination, 10 ) ); + // Launch the Consumers in new Threads. + Thread requestorThread( requester.get() ); + requestorThread.start(); - // Launch the Consumers in new Threads. - Thread requestorThread( requester.get() ); - requestorThread.start(); + // Responder should get all its requests first + responder->awaitAllRequests(); - // Responder should get all its requests first - responder->awaitAllRequests(); + // Now the Requester should get all its responses. + requester->awaitAllResponses(); - // Now the Requester should get all its responses. - requester->awaitAllResponses(); + // Check that the responder received all the required requests + CPPUNIT_ASSERT( responder->getNumReceived() == 10 ); - // Check that the responder received all the required requests - CPPUNIT_ASSERT( responder->getNumReceived() == 10 ); + // Check that the requester received all the required responses + CPPUNIT_ASSERT( requester->getNumReceived() == 10 ); - // Check that the requester received all the required responses - CPPUNIT_ASSERT( requester->getNumReceived() == 10 ); - - // Shutdown the Requester. - requestorThread.join(); - } - AMQ_CATCH_RETHROW( ActiveMQException ) - AMQ_CATCHALL_THROW( ActiveMQException ) + // Shutdown the Requester. + requestorThread.join(); } Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/test/Makefile.am URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/test/Makefile.am?rev=925692&r1=925691&r2=925692&view=diff ============================================================================== --- activemq/activemq-cpp/trunk/activemq-cpp/src/test/Makefile.am (original) +++ activemq/activemq-cpp/trunk/activemq-cpp/src/test/Makefile.am Sat Mar 20 21:57:20 2010 @@ -71,7 +71,6 @@ cc_sources = \ decaf/internal/net/URIHelperTest.cpp \ decaf/internal/nio/BufferFactoryTest.cpp \ decaf/internal/nio/ByteArrayBufferTest.cpp \ - decaf/internal/nio/ByteArrayPerspectiveTest.cpp \ decaf/internal/nio/CharArrayBufferTest.cpp \ decaf/internal/nio/DoubleArrayBufferTest.cpp \ decaf/internal/nio/FloatArrayBufferTest.cpp \ @@ -218,7 +217,6 @@ h_sources = \ decaf/internal/net/URIHelperTest.h \ decaf/internal/nio/BufferFactoryTest.h \ decaf/internal/nio/ByteArrayBufferTest.h \ - decaf/internal/nio/ByteArrayPerspectiveTest.h \ decaf/internal/nio/CharArrayBufferTest.h \ decaf/internal/nio/DoubleArrayBufferTest.h \ decaf/internal/nio/FloatArrayBufferTest.h \ Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/test/decaf/internal/nio/BufferFactoryTest.cpp URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/test/decaf/internal/nio/BufferFactoryTest.cpp?rev=925692&r1=925691&r2=925692&view=diff ============================================================================== --- activemq/activemq-cpp/trunk/activemq-cpp/src/test/decaf/internal/nio/BufferFactoryTest.cpp (original) +++ activemq/activemq-cpp/trunk/activemq-cpp/src/test/decaf/internal/nio/BufferFactoryTest.cpp Sat Mar 20 21:57:20 2010 @@ -61,7 +61,7 @@ void BufferFactoryTest::testCreateByteBu std::vector array; array.resize( 500 ); - ByteBuffer* buffer = BufferFactory::createByteBuffer( &array[0], 100, 400 ); + ByteBuffer* buffer = BufferFactory::createByteBuffer( &array[0], 500, 100, 400 ); CPPUNIT_ASSERT( buffer != NULL ); CPPUNIT_ASSERT( buffer->hasArray() == true ); CPPUNIT_ASSERT( buffer->array() == &array[0] );