[Cmake-commits] CMake branch, next, updated. v3.0.1-5037-g79e24c9
Nils Gladitz
nilsgladitz at gmail.com
Wed Aug 27 08:29:15 EDT 2014
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "CMake".
The branch, next has been updated
via 79e24c9ca3cf87a9302463517aa1728f3191e9ae (commit)
via 210f6b7bff84e9f04f39e2aed6f839613e471c19 (commit)
from 8b64fbe1ad28882bdf8880f113d29d78b5130f8b (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=79e24c9ca3cf87a9302463517aa1728f3191e9ae
commit 79e24c9ca3cf87a9302463517aa1728f3191e9ae
Merge: 8b64fbe 210f6b7
Author: Nils Gladitz <nilsgladitz at gmail.com>
AuthorDate: Wed Aug 27 08:29:14 2014 -0400
Commit: CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Wed Aug 27 08:29:14 2014 -0400
Merge topic 'string-uuid' into next
210f6b7b StringUuid: Work around missing std::hex
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=210f6b7bff84e9f04f39e2aed6f839613e471c19
commit 210f6b7bff84e9f04f39e2aed6f839613e471c19
Author: Nils Gladitz <nilsgladitz at gmail.com>
AuthorDate: Wed Aug 27 14:28:37 2014 +0200
Commit: Nils Gladitz <nilsgladitz at gmail.com>
CommitDate: Wed Aug 27 14:28:37 2014 +0200
StringUuid: Work around missing std::hex
diff --git a/Source/cmUuid.cxx b/Source/cmUuid.cxx
index e3d5393..8f208e4 100644
--- a/Source/cmUuid.cxx
+++ b/Source/cmUuid.cxx
@@ -123,29 +123,43 @@ bool cmUuid::StringToBinary(std::string const& input,
std::string cmUuid::BinaryToString(const unsigned char* input) const
{
- std::stringstream output;
+ std::string output;
size_t inputIndex = 0;
for(size_t i = 0; i < this->Groups.size(); ++i)
{
if(i != 0)
{
- output << "-";
+ output += '-';
}
size_t bytes = this->Groups[i];
for(size_t j = 0; j < bytes; ++j)
{
int byte = input[inputIndex++];
- if(byte <= 0xF)
- {
- output << "0";
- }
- output << std::hex << byte;
+ output += this->ByteToHex(byte);
}
}
- return output.str();
+ return output;
+}
+
+std::string cmUuid::ByteToHex(int byte) const
+{
+ std::string result;
+ for(int i = 0; i < 2; ++i)
+ {
+ int rest = byte % 16;
+ byte /= 16;
+
+ char c = (rest < 0xA) ?
+ '0' + rest :
+ 'a' + (rest - 0xA);
+
+ result = c + result;
+ }
+
+ return result;
}
bool cmUuid::StringToBinaryImpl(std::string const& input,
diff --git a/Source/cmUuid.h b/Source/cmUuid.h
index 9e15415..10b5c96 100644
--- a/Source/cmUuid.h
+++ b/Source/cmUuid.h
@@ -34,6 +34,8 @@ public:
std::vector<unsigned char> &output) const;
private:
+ std::string ByteToHex(int byte) const;
+
void CreateHashInput(std::vector<unsigned char> const& uuidNamespace,
std::string const& name, std::vector<unsigned char> &output) const;
-----------------------------------------------------------------------
Summary of changes:
Source/cmUuid.cxx | 30 ++++++++++++++++++++++--------
Source/cmUuid.h | 2 ++
2 files changed, 24 insertions(+), 8 deletions(-)
hooks/post-receive
--
CMake
More information about the Cmake-commits
mailing list