1 From 898b2bdd10edff5da7b3093cacbd2e5db46cd0ff Mon Sep 17 00:00:00 2001
2 From: =?UTF-8?q?Fatih=20A=C5=9F=C4=B1c=C4=B1?= <fatih.asici@gmail.com>
3 Date: Thu, 22 Jan 2015 13:14:41 +0200
4 Subject: [PATCH] Fix build with -no-c++11
8 - Enum type names cannot be used as namespaces. Use old style naming.
9 - For errno, errno.h must be included.
10 - stdint.h must be included to use uint*_t types. Use quint*
13 Change-Id: I992f531a46cfc997df0aa6fc7ff6bf75fb750fc6
14 Sent-Upstream: https://codereview.qt-project.org/104254
15 Signed-off-by: Fatih Aşıcı <fatih.asici@gmail.com>
17 src/bluetooth/bluez/bluez5_helper.cpp | 16 ++---
18 src/bluetooth/bluez/bluez_data_p.h | 94 ++++++++++++++--------------
19 src/bluetooth/bluez/hcimanager.cpp | 1 +
20 src/bluetooth/qlowenergycontroller_bluez.cpp | 2 +
21 4 files changed, 58 insertions(+), 55 deletions(-)
23 diff --git a/src/bluetooth/bluez/bluez5_helper.cpp b/src/bluetooth/bluez/bluez5_helper.cpp
24 index eebeae9..0e3c006 100644
25 --- a/src/bluetooth/bluez/bluez5_helper.cpp
26 +++ b/src/bluetooth/bluez/bluez5_helper.cpp
27 @@ -45,16 +45,16 @@ Q_DECLARE_LOGGING_CATEGORY(QT_BT_BLUEZ)
29 typedef enum Bluez5TestResultType
34 + BluezVersionUnknown,
39 -Q_GLOBAL_STATIC_WITH_ARGS(Bluez5TestResult, bluezVersion, (Bluez5TestResult::Unknown));
40 +Q_GLOBAL_STATIC_WITH_ARGS(Bluez5TestResult, bluezVersion, (BluezVersionUnknown));
44 - if (*bluezVersion() == Bluez5TestResultType::Unknown) {
45 + if (*bluezVersion() == BluezVersionUnknown) {
46 OrgFreedesktopDBusObjectManagerInterface manager(QStringLiteral("org.bluez"),
48 QDBusConnection::systemBus());
49 @@ -65,15 +65,15 @@ bool isBluez5()
50 QDBusPendingReply<ManagedObjectList> reply = manager.GetManagedObjects();
51 reply.waitForFinished();
52 if (reply.isError()) {
53 - *bluezVersion() = Bluez5TestResultType::Bluez4;
54 + *bluezVersion() = BluezVersion4;
55 qCDebug(QT_BT_BLUEZ) << "Bluez 4 detected.";
57 - *bluezVersion() = Bluez5TestResultType::Bluez5;
58 + *bluezVersion() = BluezVersion5;
59 qCDebug(QT_BT_BLUEZ) << "Bluez 5 detected.";
63 - return (*bluezVersion() == Bluez5TestResultType::Bluez5);
64 + return (*bluezVersion() == BluezVersion5);
68 diff --git a/src/bluetooth/bluez/bluez_data_p.h b/src/bluetooth/bluez/bluez_data_p.h
69 index 7c79997..9d2d96b 100644
70 --- a/src/bluetooth/bluez/bluez_data_p.h
71 +++ b/src/bluetooth/bluez/bluez_data_p.h
81 #define BT_SECURITY_SDP 0
82 #define BT_SECURITY_LOW 1
83 @@ -162,14 +162,14 @@ static inline void ntoh128(const quint128 *src, quint128 *dst)
84 dst->data[15 - i] = src->data[i];
87 -static inline uint16_t bt_get_le16(const void *ptr)
88 +static inline quint16 bt_get_le16(const void *ptr)
90 - return bt_get_unaligned((const uint16_t *) ptr);
91 + return bt_get_unaligned((const quint16 *) ptr);
93 #elif __BYTE_ORDER == __BIG_ENDIAN
94 -static inline uint16_t bt_get_le16(const void *ptr)
95 +static inline quint16 bt_get_le16(const void *ptr)
97 - return bswap_16(bt_get_unaligned((const uint16_t *) ptr));
98 + return bswap_16(bt_get_unaligned((const quint16 *) ptr));
101 static inline void btoh128(const quint128 *src, quint128 *dst)
102 @@ -213,79 +213,79 @@ struct sockaddr_hci {
112 struct hci_dev_list_req {
115 struct hci_dev_req dev_req[0];
118 struct hci_dev_stats {
141 struct hci_dev_info {
153 - uint8_t features[8];
154 + quint8 features[8];
157 - uint32_t link_policy;
158 - uint32_t link_mode;
160 + quint32 link_policy;
172 struct hci_dev_stats stat;
175 struct hci_conn_info {
182 - uint32_t link_mode;
189 struct hci_conn_list_req {
194 struct hci_conn_info conn_info[0];
198 - uint32_t type_mask;
199 - uint32_t event_mask[2];
202 + quint32 event_mask[2];
206 static inline void hci_set_bit(int nr, void *addr)
208 - *((uint32_t *) addr + (nr >> 5)) |= (1 << (nr & 31));
209 + *((quint32 *) addr + (nr >> 5)) |= (1 << (nr & 31));
211 static inline void hci_clear_bit(int nr, void *addr)
213 - *((uint32_t *) addr + (nr >> 5)) &= ~(1 << (nr & 31));
214 + *((quint32 *) addr + (nr >> 5)) &= ~(1 << (nr & 31));
216 static inline void hci_filter_clear(struct hci_filter *f)
218 @@ -317,16 +317,16 @@ static inline void hci_filter_all_events(struct hci_filter *f)
226 } __attribute__ ((packed)) hci_event_hdr;
227 #define HCI_EVENT_HDR_SIZE 2
229 #define EVT_ENCRYPT_CHANGE 0x08
237 } __attribute__ ((packed)) evt_encrypt_change;
238 #define EVT_ENCRYPT_CHANGE_SIZE 4
240 diff --git a/src/bluetooth/bluez/hcimanager.cpp b/src/bluetooth/bluez/hcimanager.cpp
241 index 17d54a4..3245058 100644
242 --- a/src/bluetooth/bluez/hcimanager.cpp
243 +++ b/src/bluetooth/bluez/hcimanager.cpp
246 #include <QtCore/QLoggingCategory>
249 #include <sys/types.h>
250 #include <sys/socket.h>
251 #include <sys/ioctl.h>
252 diff --git a/src/bluetooth/qlowenergycontroller_bluez.cpp b/src/bluetooth/qlowenergycontroller_bluez.cpp
253 index 5629966..f22cea7 100644
254 --- a/src/bluetooth/qlowenergycontroller_bluez.cpp
255 +++ b/src/bluetooth/qlowenergycontroller_bluez.cpp
257 #include <QtBluetooth/QBluetoothSocket>
258 #include <QtBluetooth/QLowEnergyService>
262 #define ATTRIBUTE_CHANNEL_ID 4
264 #define ATT_DEFAULT_LE_MTU 23