From 269ebc04b9082e0081f3660bd727d9a6bc4a683d Mon Sep 17 00:00:00 2001 From: Oliver Tappe Date: Thu, 19 Aug 2010 15:29:02 +0000 Subject: [PATCH] Fix #6373, second try * make BDADDR_* macros refer to value types instead of addresses * adjust all interfaces using bdaddr_t* to use (mostly const) refs instead, which IMHO makes the interface & code clearer * that got rid of a couple of const incorrectness casts * some cleanup along the way git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@38265 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- build/jam/BuildSetup | 19 +-------- headers/os/bluetooth/bdaddrUtils.h | 8 ++-- headers/os/bluetooth/bluetooth.h | 6 +-- headers/private/bluetooth/btCoreData.h | 26 ++++++++----- .../bluetooth/btCoreData/BTCoreData.cpp | 4 +- .../btCoreData/ConnectionInterface.cpp | 16 ++++---- .../btCoreData/ConnectionInterface.h | 8 ++-- .../network/protocols/l2cap/L2capEndpoint.cpp | 4 +- .../network/protocols/l2cap/l2cap_address.cpp | 12 +++--- src/kits/bluetooth/DiscoveryListener.cpp | 39 ++++++++++++------- src/kits/bluetooth/RemoteDevice.cpp | 6 +-- src/preferences/bluetooth/DeviceListItem.cpp | 3 +- src/servers/bluetooth/BluetoothServer.cpp | 2 +- src/servers/bluetooth/LocalDeviceImpl.cpp | 2 +- 14 files changed, 77 insertions(+), 78 deletions(-) diff --git a/build/jam/BuildSetup b/build/jam/BuildSetup index b4f64be060..ca75b693d5 100644 --- a/build/jam/BuildSetup +++ b/build/jam/BuildSetup @@ -1198,6 +1198,7 @@ if $(HAIKU_NO_WERROR) != 1 { EnableWerror src add-ons input_server devices ; # EnableWerror src add-ons input_server filters ; # EnableWerror src add-ons input_server methods ; + EnableWerror src add-ons kernel bluetooth ; # EnableWerror src add-ons kernel bus_managers acpi ; EnableWerror src add-ons kernel bus_managers agp_gart ; EnableWerror src add-ons kernel bus_managers ata ; @@ -1391,23 +1392,7 @@ if $(HAIKU_NO_WERROR) != 1 { # EnableWerror src kits tracker ; EnableWerror src kits translation ; EnableWerror src preferences ; - EnableWerror src servers app ; -# EnableWerror src servers bluetooth ; - EnableWerror src servers cddb_daemon ; - EnableWerror src servers debug ; - EnableWerror src servers input ; - EnableWerror src servers mail ; - EnableWerror src servers media ; - EnableWerror src servers media_addon ; - EnableWerror src servers midi ; - EnableWerror src servers mount ; - EnableWerror src servers net ; - EnableWerror src servers notification ; - EnableWerror src servers power ; - EnableWerror src servers print ; - EnableWerror src servers registrar ; - EnableWerror src servers services_daemon ; - EnableWerror src servers syslog_daemon ; + EnableWerror src servers ; EnableWerror src system kernel ; EnableWerror src system runtime_loader ; } diff --git a/headers/os/bluetooth/bdaddrUtils.h b/headers/os/bluetooth/bdaddrUtils.h index 26a8328a26..cec9fb8a69 100644 --- a/headers/os/bluetooth/bdaddrUtils.h +++ b/headers/os/bluetooth/bdaddrUtils.h @@ -34,15 +34,15 @@ public: } - static bool Compare(const bdaddr_t* ba1, const bdaddr_t* ba2) + static bool Compare(const bdaddr_t& ba1, const bdaddr_t& ba2) { - return (memcmp(ba1, ba2, sizeof(bdaddr_t)) == 0); + return (memcmp(&ba1, &ba2, sizeof(bdaddr_t)) == 0); } - static void Copy(bdaddr_t* dst, const bdaddr_t* src) + static void Copy(bdaddr_t& dst, const bdaddr_t& src) { - memcpy(dst, src, sizeof(bdaddr_t)); + memcpy(&dst, &src, sizeof(bdaddr_t)); } static char* ToString(const bdaddr_t bdaddr) diff --git a/headers/os/bluetooth/bluetooth.h b/headers/os/bluetooth/bluetooth.h index 493af88ada..72f18559de 100644 --- a/headers/os/bluetooth/bluetooth.h +++ b/headers/os/bluetooth/bluetooth.h @@ -25,9 +25,9 @@ typedef struct { } __attribute__((packed)) bdaddr_t; -#define BDADDR_NULL (&(bdaddr_t) {{0, 0, 0, 0, 0, 0}}) -#define BDADDR_LOCAL (&(bdaddr_t) {{0, 0, 0, 0xff, 0xff, 0xff}}) -#define BDADDR_BROADCAST (&(bdaddr_t) {{0xff, 0xff, 0xff, 0xff, 0xff, 0xff}}) +#define BDADDR_NULL ((bdaddr_t) {{0, 0, 0, 0, 0, 0}}) +#define BDADDR_LOCAL ((bdaddr_t) {{0, 0, 0, 0xff, 0xff, 0xff}}) +#define BDADDR_BROADCAST ((bdaddr_t) {{0xff, 0xff, 0xff, 0xff, 0xff, 0xff}}) #define BDADDR_ANY BDADDR_BROADCAST diff --git a/headers/private/bluetooth/btCoreData.h b/headers/private/bluetooth/btCoreData.h index d037b6eda5..6e0762ab63 100644 --- a/headers/private/bluetooth/btCoreData.h +++ b/headers/private/bluetooth/btCoreData.h @@ -5,6 +5,7 @@ #ifndef _BTCOREDATA_H #define _BTCOREDATA_H + #include #include #include @@ -18,8 +19,10 @@ #include #include + #define BT_CORE_DATA_MODULE_NAME "bluetooth/btCoreData/v1" + struct L2capChannel; struct L2capFrame; struct L2capEndpoint; @@ -29,6 +32,7 @@ typedef enum _connection_status { HCI_CONN_OPEN, } connection_status; + #ifdef __cplusplus struct HciConnection : DoublyLinkedListLinkImpl { @@ -138,12 +142,12 @@ struct bluetooth_core_data_module_info { status_t (*PostEvent)(bluetooth_device* ndev, void* event, size_t size); struct HciConnection* (*AddConnection)(uint16 handle, int type, - bdaddr_t* dst, hci_id hid); + const bdaddr_t& dst, hci_id hid); // status_t (*RemoveConnection)(bdaddr_t destination, hci_id hid); status_t (*RemoveConnection)(uint16 handle, hci_id hid); - hci_id (*RouteConnection)(const bdaddr_t* destination); + hci_id (*RouteConnection)(const bdaddr_t& destination); void (*SetAclBuffer)(struct HciConnection* conn, net_buffer* nbuf); @@ -155,8 +159,8 @@ struct bluetooth_core_data_module_info { bool (*AclOverFlowed)(struct HciConnection* conn); struct HciConnection* (*ConnectionByHandle)(uint16 handle, hci_id hid); - struct HciConnection* (*ConnectionByDestination)(const bdaddr_t* destination, - hci_id hid); + struct HciConnection* (*ConnectionByDestination)( + const bdaddr_t& destination, hci_id hid); struct L2capChannel* (*AddChannel)(struct HciConnection* conn, uint16 psm); @@ -169,20 +173,24 @@ struct bluetooth_core_data_module_info { struct L2capFrame* (*SignalByIdent)(struct HciConnection* conn, uint8 ident); - status_t (*TimeoutSignal)(struct L2capFrame* frame, uint32 timeo); + status_t (*TimeoutSignal)(struct L2capFrame* frame, + uint32 timeo); status_t (*UnTimeoutSignal)(struct L2capFrame* frame); struct L2capFrame* (*SpawnFrame)(struct HciConnection* conn, - struct L2capChannel* channel, net_buffer* buffer, frame_type frame); + struct L2capChannel* channel, + net_buffer* buffer, frame_type frame); struct L2capFrame* (*SpawnSignal)(struct HciConnection* conn, - struct L2capChannel* channel, net_buffer* buffer, - uint8 ident, uint8 code); + struct L2capChannel* channel, + net_buffer* buffer, uint8 ident, uint8 code); status_t (*AcknowledgeSignal)(struct L2capFrame* frame); status_t (*QueueSignal)(struct L2capFrame* frame); }; -inline bool ExistConnectionByDestination(bdaddr_t* destination, hci_id hid); +inline bool ExistConnectionByDestination(const bdaddr_t& destination, + hci_id hid); inline bool ExistConnectionByHandle(uint16 handle, hci_id hid); + #endif // _BTCOREDATA_H diff --git a/src/add-ons/kernel/bluetooth/btCoreData/BTCoreData.cpp b/src/add-ons/kernel/bluetooth/btCoreData/BTCoreData.cpp index 3b2f0deee7..12c67f79d9 100644 --- a/src/add-ons/kernel/bluetooth/btCoreData/BTCoreData.cpp +++ b/src/add-ons/kernel/bluetooth/btCoreData/BTCoreData.cpp @@ -19,7 +19,7 @@ net_buffer_module_info* gBufferModule = NULL; inline bool -ExistConnectionByDestination(bdaddr_t* destination, hci_id hid = -1) +ExistConnectionByDestination(const bdaddr_t& destination, hci_id hid = -1) { return (ConnectionByDestination(destination, hid) != NULL); } @@ -102,7 +102,7 @@ PostEvent(bluetooth_device* ndev, void* event, size_t size) // TODO: XXX parse handle field HciConnection* conn = AddConnection(data->handle, BT_ACL, - &data->bdaddr, ndev->index); + data->bdaddr, ndev->index); if (conn == NULL) panic("no mem for conn desc"); diff --git a/src/add-ons/kernel/bluetooth/btCoreData/ConnectionInterface.cpp b/src/add-ons/kernel/bluetooth/btCoreData/ConnectionInterface.cpp index bc38c6f3d4..ae154aafe5 100644 --- a/src/add-ons/kernel/bluetooth/btCoreData/ConnectionInterface.cpp +++ b/src/add-ons/kernel/bluetooth/btCoreData/ConnectionInterface.cpp @@ -37,7 +37,7 @@ HciConnection::~HciConnection() HciConnection* -AddConnection(uint16 handle, int type, bdaddr_t* dst, hci_id hid) +AddConnection(uint16 handle, int type, const bdaddr_t& dst, hci_id hid) { // Create connection descriptor @@ -55,7 +55,7 @@ AddConnection(uint16 handle, int type, bdaddr_t* dst, hci_id hid) conn->currentRxExpectedLength = 0; update: // fill values - bdaddrUtils::Copy(&conn->destination, dst); + bdaddrUtils::Copy(conn->destination, dst); conn->type = type; conn->handle = handle; conn->Hid = hid; @@ -72,7 +72,7 @@ bail: status_t -RemoveConnection(bdaddr_t* destination, hci_id hid) +RemoveConnection(const bdaddr_t& destination, hci_id hid) { HciConnection* conn; @@ -83,7 +83,7 @@ RemoveConnection(bdaddr_t* destination, hci_id hid) conn = iterator.Next(); if (conn->Hid == hid - && bdaddrUtils::Compare(&conn->destination, destination)) { + && bdaddrUtils::Compare(conn->destination, destination)) { // if the device is still part of the list, remove it if (conn->GetDoublyLinkedListLink()->next != NULL @@ -129,7 +129,7 @@ RemoveConnection(uint16 handle, hci_id hid) hci_id -RouteConnection(const bdaddr_t* destination) { +RouteConnection(const bdaddr_t& destination) { HciConnection* conn; @@ -138,7 +138,7 @@ RouteConnection(const bdaddr_t* destination) { while (iterator.HasNext()) { conn = iterator.Next(); - if (bdaddrUtils::Compare(&conn->destination, destination)) { + if (bdaddrUtils::Compare(conn->destination, destination)) { return conn->Hid; } } @@ -167,7 +167,7 @@ ConnectionByHandle(uint16 handle, hci_id hid) HciConnection* -ConnectionByDestination(const bdaddr_t* destination, hci_id hid) +ConnectionByDestination(const bdaddr_t& destination, hci_id hid) { HciConnection* conn; @@ -177,7 +177,7 @@ ConnectionByDestination(const bdaddr_t* destination, hci_id hid) conn = iterator.Next(); if (conn->Hid == hid - && bdaddrUtils::Compare(&conn->destination, destination)) { + && bdaddrUtils::Compare(conn->destination, destination)) { return conn; } } diff --git a/src/add-ons/kernel/bluetooth/btCoreData/ConnectionInterface.h b/src/add-ons/kernel/bluetooth/btCoreData/ConnectionInterface.h index a75dbe3e2a..feadf44726 100644 --- a/src/add-ons/kernel/bluetooth/btCoreData/ConnectionInterface.h +++ b/src/add-ons/kernel/bluetooth/btCoreData/ConnectionInterface.h @@ -15,16 +15,16 @@ extern DoublyLinkedList sConnectionList; HciConnection* ConnectionByHandle(uint16 handle, hci_id hid); -HciConnection* ConnectionByDestination(const bdaddr_t* destination, +HciConnection* ConnectionByDestination(const bdaddr_t& destination, hci_id hid); -HciConnection* AddConnection(uint16 handle, int type, bdaddr_t* dst, +HciConnection* AddConnection(uint16 handle, int type, const bdaddr_t& dst, hci_id hid); -status_t RemoveConnection(bdaddr_t* destination, hci_id hid); +status_t RemoveConnection(const bdaddr_t& destination, hci_id hid); status_t RemoveConnection(uint16 handle, hci_id hid); -hci_id RouteConnection(const bdaddr_t* destination); +hci_id RouteConnection(const bdaddr_t& destination); void SetAclBuffer(HciConnection* conn, net_buffer* nbuf); void SetAclExpectedSize(HciConnection* conn, size_t size); diff --git a/src/add-ons/kernel/network/protocols/l2cap/L2capEndpoint.cpp b/src/add-ons/kernel/network/protocols/l2cap/L2capEndpoint.cpp index 7f847154c8..f61a5a1a19 100644 --- a/src/add-ons/kernel/network/protocols/l2cap/L2capEndpoint.cpp +++ b/src/add-ons/kernel/network/protocols/l2cap/L2capEndpoint.cpp @@ -237,14 +237,14 @@ L2capEndpoint::Connect(const struct sockaddr* _address) // TODO: If we were bound to a specific source address // Route, we must find a Connection descriptor with address->l2cap_address - hci_id hid = btCoreData->RouteConnection(&address->l2cap_bdaddr); + hci_id hid = btCoreData->RouteConnection(address->l2cap_bdaddr); debugf("%lx for route %s\n", hid, bdaddrUtils::ToString(address->l2cap_bdaddr)); if (hid > 0) { HciConnection* connection = btCoreData->ConnectionByDestination( - &address->l2cap_bdaddr, hid); + address->l2cap_bdaddr, hid); L2capChannel* channel = btCoreData->AddChannel(connection, address->l2cap_psm); diff --git a/src/add-ons/kernel/network/protocols/l2cap/l2cap_address.cpp b/src/add-ons/kernel/network/protocols/l2cap/l2cap_address.cpp index 415e7b4aff..cc5c459055 100644 --- a/src/add-ons/kernel/network/protocols/l2cap/l2cap_address.cpp +++ b/src/add-ons/kernel/network/protocols/l2cap/l2cap_address.cpp @@ -95,7 +95,7 @@ l2cap_is_empty_address(const sockaddr *address, bool checkPort) return true; return ((bdaddrUtils::Compare( - &((const sockaddr_l2cap *)address)->l2cap_bdaddr, BDADDR_NULL)==0) + ((const sockaddr_l2cap *)address)->l2cap_bdaddr, BDADDR_NULL)==0) && (!checkPort || ((sockaddr_l2cap *)address)->l2cap_psm == 0)); } @@ -127,8 +127,8 @@ l2cap_equal_addresses(const sockaddr *a, const sockaddr *b) if (a == NULL && b != NULL) return l2cap_is_empty_address(b, false); - return bdaddrUtils::Compare(&((const sockaddr_l2cap*)a)->l2cap_bdaddr, - &((sockaddr_l2cap*)b)->l2cap_bdaddr); + return bdaddrUtils::Compare(((const sockaddr_l2cap*)a)->l2cap_bdaddr, + ((sockaddr_l2cap*)b)->l2cap_bdaddr); } @@ -159,8 +159,8 @@ l2cap_equal_addresses_and_ports(const sockaddr *a, const sockaddr *b) if (a == NULL && b != NULL) return l2cap_is_empty_address(b, true); - return (bdaddrUtils::Compare(&((const sockaddr_l2cap *)a)->l2cap_bdaddr, - &((const sockaddr_l2cap *)b)->l2cap_bdaddr)) + return (bdaddrUtils::Compare(((const sockaddr_l2cap *)a)->l2cap_bdaddr, + ((const sockaddr_l2cap *)b)->l2cap_bdaddr)) && ((sockaddr_l2cap *)a)->l2cap_psm == ((sockaddr_l2cap *)b)->l2cap_psm; } @@ -329,7 +329,7 @@ l2cap_update_to(sockaddr *_address, const sockaddr *_from) if (address->l2cap_psm == 0) address->l2cap_psm = from->l2cap_psm; - if (bdaddrUtils::Compare(&address->l2cap_bdaddr, BDADDR_BROADCAST)) + if (bdaddrUtils::Compare(address->l2cap_bdaddr, BDADDR_BROADCAST)) address->l2cap_bdaddr = from->l2cap_bdaddr; return B_OK; diff --git a/src/kits/bluetooth/DiscoveryListener.cpp b/src/kits/bluetooth/DiscoveryListener.cpp index c55b97d122..6ee7bbb060 100644 --- a/src/kits/bluetooth/DiscoveryListener.cpp +++ b/src/kits/bluetooth/DiscoveryListener.cpp @@ -45,7 +45,7 @@ DiscoveryListener::InquiryCompleted(int discType) /* private */ /* A LocalDevice is always referenced in any request to the - * Bluetooth server therefore is going to be needed in any + * Bluetooth server therefore is going to be needed in any */ void DiscoveryListener::SetLocalDeviceOwner(LocalDevice* ld) @@ -73,21 +73,26 @@ DiscoveryListener::MessageReceived(BMessage* message) ssize_t size; RemoteDevice* rd = NULL; bool duplicatedFound = false; - + // TODO: Loop for all inquiryInfo! - if (message->FindData("info", B_ANY_TYPE, 0, (const void**)&inquiryInfo, &size) == B_OK) { + if (message->FindData("info", B_ANY_TYPE, 0, + (const void**)&inquiryInfo, &size) == B_OK) { // Skip duplicated replies - for (int32 index = 0 ; index < fRemoteDevicesList.CountItems(); index++) { - - bdaddr_t b1 = fRemoteDevicesList.ItemAt(index)->GetBluetoothAddress(); - - if (bdaddrUtils::Compare((bdaddr_t*) &inquiryInfo->bdaddr, &b1)) { + for (int32 index = 0 ; index < fRemoteDevicesList.CountItems(); + index++) { + bdaddr_t b1 = fRemoteDevicesList.ItemAt(index) + ->GetBluetoothAddress(); + if (bdaddrUtils::Compare(inquiryInfo->bdaddr, b1)) { // update these values - fRemoteDevicesList.ItemAt(index)->fPageRepetitionMode = inquiryInfo->pscan_rep_mode; - fRemoteDevicesList.ItemAt(index)->fScanPeriodMode = inquiryInfo->pscan_period_mode; - fRemoteDevicesList.ItemAt(index)->fScanMode = inquiryInfo->pscan_mode; - fRemoteDevicesList.ItemAt(index)->fClockOffset = inquiryInfo->clock_offset; + fRemoteDevicesList.ItemAt(index)->fPageRepetitionMode + = inquiryInfo->pscan_rep_mode; + fRemoteDevicesList.ItemAt(index)->fScanPeriodMode + = inquiryInfo->pscan_period_mode; + fRemoteDevicesList.ItemAt(index)->fScanMode + = inquiryInfo->pscan_mode; + fRemoteDevicesList.ItemAt(index)->fClockOffset + = inquiryInfo->clock_offset; duplicatedFound = true; break; @@ -95,7 +100,8 @@ DiscoveryListener::MessageReceived(BMessage* message) } if (!duplicatedFound) { - rd = new RemoteDevice(inquiryInfo->bdaddr, (uint8*)inquiryInfo->dev_class); + rd = new RemoteDevice(inquiryInfo->bdaddr, + (uint8*)inquiryInfo->dev_class); fRemoteDevicesList.AddItem(rd); // keep all inquiry reported data rd->SetLocalDeviceOwner(fLocalDevice); @@ -124,7 +130,7 @@ DiscoveryListener::MessageReceived(BMessage* message) case BT_MSG_INQUIRY_TERMINATED: /* inquiry was cancelled */ InquiryCompleted(BT_INQUIRY_TERMINATED); break; - + case BT_MSG_INQUIRY_ERROR: InquiryCompleted(BT_INQUIRY_ERROR); break; @@ -136,7 +142,10 @@ DiscoveryListener::MessageReceived(BMessage* message) } -DiscoveryListener::DiscoveryListener() : BLooper() , fRemoteDevicesList(BT_MAX_RESPONSES) +DiscoveryListener::DiscoveryListener() + : + BLooper(), + fRemoteDevicesList(BT_MAX_RESPONSES) { // TODO: Make a better handling of the running not running state Run(); diff --git a/src/kits/bluetooth/RemoteDevice.cpp b/src/kits/bluetooth/RemoteDevice.cpp index de0992fc36..3e063a9531 100644 --- a/src/kits/bluetooth/RemoteDevice.cpp +++ b/src/kits/bluetooth/RemoteDevice.cpp @@ -115,9 +115,7 @@ RemoteDevice::GetBluetoothAddress() bool RemoteDevice::Equals(RemoteDevice* obj) { - bdaddr_t ba = obj->GetBluetoothAddress(); - - return bdaddrUtils::Compare(&fBdaddr, &ba); + return bdaddrUtils::Compare(fBdaddr, obj->GetBluetoothAddress()); } @@ -135,7 +133,7 @@ RemoteDevice::Authenticate() BluetoothCommand createConnection(OGF_LINK_CONTROL, OCF_CREATE_CONN); - bdaddrUtils::Copy(&createConnection->bdaddr, &fBdaddr); + bdaddrUtils::Copy(createConnection->bdaddr, fBdaddr); createConnection->pscan_rep_mode = fPageRepetitionMode; createConnection->pscan_mode = fScanMode; // Reserved in spec 2.1 createConnection->clock_offset = fClockOffset | 0x8000; // substract! diff --git a/src/preferences/bluetooth/DeviceListItem.cpp b/src/preferences/bluetooth/DeviceListItem.cpp index 5de3f64574..0b64d0abd5 100644 --- a/src/preferences/bluetooth/DeviceListItem.cpp +++ b/src/preferences/bluetooth/DeviceListItem.cpp @@ -143,8 +143,7 @@ DeviceListItem::Compare(const void *firstArg, const void *secondArg) const DeviceListItem* item2 = *static_cast (secondArg); - return (int)bdaddrUtils::Compare((bdaddr_t*)&item1->fAddress, - (bdaddr_t*)&item2->fAddress); + return (int)bdaddrUtils::Compare(item1->fAddress, item2->fAddress); } diff --git a/src/servers/bluetooth/BluetoothServer.cpp b/src/servers/bluetooth/BluetoothServer.cpp index 1d822fcead..14c4a1c742 100644 --- a/src/servers/bluetooth/BluetoothServer.cpp +++ b/src/servers/bluetooth/BluetoothServer.cpp @@ -509,7 +509,7 @@ BluetoothServer::SDPServerThread(void* data) // bind socket to port 0x1001 of the first available // bluetooth adapter loc_addr.l2cap_family = AF_BLUETOOTH; - loc_addr.l2cap_bdaddr = *BDADDR_ANY; + loc_addr.l2cap_bdaddr = BDADDR_ANY; loc_addr.l2cap_psm = B_HOST_TO_LENDIAN_INT16(1); loc_addr.l2cap_len = sizeof(struct sockaddr_l2cap); diff --git a/src/servers/bluetooth/LocalDeviceImpl.cpp b/src/servers/bluetooth/LocalDeviceImpl.cpp index eb52a66440..51161d9eb4 100644 --- a/src/servers/bluetooth/LocalDeviceImpl.cpp +++ b/src/servers/bluetooth/LocalDeviceImpl.cpp @@ -975,7 +975,7 @@ LocalDeviceImpl::LinkKeyRequested(struct hci_ev_link_key_req* keyRequested, BluetoothCommand linkKeyNegativeReply(OGF_LINK_CONTROL, OCF_LINK_KEY_NEG_REPLY); - bdaddrUtils::Copy(&linkKeyNegativeReply->bdaddr, &keyRequested->bdaddr); + bdaddrUtils::Copy(linkKeyNegativeReply->bdaddr, keyRequested->bdaddr); if ((fHCIDelegate)->IssueCommand(linkKeyNegativeReply.Data(), linkKeyNegativeReply.Size()) == B_ERROR) {