You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by ta...@apache.org on 2014/08/07 00:32:50 UTC
[1/2] git commit: Clean up a bit, remove unneeded int temporary.
Repository: activemq-cpp
Updated Branches:
refs/heads/3.8.x 857c9129b -> 5dee6c54a
refs/heads/trunk 9c2706139 -> 7b7538ad2
Clean up a bit, remove unneeded int temporary.
Project: http://git-wip-us.apache.org/repos/asf/activemq-cpp/repo
Commit: http://git-wip-us.apache.org/repos/asf/activemq-cpp/commit/7b7538ad
Tree: http://git-wip-us.apache.org/repos/asf/activemq-cpp/tree/7b7538ad
Diff: http://git-wip-us.apache.org/repos/asf/activemq-cpp/diff/7b7538ad
Branch: refs/heads/trunk
Commit: 7b7538ad26602a46149b2efbd712d9b0f683ed80
Parents: 9c27061
Author: Timothy Bish <ta...@gmail.com>
Authored: Wed Aug 6 18:20:23 2014 -0400
Committer: Timothy Bish <ta...@gmail.com>
Committed: Wed Aug 6 18:20:23 2014 -0400
----------------------------------------------------------------------
activemq-cpp/src/main/decaf/lang/Integer.cpp | 28 +++++++----------------
1 file changed, 8 insertions(+), 20 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/activemq-cpp/blob/7b7538ad/activemq-cpp/src/main/decaf/lang/Integer.cpp
----------------------------------------------------------------------
diff --git a/activemq-cpp/src/main/decaf/lang/Integer.cpp b/activemq-cpp/src/main/decaf/lang/Integer.cpp
index 68ce6a5..7992d80 100644
--- a/activemq-cpp/src/main/decaf/lang/Integer.cpp
+++ b/activemq-cpp/src/main/decaf/lang/Integer.cpp
@@ -140,10 +140,7 @@ std::string Integer::toString(int value, int radix) {
count++;
}
- // Save length and allocate a new buffer for the string, add one
- // more for the null character.
- int length = count;
- std::vector<char> buffer(length);
+ std::vector<char> buffer(count);
do {
int ch = 0 - (j % radix);
@@ -159,7 +156,7 @@ std::string Integer::toString(int value, int radix) {
buffer[0] = '-';
}
- return std::string(&buffer[0], length);
+ return std::string(&buffer[0], buffer.size());
}
////////////////////////////////////////////////////////////////////////////////
@@ -176,17 +173,14 @@ std::string Integer::toBinaryString(int value) {
}
}
- // Save length and allocate a new buffer for the string, add one
- // more for the null character.
- int length = count;
- std::vector<char> buffer(length);
+ std::vector<char> buffer(count);
do {
buffer[--count] = (char) ((value & 1) + '0');
value >>= 1;
} while (count > 0);
- return std::string(&buffer[0], length);
+ return std::string(&buffer[0], buffer.size());
}
////////////////////////////////////////////////////////////////////////////////
@@ -203,17 +197,14 @@ std::string Integer::toOctalString(int value) {
}
}
- // Save length and allocate a new buffer for the string, add one
- // more for the null character.
- int length = count;
- std::vector<char> buffer(length);
+ std::vector<char> buffer(count);
do {
buffer[--count] = (char) ((uvalue & 7) + '0');
uvalue >>= 3;
} while (count > 0);
- return std::string(&buffer[0], length);
+ return std::string(&buffer[0], buffer.size());
}
////////////////////////////////////////////////////////////////////////////////
@@ -230,10 +221,7 @@ std::string Integer::toHexString(int value) {
}
}
- // Save length and allocate a new buffer for the string, add one
- // more for the null character.
- int length = count;
- std::vector<char> buffer(length);
+ std::vector<char> buffer(count);
do {
int t = value & 15;
@@ -246,7 +234,7 @@ std::string Integer::toHexString(int value) {
value >>= 4;
} while (count > 0);
- return std::string(&buffer[0], length);
+ return std::string(&buffer[0], buffer.size());
}
////////////////////////////////////////////////////////////////////////////////
[2/2] git commit: Clean up a bit, remove unneeded int temporary.
Posted by ta...@apache.org.
Clean up a bit, remove unneeded int temporary.
Project: http://git-wip-us.apache.org/repos/asf/activemq-cpp/repo
Commit: http://git-wip-us.apache.org/repos/asf/activemq-cpp/commit/5dee6c54
Tree: http://git-wip-us.apache.org/repos/asf/activemq-cpp/tree/5dee6c54
Diff: http://git-wip-us.apache.org/repos/asf/activemq-cpp/diff/5dee6c54
Branch: refs/heads/3.8.x
Commit: 5dee6c54a8a379c1217494f20b501f742551f41a
Parents: 857c912
Author: Timothy Bish <ta...@gmail.com>
Authored: Wed Aug 6 18:20:23 2014 -0400
Committer: Timothy Bish <ta...@gmail.com>
Committed: Wed Aug 6 18:20:57 2014 -0400
----------------------------------------------------------------------
activemq-cpp/src/main/decaf/lang/Integer.cpp | 28 +++++++----------------
1 file changed, 8 insertions(+), 20 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/activemq-cpp/blob/5dee6c54/activemq-cpp/src/main/decaf/lang/Integer.cpp
----------------------------------------------------------------------
diff --git a/activemq-cpp/src/main/decaf/lang/Integer.cpp b/activemq-cpp/src/main/decaf/lang/Integer.cpp
index fadf6d0..cedb6f0 100644
--- a/activemq-cpp/src/main/decaf/lang/Integer.cpp
+++ b/activemq-cpp/src/main/decaf/lang/Integer.cpp
@@ -136,10 +136,7 @@ std::string Integer::toString(int value, int radix) {
count++;
}
- // Save length and allocate a new buffer for the string, add one
- // more for the null character.
- int length = count;
- std::vector<char> buffer(length);
+ std::vector<char> buffer(count);
do {
int ch = 0 - (j % radix);
@@ -155,7 +152,7 @@ std::string Integer::toString(int value, int radix) {
buffer[0] = '-';
}
- return std::string(&buffer[0], length);
+ return std::string(&buffer[0], buffer.size());
}
////////////////////////////////////////////////////////////////////////////////
@@ -172,17 +169,14 @@ std::string Integer::toBinaryString(int value) {
}
}
- // Save length and allocate a new buffer for the string, add one
- // more for the null character.
- int length = count;
- std::vector<char> buffer(length);
+ std::vector<char> buffer(count);
do {
buffer[--count] = (char) ((value & 1) + '0');
value >>= 1;
} while (count > 0);
- return std::string(&buffer[0], length);
+ return std::string(&buffer[0], buffer.size());
}
////////////////////////////////////////////////////////////////////////////////
@@ -199,17 +193,14 @@ std::string Integer::toOctalString(int value) {
}
}
- // Save length and allocate a new buffer for the string, add one
- // more for the null character.
- int length = count;
- std::vector<char> buffer(length);
+ std::vector<char> buffer(count);
do {
buffer[--count] = (char) ((uvalue & 7) + '0');
uvalue >>= 3;
} while (count > 0);
- return std::string(&buffer[0], length);
+ return std::string(&buffer[0], buffer.size());
}
////////////////////////////////////////////////////////////////////////////////
@@ -226,10 +217,7 @@ std::string Integer::toHexString(int value) {
}
}
- // Save length and allocate a new buffer for the string, add one
- // more for the null character.
- int length = count;
- std::vector<char> buffer(length);
+ std::vector<char> buffer(count);
do {
int t = value & 15;
@@ -242,7 +230,7 @@ std::string Integer::toHexString(int value) {
value >>= 4;
} while (count > 0);
- return std::string(&buffer[0], length);
+ return std::string(&buffer[0], buffer.size());
}
////////////////////////////////////////////////////////////////////////////////