diff options
author | Charles E. Rolke <chug@apache.org> | 2011-10-17 20:55:17 +0000 |
---|---|---|
committer | Charles E. Rolke <chug@apache.org> | 2011-10-17 20:55:17 +0000 |
commit | b7bc31df25274935c2c00f9afcc1aad37bd93354 (patch) | |
tree | b8f36e6e1b59f02663cbca51cff917bb9403bd47 /cpp/src | |
parent | 0e3531d5da3a1de2cbde54c07c37e56a1315faf7 (diff) | |
download | qpid-python-b7bc31df25274935c2c00f9afcc1aad37bd93354.tar.gz |
QPID-2323 Add Uuid to variant
This patch adds a const_cast to the Uuid buffer references.
On Solaris the Uuid library calls take non-const args.
See also r881679 for related Solaris fix-ups.
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@1185373 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/src')
-rw-r--r-- | cpp/src/qpid/framing/Uuid.cpp | 4 | ||||
-rw-r--r-- | cpp/src/qpid/types/Uuid.cpp | 18 |
2 files changed, 15 insertions, 7 deletions
diff --git a/cpp/src/qpid/framing/Uuid.cpp b/cpp/src/qpid/framing/Uuid.cpp index 945c0a4d24..b3d1e2e1e4 100644 --- a/cpp/src/qpid/framing/Uuid.cpp +++ b/cpp/src/qpid/framing/Uuid.cpp @@ -59,7 +59,9 @@ void Uuid::clear() { // Force int 0/!0 to false/true; avoids compile warnings. bool Uuid::isNull() const { - return !!uuid_is_null(data()); + // This const cast is for Solaris which has a + // uuid_is_null that takes a non const argument + return !!uuid_is_null(const_cast<uint8_t*>(data())); } void Uuid::encode(Buffer& buf) const { diff --git a/cpp/src/qpid/types/Uuid.cpp b/cpp/src/qpid/types/Uuid.cpp index 9face4e5d2..74fddddcd0 100644 --- a/cpp/src/qpid/types/Uuid.cpp +++ b/cpp/src/qpid/types/Uuid.cpp @@ -71,7 +71,8 @@ void Uuid::clear() // Force int 0/!0 to false/true; avoids compile warnings. bool Uuid::isNull() const { - return !!uuid_is_null(bytes); + // This const cast is for Solaris which has non const arguments + return !!uuid_is_null(const_cast<uint8_t*>(bytes)); } Uuid::operator bool() const { return !isNull(); } @@ -86,7 +87,8 @@ const unsigned char* Uuid::data() const bool operator==(const Uuid& a, const Uuid& b) { - return uuid_compare(a.bytes, b.bytes) == 0; + // This const cast is for Solaris which has non const arguments + return uuid_compare(const_cast<uint8_t*>(a.bytes), const_cast<uint8_t*>(b.bytes)) == 0; } bool operator!=(const Uuid& a, const Uuid& b) @@ -96,22 +98,26 @@ bool operator!=(const Uuid& a, const Uuid& b) bool operator<(const Uuid& a, const Uuid& b) { - return uuid_compare(a.bytes, b.bytes) < 0; + // This const cast is for Solaris which has non const arguments + return uuid_compare(const_cast<uint8_t*>(a.bytes), const_cast<uint8_t*>(b.bytes)) < 0; } bool operator>(const Uuid& a, const Uuid& b) { - return uuid_compare(a.bytes, b.bytes) > 0; + // This const cast is for Solaris which has non const arguments + return uuid_compare(const_cast<uint8_t*>(a.bytes), const_cast<uint8_t*>(b.bytes)) > 0; } bool operator<=(const Uuid& a, const Uuid& b) { - return uuid_compare(a.bytes, b.bytes) <= 0; + // This const cast is for Solaris which has non const arguments + return uuid_compare(const_cast<uint8_t*>(a.bytes), const_cast<uint8_t*>(b.bytes)) <= 0; } bool operator>=(const Uuid& a, const Uuid& b) { - return uuid_compare(a.bytes, b.bytes) >= 0; + // This const cast is for Solaris which has non const arguments + return uuid_compare(const_cast<uint8_t*>(a.bytes), const_cast<uint8_t*>(b.bytes)) >= 0; } ostream& operator<<(ostream& out, Uuid uuid) |