summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIvan Solovev <ivan.solovev@qt.io>2023-07-11 12:47:11 +0200
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2023-07-11 22:02:25 +0000
commit6830106139c3286a662d910e8c39844799ca69d6 (patch)
tree8290000a002016fd346f2744e2c00e108de64968
parentae3bf860e9565084fecdaa22ba9b881da9caa33b (diff)
QBluetoothUuid: fix alignment of the custom quint128 struct
Updating the struct to contain the Id128Bytes member instead of an array of chars changes the alignment of the struct. Revert the struct to its original state, and update the code in removed_api.cpp to adapt to the changes. This commit partially reverts 1e903be81f43da4e31385bb7866bb4d3f07e5eba Change-Id: I638622ffa5320f8de3f7866109fcc384b557392e Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> (cherry picked from commit b23456ca14ae203df3228c51db2df55cb1f67d70) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
-rw-r--r--src/bluetooth/qbluetoothuuid.h2
-rw-r--r--src/bluetooth/removed_api.cpp7
2 files changed, 6 insertions, 3 deletions
diff --git a/src/bluetooth/qbluetoothuuid.h b/src/bluetooth/qbluetoothuuid.h
index 43fbff5c..7717410e 100644
--- a/src/bluetooth/qbluetoothuuid.h
+++ b/src/bluetooth/qbluetoothuuid.h
@@ -21,7 +21,7 @@ QT_BEGIN_NAMESPACE
#if QT_BLUETOOTH_REMOVED_SINCE(6, 6)
struct quint128
{
- QUuid::Id128Bytes d;
+ quint8 data[16];
};
#endif
diff --git a/src/bluetooth/removed_api.cpp b/src/bluetooth/removed_api.cpp
index a1676c7d..2a346424 100644
--- a/src/bluetooth/removed_api.cpp
+++ b/src/bluetooth/removed_api.cpp
@@ -24,11 +24,14 @@ static_assert(std::is_aggregate_v<quint128>);
static_assert(std::is_trivial_v<quint128>);
QBluetoothUuid::QBluetoothUuid(quint128 uuid)
- : QUuid(uuid.d)
+ : QUuid(fromBytes(uuid.data))
{}
quint128 QBluetoothUuid::toUInt128() const
{
- return { toBytes() };
+ quint128 uuid;
+ const auto bytes = toBytes();
+ memcpy(uuid.data, bytes.data, sizeof(uuid.data));
+ return uuid;
}
#endif // QT_BLUETOOTH_REMOVED_SINCE(6, 6)