Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Apply patch: https://issues.apache.org/jira/browse/AMQCPP-375

git-svn-id: https://svn.apache.org/repos/asf/activemq/activemq-cpp/trunk@1325978 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information...
commit 6556f8c5a309622720e2b4d9bdff58d294d17ad1 1 parent ee0810f
Timothy A. Bish authored
View
7 activemq-cpp/src/main/decaf/lang/Integer.cpp
@@ -193,9 +193,10 @@ std::string Integer::toBinaryString( int value ) {
std::string Integer::toOctalString( int value ) {
int count = 1, j = value;
+ unsigned int uvalue = (unsigned int) value;
if( value < 0 ) {
- count = 11;
+ count = 11; // (8 * sizeof(value) + 2) / 3;
} else {
while ( (j >>= 3) != 0 ) {
count++;
@@ -208,8 +209,8 @@ std::string Integer::toOctalString( int value ) {
char* buffer = new char[length + 1];
do {
- buffer[--count] = (char)( (value & 7) + '0' );
- value >>= 3;
+ buffer[--count] = (char)( (uvalue & 7) + '0' );
+ uvalue >>= 3;
} while( count > 0 );
// Ensure there's a null
View
9 activemq-cpp/src/main/decaf/lang/Long.cpp
@@ -378,7 +378,7 @@ std::string Long::toBinaryString( long long value ) {
long long j = value;
if( value < 0 ) {
- count = 32;
+ count = 64; // 8 * sizeof(long long);
} else {
while ( (j >>= 1) != 0) {
count++;
@@ -408,9 +408,10 @@ std::string Long::toOctalString( long long value ) {
int count = 1;
long long j = value;
+ unsigned long long uvalue = (unsigned long long) value;
if( value < 0 ) {
- count = 11;
+ count = 22; // (8 * sizeof(long long) + 2) / 3;
} else {
while ( (j >>= 3) != 0 ) {
count++;
@@ -424,7 +425,7 @@ std::string Long::toOctalString( long long value ) {
do {
buffer[--count] = (char)( (value & 7) + '0' );
- value >>= 3;
+ uvalue >>= 3;
} while( count > 0 );
// Ensure there's a null
@@ -442,7 +443,7 @@ std::string Long::toHexString( long long value ) {
long long j = value;
if( value < 0 ) {
- count = 8;
+ count = 16; // 8 * sizeof(long long) / 4
} else {
while( (j >>= 4) != 0 ) {
count++;
Please sign in to comment.
Something went wrong with that request. Please try again.