summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Stitcher <astitcher@apache.org>2011-05-09 19:56:11 +0000
committerAndrew Stitcher <astitcher@apache.org>2011-05-09 19:56:11 +0000
commit35f91f5e74abfc0c0214e5d7eaf1bad69405801b (patch)
tree6e9aa97ddf6abdf042a27e33ab7f799cb25f430d
parentb66bd995ff224ee7c34fbd1d9eae87d908707a60 (diff)
downloadqpid-python-35f91f5e74abfc0c0214e5d7eaf1bad69405801b.tar.gz
QPID-3004: Get Clang to compile qpid c++
- Add new template function for FieldValue::getIntegerValue() to avoid compile error when extracting into 1 byte ints. git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@1101183 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--qpid/cpp/include/qpid/framing/FieldValue.h13
-rw-r--r--qpid/cpp/src/qpid/amqp_0_10/Codecs.cpp6
-rw-r--r--qpid/cpp/src/qpid/management/ManagementAgent.cpp6
3 files changed, 19 insertions, 6 deletions
diff --git a/qpid/cpp/include/qpid/framing/FieldValue.h b/qpid/cpp/include/qpid/framing/FieldValue.h
index 19220e74d5..e6255066c4 100644
--- a/qpid/cpp/include/qpid/framing/FieldValue.h
+++ b/qpid/cpp/include/qpid/framing/FieldValue.h
@@ -98,6 +98,7 @@ class FieldValue {
template <typename T> T get() const { throw InvalidConversionException(); }
template <class T, int W> T getIntegerValue() const;
+ template <class T> T getIntegerValue() const;
template <class T, int W> T getFloatingPointValue() const;
template <int W> void getFixedWidthValue(unsigned char*) const;
template <class T> bool get(T&) const;
@@ -196,6 +197,18 @@ inline T FieldValue::getIntegerValue() const
}
}
+template <class T>
+inline T FieldValue::getIntegerValue() const
+{
+ FixedWidthValue<1>* const fwv = dynamic_cast< FixedWidthValue<1>* const>(data.get());
+ if (fwv) {
+ uint8_t* octets = fwv->rawOctets();
+ return octets[0];
+ } else {
+ throw InvalidConversionException();
+ }
+}
+
template <class T, int W>
inline T FieldValue::getFloatingPointValue() const {
FixedWidthValue<W>* const fwv = dynamic_cast< FixedWidthValue<W>* const>(data.get());
diff --git a/qpid/cpp/src/qpid/amqp_0_10/Codecs.cpp b/qpid/cpp/src/qpid/amqp_0_10/Codecs.cpp
index 0fbe2a60b9..b976a5d09b 100644
--- a/qpid/cpp/src/qpid/amqp_0_10/Codecs.cpp
+++ b/qpid/cpp/src/qpid/amqp_0_10/Codecs.cpp
@@ -127,10 +127,10 @@ Variant toVariant(boost::shared_ptr<FieldValue> in)
switch (in->getType()) {
//Fixed Width types:
case 0x01: out.setEncoding(amqp0_10_binary);
- case 0x02: out = in->getIntegerValue<int8_t, 1>(); break;
- case 0x03: out = in->getIntegerValue<uint8_t, 1>(); break;
+ case 0x02: out = in->getIntegerValue<int8_t>(); break;
+ case 0x03: out = in->getIntegerValue<uint8_t>(); break;
case 0x04: break; //TODO: iso-8859-15 char
- case 0x08: out = static_cast<bool>(in->getIntegerValue<uint8_t, 1>()); break;
+ case 0x08: out = static_cast<bool>(in->getIntegerValue<uint8_t>()); break;
case 0x10: out.setEncoding(amqp0_10_binary);
case 0x11: out = in->getIntegerValue<int16_t, 2>(); break;
case 0x12: out = in->getIntegerValue<uint16_t, 2>(); break;
diff --git a/qpid/cpp/src/qpid/management/ManagementAgent.cpp b/qpid/cpp/src/qpid/management/ManagementAgent.cpp
index 7c9771fe79..8a12a57fa6 100644
--- a/qpid/cpp/src/qpid/management/ManagementAgent.cpp
+++ b/qpid/cpp/src/qpid/management/ManagementAgent.cpp
@@ -2861,10 +2861,10 @@ Variant ManagementAgent::toVariant(const boost::shared_ptr<FieldValue>& in)
//Fixed Width types:
case 0x00: //bin8
case 0x01: out.setEncoding(amqp0_10_binary); // int8
- case 0x02: out = in->getIntegerValue<int8_t, 1>(); break; //uint8
- case 0x03: out = in->getIntegerValue<uint8_t, 1>(); break; //
+ case 0x02: out = in->getIntegerValue<int8_t>(); break; //uint8
+ case 0x03: out = in->getIntegerValue<uint8_t>(); break; //
// case 0x04: break; //TODO: iso-8859-15 char // char
- case 0x08: out = static_cast<bool>(in->getIntegerValue<uint8_t, 1>()); break; // bool int8
+ case 0x08: out = static_cast<bool>(in->getIntegerValue<uint8_t>()); break; // bool int8
case 0x10: out.setEncoding(amqp0_10_binary); // bin16
case 0x11: out = in->getIntegerValue<int16_t, 2>(); break; // int16