diff --git a/dom/bluetooth/BluetoothCommon.h b/dom/bluetooth/BluetoothCommon.h index 43db113caf9a..b1473fb760ce 100644 --- a/dom/bluetooth/BluetoothCommon.h +++ b/dom/bluetooth/BluetoothCommon.h @@ -17,22 +17,6 @@ extern bool gBluetoothDebugFlag; #define SWITCH_BT_DEBUG(V) (gBluetoothDebugFlag = V) -#if MOZ_IS_GCC -# if MOZ_GCC_VERSION_AT_LEAST(4, 7, 0) -/* use designated array initializers if supported */ -# define INIT_ARRAY_AT(in_, out_) \ - [in_] = out_ -# else -/* otherwise init array element by position */ -# define INIT_ARRAY_AT(in_, out_) \ - out_ -# endif -#else -/* otherwise init array element by position */ -#define INIT_ARRAY_AT(in_, out_) \ - out_ -#endif - #undef BT_LOG #if defined(MOZ_WIDGET_GONK) #include diff --git a/dom/bluetooth/bluedroid/BluetoothDaemonA2dpInterface.cpp b/dom/bluetooth/bluedroid/BluetoothDaemonA2dpInterface.cpp index 577d318c3d5d..de4553af2733 100644 --- a/dom/bluetooth/bluedroid/BluetoothDaemonA2dpInterface.cpp +++ b/dom/bluetooth/bluedroid/BluetoothDaemonA2dpInterface.cpp @@ -47,8 +47,8 @@ BluetoothDaemonA2dpModule::HandleSvc(const DaemonSocketPDUHeader& aHeader, { static void (BluetoothDaemonA2dpModule::* const HandleOp[])( const DaemonSocketPDUHeader&, DaemonSocketPDU&, void*) = { - INIT_ARRAY_AT(0, &BluetoothDaemonA2dpModule::HandleRsp), - INIT_ARRAY_AT(1, &BluetoothDaemonA2dpModule::HandleNtf), + [0] = &BluetoothDaemonA2dpModule::HandleRsp, + [1] = &BluetoothDaemonA2dpModule::HandleNtf }; MOZ_ASSERT(!NS_IsMainThread()); @@ -145,12 +145,9 @@ BluetoothDaemonA2dpModule::HandleRsp( const DaemonSocketPDUHeader&, DaemonSocketPDU&, BluetoothA2dpResultHandler*) = { - INIT_ARRAY_AT(OPCODE_ERROR, - &BluetoothDaemonA2dpModule::ErrorRsp), - INIT_ARRAY_AT(OPCODE_CONNECT, - &BluetoothDaemonA2dpModule::ConnectRsp), - INIT_ARRAY_AT(OPCODE_DISCONNECT, - &BluetoothDaemonA2dpModule::DisconnectRsp), + [OPCODE_ERROR] = &BluetoothDaemonA2dpModule::ErrorRsp, + [OPCODE_CONNECT] = &BluetoothDaemonA2dpModule::ConnectRsp, + [OPCODE_DISCONNECT] = &BluetoothDaemonA2dpModule::DisconnectRsp }; MOZ_ASSERT(!NS_IsMainThread()); // I/O thread @@ -322,10 +319,10 @@ BluetoothDaemonA2dpModule::HandleNtf( { static void (BluetoothDaemonA2dpModule::* const HandleNtf[])( const DaemonSocketPDUHeader&, DaemonSocketPDU&) = { - INIT_ARRAY_AT(0, &BluetoothDaemonA2dpModule::ConnectionStateNtf), - INIT_ARRAY_AT(1, &BluetoothDaemonA2dpModule::AudioStateNtf), + [0] = &BluetoothDaemonA2dpModule::ConnectionStateNtf, + [1] = &BluetoothDaemonA2dpModule::AudioStateNtf, #if ANDROID_VERSION >= 21 - INIT_ARRAY_AT(2, &BluetoothDaemonA2dpModule::AudioConfigNtf), + [2] = &BluetoothDaemonA2dpModule::AudioConfigNtf #endif }; diff --git a/dom/bluetooth/bluedroid/BluetoothDaemonAvrcpInterface.cpp b/dom/bluetooth/bluedroid/BluetoothDaemonAvrcpInterface.cpp index da7432c937c1..80fc14282f61 100644 --- a/dom/bluetooth/bluedroid/BluetoothDaemonAvrcpInterface.cpp +++ b/dom/bluetooth/bluedroid/BluetoothDaemonAvrcpInterface.cpp @@ -47,8 +47,8 @@ BluetoothDaemonAvrcpModule::HandleSvc(const DaemonSocketPDUHeader& aHeader, { static void (BluetoothDaemonAvrcpModule::* const HandleOp[])( const DaemonSocketPDUHeader&, DaemonSocketPDU&, void*) = { - INIT_ARRAY_AT(0, &BluetoothDaemonAvrcpModule::HandleRsp), - INIT_ARRAY_AT(1, &BluetoothDaemonAvrcpModule::HandleNtf), + [0] = &BluetoothDaemonAvrcpModule::HandleRsp, + [1] = &BluetoothDaemonAvrcpModule::HandleNtf }; MOZ_ASSERT(!NS_IsMainThread()); @@ -427,28 +427,28 @@ BluetoothDaemonAvrcpModule::HandleRsp( const DaemonSocketPDUHeader&, DaemonSocketPDU&, BluetoothAvrcpResultHandler*) = { - INIT_ARRAY_AT(OPCODE_ERROR, - &BluetoothDaemonAvrcpModule::ErrorRsp), - INIT_ARRAY_AT(OPCODE_GET_PLAY_STATUS_RSP, - &BluetoothDaemonAvrcpModule::GetPlayStatusRspRsp), - INIT_ARRAY_AT(OPCODE_LIST_PLAYER_APP_ATTR_RSP, - &BluetoothDaemonAvrcpModule::ListPlayerAppAttrRspRsp), - INIT_ARRAY_AT(OPCODE_LIST_PLAYER_APP_VALUE_RSP, - &BluetoothDaemonAvrcpModule::ListPlayerAppValueRspRsp), - INIT_ARRAY_AT(OPCODE_GET_PLAYER_APP_VALUE_RSP, - &BluetoothDaemonAvrcpModule::GetPlayerAppValueRspRsp), - INIT_ARRAY_AT(OPCODE_GET_PLAYER_APP_ATTR_TEXT_RSP, - &BluetoothDaemonAvrcpModule::GetPlayerAppAttrTextRspRsp), - INIT_ARRAY_AT(OPCODE_GET_PLAYER_APP_VALUE_TEXT_RSP, - &BluetoothDaemonAvrcpModule::GetPlayerAppValueTextRspRsp), - INIT_ARRAY_AT(OPCODE_GET_ELEMENT_ATTR_RSP, - &BluetoothDaemonAvrcpModule::GetElementAttrRspRsp), - INIT_ARRAY_AT(OPCODE_SET_PLAYER_APP_VALUE_RSP, - &BluetoothDaemonAvrcpModule::SetPlayerAppValueRspRsp), - INIT_ARRAY_AT(OPCODE_REGISTER_NOTIFICATION_RSP, - &BluetoothDaemonAvrcpModule::RegisterNotificationRspRsp), - INIT_ARRAY_AT(OPCODE_SET_VOLUME, - &BluetoothDaemonAvrcpModule::SetVolumeRsp) + [OPCODE_ERROR] = + &BluetoothDaemonAvrcpModule::ErrorRsp, + [OPCODE_GET_PLAY_STATUS_RSP] = + &BluetoothDaemonAvrcpModule::GetPlayStatusRspRsp, + [OPCODE_LIST_PLAYER_APP_ATTR_RSP] = + &BluetoothDaemonAvrcpModule::ListPlayerAppAttrRspRsp, + [OPCODE_LIST_PLAYER_APP_VALUE_RSP] = + &BluetoothDaemonAvrcpModule::ListPlayerAppValueRspRsp, + [OPCODE_GET_PLAYER_APP_VALUE_RSP] = + &BluetoothDaemonAvrcpModule::GetPlayerAppValueRspRsp, + [OPCODE_GET_PLAYER_APP_ATTR_TEXT_RSP] = + &BluetoothDaemonAvrcpModule::GetPlayerAppAttrTextRspRsp, + [OPCODE_GET_PLAYER_APP_VALUE_TEXT_RSP] = + &BluetoothDaemonAvrcpModule::GetPlayerAppValueTextRspRsp, + [OPCODE_GET_ELEMENT_ATTR_RSP]= + &BluetoothDaemonAvrcpModule::GetElementAttrRspRsp, + [OPCODE_SET_PLAYER_APP_VALUE_RSP] = + &BluetoothDaemonAvrcpModule::SetPlayerAppValueRspRsp, + [OPCODE_REGISTER_NOTIFICATION_RSP] = + &BluetoothDaemonAvrcpModule::RegisterNotificationRspRsp, + [OPCODE_SET_VOLUME] = + &BluetoothDaemonAvrcpModule::SetVolumeRsp }; MOZ_ASSERT(!NS_IsMainThread()); // I/O thread @@ -797,28 +797,28 @@ BluetoothDaemonAvrcpModule::HandleNtf( static void (BluetoothDaemonAvrcpModule::* const HandleNtf[])( const DaemonSocketPDUHeader&, DaemonSocketPDU&) = { #if ANDROID_VERSION >= 19 - INIT_ARRAY_AT(0, &BluetoothDaemonAvrcpModule::RemoteFeatureNtf), - INIT_ARRAY_AT(1, &BluetoothDaemonAvrcpModule::GetPlayStatusNtf), - INIT_ARRAY_AT(2, &BluetoothDaemonAvrcpModule::ListPlayerAppAttrNtf), - INIT_ARRAY_AT(3, &BluetoothDaemonAvrcpModule::ListPlayerAppValuesNtf), - INIT_ARRAY_AT(4, &BluetoothDaemonAvrcpModule::GetPlayerAppValueNtf), - INIT_ARRAY_AT(5, &BluetoothDaemonAvrcpModule::GetPlayerAppAttrsTextNtf), - INIT_ARRAY_AT(6, &BluetoothDaemonAvrcpModule::GetPlayerAppValuesTextNtf), - INIT_ARRAY_AT(7, &BluetoothDaemonAvrcpModule::SetPlayerAppValueNtf), - INIT_ARRAY_AT(8, &BluetoothDaemonAvrcpModule::GetElementAttrNtf), - INIT_ARRAY_AT(9, &BluetoothDaemonAvrcpModule::RegisterNotificationNtf), - INIT_ARRAY_AT(10, &BluetoothDaemonAvrcpModule::VolumeChangeNtf), - INIT_ARRAY_AT(11, &BluetoothDaemonAvrcpModule::PassthroughCmdNtf) + [0] = &BluetoothDaemonAvrcpModule::RemoteFeatureNtf, + [1] = &BluetoothDaemonAvrcpModule::GetPlayStatusNtf, + [2] = &BluetoothDaemonAvrcpModule::ListPlayerAppAttrNtf, + [3] = &BluetoothDaemonAvrcpModule::ListPlayerAppValuesNtf, + [4] = &BluetoothDaemonAvrcpModule::GetPlayerAppValueNtf, + [5] = &BluetoothDaemonAvrcpModule::GetPlayerAppAttrsTextNtf, + [6] = &BluetoothDaemonAvrcpModule::GetPlayerAppValuesTextNtf, + [7] = &BluetoothDaemonAvrcpModule::SetPlayerAppValueNtf, + [8] = &BluetoothDaemonAvrcpModule::GetElementAttrNtf, + [9] = &BluetoothDaemonAvrcpModule::RegisterNotificationNtf, + [10] = &BluetoothDaemonAvrcpModule::VolumeChangeNtf, + [11] = &BluetoothDaemonAvrcpModule::PassthroughCmdNtf #else - INIT_ARRAY_AT(0, &BluetoothDaemonAvrcpModule::GetPlayStatusNtf), - INIT_ARRAY_AT(1, &BluetoothDaemonAvrcpModule::ListPlayerAppAttrNtf), - INIT_ARRAY_AT(2, &BluetoothDaemonAvrcpModule::ListPlayerAppValuesNtf), - INIT_ARRAY_AT(3, &BluetoothDaemonAvrcpModule::GetPlayerAppValueNtf), - INIT_ARRAY_AT(4, &BluetoothDaemonAvrcpModule::GetPlayerAppAttrsTextNtf), - INIT_ARRAY_AT(5, &BluetoothDaemonAvrcpModule::GetPlayerAppValuesTextNtf), - INIT_ARRAY_AT(6, &BluetoothDaemonAvrcpModule::SetPlayerAppValueNtf), - INIT_ARRAY_AT(7, &BluetoothDaemonAvrcpModule::GetElementAttrNtf), - INIT_ARRAY_AT(8, &BluetoothDaemonAvrcpModule::RegisterNotificationNtf) + [0] = &BluetoothDaemonAvrcpModule::GetPlayStatusNtf, + [1] = &BluetoothDaemonAvrcpModule::ListPlayerAppAttrNtf, + [2] = &BluetoothDaemonAvrcpModule::ListPlayerAppValuesNtf, + [3] = &BluetoothDaemonAvrcpModule::GetPlayerAppValueNtf, + [4] = &BluetoothDaemonAvrcpModule::GetPlayerAppAttrsTextNtf, + [5] = &BluetoothDaemonAvrcpModule::GetPlayerAppValuesTextNtf, + [6] = &BluetoothDaemonAvrcpModule::SetPlayerAppValueNtf, + [7] = &BluetoothDaemonAvrcpModule::GetElementAttrNtf, + [8] = &BluetoothDaemonAvrcpModule::RegisterNotificationNtf #endif }; diff --git a/dom/bluetooth/bluedroid/BluetoothDaemonGattInterface.cpp b/dom/bluetooth/bluedroid/BluetoothDaemonGattInterface.cpp index a6c0446075a5..9023409a297c 100644 --- a/dom/bluetooth/bluedroid/BluetoothDaemonGattInterface.cpp +++ b/dom/bluetooth/bluedroid/BluetoothDaemonGattInterface.cpp @@ -47,8 +47,8 @@ BluetoothDaemonGattModule::HandleSvc(const DaemonSocketPDUHeader& aHeader, { static void (BluetoothDaemonGattModule::* const HandleOp[])( const DaemonSocketPDUHeader&, DaemonSocketPDU&, void*) = { - INIT_ARRAY_AT(0, &BluetoothDaemonGattModule::HandleRsp), - INIT_ARRAY_AT(1, &BluetoothDaemonGattModule::HandleNtf), + [0] = &BluetoothDaemonGattModule::HandleRsp, + [1] = &BluetoothDaemonGattModule::HandleNtf }; MOZ_ASSERT(!NS_IsMainThread()); @@ -1411,78 +1411,78 @@ BluetoothDaemonGattModule::HandleRsp( const DaemonSocketPDUHeader&, DaemonSocketPDU&, BluetoothGattResultHandler*) = { - INIT_ARRAY_AT(OPCODE_ERROR, - &BluetoothDaemonGattModule::ErrorRsp), - INIT_ARRAY_AT(OPCODE_CLIENT_REGISTER, - &BluetoothDaemonGattModule::ClientRegisterRsp), - INIT_ARRAY_AT(OPCODE_CLIENT_UNREGISTER, - &BluetoothDaemonGattModule::ClientUnregisterRsp), - INIT_ARRAY_AT(OPCODE_CLIENT_SCAN, - &BluetoothDaemonGattModule::ClientScanRsp), - INIT_ARRAY_AT(OPCODE_CLIENT_CONNECT, - &BluetoothDaemonGattModule::ClientConnectRsp), - INIT_ARRAY_AT(OPCODE_CLIENT_DISCONNECT, - &BluetoothDaemonGattModule::ClientDisconnectRsp), - INIT_ARRAY_AT(OPCODE_CLIENT_LISTEN, - &BluetoothDaemonGattModule::ClientListenRsp), - INIT_ARRAY_AT(OPCODE_CLIENT_REFRESH, - &BluetoothDaemonGattModule::ClientRefreshRsp), - INIT_ARRAY_AT(OPCODE_CLIENT_SEARCH_SERVICE, - &BluetoothDaemonGattModule::ClientSearchServiceRsp), - INIT_ARRAY_AT(OPCODE_CLIENT_GET_INCLUDED_SERVICE, - &BluetoothDaemonGattModule::ClientGetIncludedServiceRsp), - INIT_ARRAY_AT(OPCODE_CLIENT_GET_CHARACTERISTIC, - &BluetoothDaemonGattModule::ClientGetCharacteristicRsp), - INIT_ARRAY_AT(OPCODE_CLIENT_GET_DESCRIPTOR, - &BluetoothDaemonGattModule::ClientGetDescriptorRsp), - INIT_ARRAY_AT(OPCODE_CLIENT_READ_CHARACTERISTIC, - &BluetoothDaemonGattModule::ClientReadCharacteristicRsp), - INIT_ARRAY_AT(OPCODE_CLIENT_WRITE_CHARACTERISTIC, - &BluetoothDaemonGattModule::ClientWriteCharacteristicRsp), - INIT_ARRAY_AT(OPCODE_CLIENT_READ_DESCRIPTOR, - &BluetoothDaemonGattModule::ClientReadDescriptorRsp), - INIT_ARRAY_AT(OPCODE_CLIENT_WRITE_DESCRIPTOR, - &BluetoothDaemonGattModule::ClientWriteDescriptorRsp), - INIT_ARRAY_AT(OPCODE_CLIENT_EXECUTE_WRITE, - &BluetoothDaemonGattModule::ClientExecuteWriteRsp), - INIT_ARRAY_AT(OPCODE_CLIENT_REGISTER_NOTIFICATION, - &BluetoothDaemonGattModule::ClientRegisterNotificationRsp), - INIT_ARRAY_AT(OPCODE_CLIENT_DEREGISTER_NOTIFICATION, - &BluetoothDaemonGattModule::ClientDeregisterNotificationRsp), - INIT_ARRAY_AT(OPCODE_CLIENT_READ_REMOTE_RSSI, - &BluetoothDaemonGattModule::ClientReadRemoteRssiRsp), - INIT_ARRAY_AT(OPCODE_CLIENT_GET_DEVICE_TYPE, - &BluetoothDaemonGattModule::ClientGetDeviceTypeRsp), - INIT_ARRAY_AT(OPCODE_CLIENT_SET_ADV_DATA, - &BluetoothDaemonGattModule::ClientSetAdvDataRsp), - INIT_ARRAY_AT(OPCODE_CLIENT_TEST_COMMAND, - &BluetoothDaemonGattModule::ClientTestCommandRsp), - INIT_ARRAY_AT(OPCODE_SERVER_REGISTER, - &BluetoothDaemonGattModule::ServerRegisterRsp), - INIT_ARRAY_AT(OPCODE_SERVER_UNREGISTER, - &BluetoothDaemonGattModule::ServerUnregisterRsp), - INIT_ARRAY_AT(OPCODE_SERVER_CONNECT_PERIPHERAL, - &BluetoothDaemonGattModule::ServerConnectPeripheralRsp), - INIT_ARRAY_AT(OPCODE_SERVER_DISCONNECT_PERIPHERAL, - &BluetoothDaemonGattModule::ServerDisconnectPeripheralRsp), - INIT_ARRAY_AT(OPCODE_SERVER_ADD_SERVICE, - &BluetoothDaemonGattModule::ServerAddServiceRsp), - INIT_ARRAY_AT(OPCODE_SERVER_ADD_INCLUDED_SERVICE, - &BluetoothDaemonGattModule::ServerAddIncludedServiceRsp), - INIT_ARRAY_AT(OPCODE_SERVER_ADD_CHARACTERISTIC, - &BluetoothDaemonGattModule::ServerAddCharacteristicRsp), - INIT_ARRAY_AT(OPCODE_SERVER_ADD_DESCRIPTOR, - &BluetoothDaemonGattModule::ServerAddDescriptorRsp), - INIT_ARRAY_AT(OPCODE_SERVER_START_SERVICE, - &BluetoothDaemonGattModule::ServerStartServiceRsp), - INIT_ARRAY_AT(OPCODE_SERVER_STOP_SERVICE, - &BluetoothDaemonGattModule::ServerStopServiceRsp), - INIT_ARRAY_AT(OPCODE_SERVER_DELETE_SERVICE, - &BluetoothDaemonGattModule::ServerDeleteServiceRsp), - INIT_ARRAY_AT(OPCODE_SERVER_SEND_INDICATION, - &BluetoothDaemonGattModule::ServerSendIndicationRsp), - INIT_ARRAY_AT(OPCODE_SERVER_SEND_RESPONSE, - &BluetoothDaemonGattModule::ServerSendResponseRsp) + [OPCODE_ERROR] = + &BluetoothDaemonGattModule::ErrorRsp, + [OPCODE_CLIENT_REGISTER] = + &BluetoothDaemonGattModule::ClientRegisterRsp, + [OPCODE_CLIENT_UNREGISTER] = + &BluetoothDaemonGattModule::ClientUnregisterRsp, + [OPCODE_CLIENT_SCAN] = + &BluetoothDaemonGattModule::ClientScanRsp, + [OPCODE_CLIENT_CONNECT] = + &BluetoothDaemonGattModule::ClientConnectRsp, + [OPCODE_CLIENT_DISCONNECT] = + &BluetoothDaemonGattModule::ClientDisconnectRsp, + [OPCODE_CLIENT_LISTEN] = + &BluetoothDaemonGattModule::ClientListenRsp, + [OPCODE_CLIENT_REFRESH] = + &BluetoothDaemonGattModule::ClientRefreshRsp, + [OPCODE_CLIENT_SEARCH_SERVICE] = + &BluetoothDaemonGattModule::ClientSearchServiceRsp, + [OPCODE_CLIENT_GET_INCLUDED_SERVICE] = + &BluetoothDaemonGattModule::ClientGetIncludedServiceRsp, + [OPCODE_CLIENT_GET_CHARACTERISTIC] = + &BluetoothDaemonGattModule::ClientGetCharacteristicRsp, + [OPCODE_CLIENT_GET_DESCRIPTOR] = + &BluetoothDaemonGattModule::ClientGetDescriptorRsp, + [OPCODE_CLIENT_READ_CHARACTERISTIC] = + &BluetoothDaemonGattModule::ClientReadCharacteristicRsp, + [OPCODE_CLIENT_WRITE_CHARACTERISTIC] = + &BluetoothDaemonGattModule::ClientWriteCharacteristicRsp, + [OPCODE_CLIENT_READ_DESCRIPTOR] = + &BluetoothDaemonGattModule::ClientReadDescriptorRsp, + [OPCODE_CLIENT_WRITE_DESCRIPTOR] = + &BluetoothDaemonGattModule::ClientWriteDescriptorRsp, + [OPCODE_CLIENT_EXECUTE_WRITE] = + &BluetoothDaemonGattModule::ClientExecuteWriteRsp, + [OPCODE_CLIENT_REGISTER_NOTIFICATION] = + &BluetoothDaemonGattModule::ClientRegisterNotificationRsp, + [OPCODE_CLIENT_DEREGISTER_NOTIFICATION] = + &BluetoothDaemonGattModule::ClientDeregisterNotificationRsp, + [OPCODE_CLIENT_READ_REMOTE_RSSI] = + &BluetoothDaemonGattModule::ClientReadRemoteRssiRsp, + [OPCODE_CLIENT_GET_DEVICE_TYPE] = + &BluetoothDaemonGattModule::ClientGetDeviceTypeRsp, + [OPCODE_CLIENT_SET_ADV_DATA] = + &BluetoothDaemonGattModule::ClientSetAdvDataRsp, + [OPCODE_CLIENT_TEST_COMMAND] = + &BluetoothDaemonGattModule::ClientTestCommandRsp, + [OPCODE_SERVER_REGISTER] = + &BluetoothDaemonGattModule::ServerRegisterRsp, + [OPCODE_SERVER_UNREGISTER] = + &BluetoothDaemonGattModule::ServerUnregisterRsp, + [OPCODE_SERVER_CONNECT_PERIPHERAL] = + &BluetoothDaemonGattModule::ServerConnectPeripheralRsp, + [OPCODE_SERVER_DISCONNECT_PERIPHERAL] = + &BluetoothDaemonGattModule::ServerDisconnectPeripheralRsp, + [OPCODE_SERVER_ADD_SERVICE] = + &BluetoothDaemonGattModule::ServerAddServiceRsp, + [OPCODE_SERVER_ADD_INCLUDED_SERVICE] = + &BluetoothDaemonGattModule::ServerAddIncludedServiceRsp, + [OPCODE_SERVER_ADD_CHARACTERISTIC] = + &BluetoothDaemonGattModule::ServerAddCharacteristicRsp, + [OPCODE_SERVER_ADD_DESCRIPTOR] = + &BluetoothDaemonGattModule::ServerAddDescriptorRsp, + [OPCODE_SERVER_START_SERVICE] = + &BluetoothDaemonGattModule::ServerStartServiceRsp, + [OPCODE_SERVER_STOP_SERVICE] = + &BluetoothDaemonGattModule::ServerStopServiceRsp, + [OPCODE_SERVER_DELETE_SERVICE] = + &BluetoothDaemonGattModule::ServerDeleteServiceRsp, + [OPCODE_SERVER_SEND_INDICATION] = + &BluetoothDaemonGattModule::ServerSendIndicationRsp, + [OPCODE_SERVER_SEND_RESPONSE] = + &BluetoothDaemonGattModule::ServerSendResponseRsp }; MOZ_ASSERT(!NS_IsMainThread()); // I/O thread @@ -2156,37 +2156,37 @@ BluetoothDaemonGattModule::HandleNtf( { static void (BluetoothDaemonGattModule::* const HandleNtf[])( const DaemonSocketPDUHeader&, DaemonSocketPDU&) = { - INIT_ARRAY_AT(0, &BluetoothDaemonGattModule::ClientRegisterNtf), - INIT_ARRAY_AT(1, &BluetoothDaemonGattModule::ClientScanResultNtf), - INIT_ARRAY_AT(2, &BluetoothDaemonGattModule::ClientConnectNtf), - INIT_ARRAY_AT(3, &BluetoothDaemonGattModule::ClientDisconnectNtf), - INIT_ARRAY_AT(4, &BluetoothDaemonGattModule::ClientSearchCompleteNtf), - INIT_ARRAY_AT(5, &BluetoothDaemonGattModule::ClientSearchResultNtf), - INIT_ARRAY_AT(6, &BluetoothDaemonGattModule::ClientGetCharacteristicNtf), - INIT_ARRAY_AT(7, &BluetoothDaemonGattModule::ClientGetDescriptorNtf), - INIT_ARRAY_AT(8, &BluetoothDaemonGattModule::ClientGetIncludedServiceNtf), - INIT_ARRAY_AT(9, &BluetoothDaemonGattModule::ClientRegisterNotificationNtf), - INIT_ARRAY_AT(10, &BluetoothDaemonGattModule::ClientNotifyNtf), - INIT_ARRAY_AT(11, &BluetoothDaemonGattModule::ClientReadCharacteristicNtf), - INIT_ARRAY_AT(12, &BluetoothDaemonGattModule::ClientWriteCharacteristicNtf), - INIT_ARRAY_AT(13, &BluetoothDaemonGattModule::ClientReadDescriptorNtf), - INIT_ARRAY_AT(14, &BluetoothDaemonGattModule::ClientWriteDescriptorNtf), - INIT_ARRAY_AT(15, &BluetoothDaemonGattModule::ClientExecuteWriteNtf), - INIT_ARRAY_AT(16, &BluetoothDaemonGattModule::ClientReadRemoteRssiNtf), - INIT_ARRAY_AT(17, &BluetoothDaemonGattModule::ClientListenNtf), - INIT_ARRAY_AT(18, &BluetoothDaemonGattModule::ServerRegisterNtf), - INIT_ARRAY_AT(19, &BluetoothDaemonGattModule::ServerConnectionNtf), - INIT_ARRAY_AT(20, &BluetoothDaemonGattModule::ServerServiceAddedNtf), - INIT_ARRAY_AT(21, &BluetoothDaemonGattModule::ServerIncludedServiceAddedNtf), - INIT_ARRAY_AT(22, &BluetoothDaemonGattModule::ServerCharacteristicAddedNtf), - INIT_ARRAY_AT(23, &BluetoothDaemonGattModule::ServerDescriptorAddedNtf), - INIT_ARRAY_AT(24, &BluetoothDaemonGattModule::ServerServiceStartedNtf), - INIT_ARRAY_AT(25, &BluetoothDaemonGattModule::ServerServiceStoppedNtf), - INIT_ARRAY_AT(26, &BluetoothDaemonGattModule::ServerServiceDeletedNtf), - INIT_ARRAY_AT(27, &BluetoothDaemonGattModule::ServerRequestReadNtf), - INIT_ARRAY_AT(28, &BluetoothDaemonGattModule::ServerRequestWriteNtf), - INIT_ARRAY_AT(29, &BluetoothDaemonGattModule::ServerRequestExecuteWriteNtf), - INIT_ARRAY_AT(30, &BluetoothDaemonGattModule::ServerResponseConfirmationNtf) + [0] = &BluetoothDaemonGattModule::ClientRegisterNtf, + [1] = &BluetoothDaemonGattModule::ClientScanResultNtf, + [2] = &BluetoothDaemonGattModule::ClientConnectNtf, + [3] = &BluetoothDaemonGattModule::ClientDisconnectNtf, + [4] = &BluetoothDaemonGattModule::ClientSearchCompleteNtf, + [5] = &BluetoothDaemonGattModule::ClientSearchResultNtf, + [6] = &BluetoothDaemonGattModule::ClientGetCharacteristicNtf, + [7] = &BluetoothDaemonGattModule::ClientGetDescriptorNtf, + [8] = &BluetoothDaemonGattModule::ClientGetIncludedServiceNtf, + [9] = &BluetoothDaemonGattModule::ClientRegisterNotificationNtf, + [10] = &BluetoothDaemonGattModule::ClientNotifyNtf, + [11] = &BluetoothDaemonGattModule::ClientReadCharacteristicNtf, + [12] = &BluetoothDaemonGattModule::ClientWriteCharacteristicNtf, + [13] = &BluetoothDaemonGattModule::ClientReadDescriptorNtf, + [14] = &BluetoothDaemonGattModule::ClientWriteDescriptorNtf, + [15] = &BluetoothDaemonGattModule::ClientExecuteWriteNtf, + [16] = &BluetoothDaemonGattModule::ClientReadRemoteRssiNtf, + [17] = &BluetoothDaemonGattModule::ClientListenNtf, + [18] = &BluetoothDaemonGattModule::ServerRegisterNtf, + [19] = &BluetoothDaemonGattModule::ServerConnectionNtf, + [20] = &BluetoothDaemonGattModule::ServerServiceAddedNtf, + [21] = &BluetoothDaemonGattModule::ServerIncludedServiceAddedNtf, + [22] = &BluetoothDaemonGattModule::ServerCharacteristicAddedNtf, + [23] = &BluetoothDaemonGattModule::ServerDescriptorAddedNtf, + [24] = &BluetoothDaemonGattModule::ServerServiceStartedNtf, + [25] = &BluetoothDaemonGattModule::ServerServiceStoppedNtf, + [26] = &BluetoothDaemonGattModule::ServerServiceDeletedNtf, + [27] = &BluetoothDaemonGattModule::ServerRequestReadNtf, + [28] = &BluetoothDaemonGattModule::ServerRequestWriteNtf, + [29] = &BluetoothDaemonGattModule::ServerRequestExecuteWriteNtf, + [30] = &BluetoothDaemonGattModule::ServerResponseConfirmationNtf }; MOZ_ASSERT(!NS_IsMainThread()); diff --git a/dom/bluetooth/bluedroid/BluetoothDaemonHandsfreeInterface.cpp b/dom/bluetooth/bluedroid/BluetoothDaemonHandsfreeInterface.cpp index a01ce556c21b..67ef9ff39dae 100644 --- a/dom/bluetooth/bluedroid/BluetoothDaemonHandsfreeInterface.cpp +++ b/dom/bluetooth/bluedroid/BluetoothDaemonHandsfreeInterface.cpp @@ -50,8 +50,8 @@ BluetoothDaemonHandsfreeModule::HandleSvc( { static void (BluetoothDaemonHandsfreeModule::* const HandleOp[])( const DaemonSocketPDUHeader&, DaemonSocketPDU&, void*) = { - INIT_ARRAY_AT(0, &BluetoothDaemonHandsfreeModule::HandleRsp), - INIT_ARRAY_AT(1, &BluetoothDaemonHandsfreeModule::HandleNtf), + [0] = &BluetoothDaemonHandsfreeModule::HandleRsp, + [1] = &BluetoothDaemonHandsfreeModule::HandleNtf }; MOZ_ASSERT(!NS_IsMainThread()); @@ -685,38 +685,38 @@ BluetoothDaemonHandsfreeModule::HandleRsp( const DaemonSocketPDUHeader&, DaemonSocketPDU&, BluetoothHandsfreeResultHandler*) = { - INIT_ARRAY_AT(OPCODE_ERROR, - &BluetoothDaemonHandsfreeModule::ErrorRsp), - INIT_ARRAY_AT(OPCODE_CONNECT, - &BluetoothDaemonHandsfreeModule::ConnectRsp), - INIT_ARRAY_AT(OPCODE_DISCONNECT, - &BluetoothDaemonHandsfreeModule::DisconnectRsp), - INIT_ARRAY_AT(OPCODE_CONNECT_AUDIO, - &BluetoothDaemonHandsfreeModule::ConnectAudioRsp), - INIT_ARRAY_AT(OPCODE_DISCONNECT_AUDIO, - &BluetoothDaemonHandsfreeModule::DisconnectAudioRsp), - INIT_ARRAY_AT(OPCODE_START_VOICE_RECOGNITION, - &BluetoothDaemonHandsfreeModule::StartVoiceRecognitionRsp), - INIT_ARRAY_AT(OPCODE_STOP_VOICE_RECOGNITION, - &BluetoothDaemonHandsfreeModule::StopVoiceRecognitionRsp), - INIT_ARRAY_AT(OPCODE_VOLUME_CONTROL, - &BluetoothDaemonHandsfreeModule::VolumeControlRsp), - INIT_ARRAY_AT(OPCODE_DEVICE_STATUS_NOTIFICATION, - &BluetoothDaemonHandsfreeModule::DeviceStatusNotificationRsp), - INIT_ARRAY_AT(OPCODE_COPS_RESPONSE, - &BluetoothDaemonHandsfreeModule::CopsResponseRsp), - INIT_ARRAY_AT(OPCODE_CIND_RESPONSE, - &BluetoothDaemonHandsfreeModule::CindResponseRsp), - INIT_ARRAY_AT(OPCODE_FORMATTED_AT_RESPONSE, - &BluetoothDaemonHandsfreeModule::FormattedAtResponseRsp), - INIT_ARRAY_AT(OPCODE_AT_RESPONSE, - &BluetoothDaemonHandsfreeModule::AtResponseRsp), - INIT_ARRAY_AT(OPCODE_CLCC_RESPONSE, - &BluetoothDaemonHandsfreeModule::ClccResponseRsp), - INIT_ARRAY_AT(OPCODE_PHONE_STATE_CHANGE, - &BluetoothDaemonHandsfreeModule::PhoneStateChangeRsp), - INIT_ARRAY_AT(OPCODE_CONFIGURE_WBS, - &BluetoothDaemonHandsfreeModule::ConfigureWbsRsp) + [OPCODE_ERROR] = + &BluetoothDaemonHandsfreeModule::ErrorRsp, + [OPCODE_CONNECT] = + &BluetoothDaemonHandsfreeModule::ConnectRsp, + [OPCODE_DISCONNECT] = + &BluetoothDaemonHandsfreeModule::DisconnectRsp, + [OPCODE_CONNECT_AUDIO] = + &BluetoothDaemonHandsfreeModule::ConnectAudioRsp, + [OPCODE_DISCONNECT_AUDIO] = + &BluetoothDaemonHandsfreeModule::DisconnectAudioRsp, + [OPCODE_START_VOICE_RECOGNITION] = + &BluetoothDaemonHandsfreeModule::StartVoiceRecognitionRsp, + [OPCODE_STOP_VOICE_RECOGNITION] = + &BluetoothDaemonHandsfreeModule::StopVoiceRecognitionRsp, + [OPCODE_VOLUME_CONTROL] = + &BluetoothDaemonHandsfreeModule::VolumeControlRsp, + [OPCODE_DEVICE_STATUS_NOTIFICATION] = + &BluetoothDaemonHandsfreeModule::DeviceStatusNotificationRsp, + [OPCODE_COPS_RESPONSE] = + &BluetoothDaemonHandsfreeModule::CopsResponseRsp, + [OPCODE_CIND_RESPONSE] = + &BluetoothDaemonHandsfreeModule::CindResponseRsp, + [OPCODE_FORMATTED_AT_RESPONSE] = + &BluetoothDaemonHandsfreeModule::FormattedAtResponseRsp, + [OPCODE_AT_RESPONSE] = + &BluetoothDaemonHandsfreeModule::AtResponseRsp, + [OPCODE_CLCC_RESPONSE] = + &BluetoothDaemonHandsfreeModule::ClccResponseRsp, + [OPCODE_PHONE_STATE_CHANGE] = + &BluetoothDaemonHandsfreeModule::PhoneStateChangeRsp, + [OPCODE_CONFIGURE_WBS] = + &BluetoothDaemonHandsfreeModule::ConfigureWbsRsp }; MOZ_ASSERT(!NS_IsMainThread()); // I/O thread @@ -1426,22 +1426,22 @@ BluetoothDaemonHandsfreeModule::HandleNtf( { static void (BluetoothDaemonHandsfreeModule::* const HandleNtf[])( const DaemonSocketPDUHeader&, DaemonSocketPDU&) = { - INIT_ARRAY_AT(0, &BluetoothDaemonHandsfreeModule::ConnectionStateNtf), - INIT_ARRAY_AT(1, &BluetoothDaemonHandsfreeModule::AudioStateNtf), - INIT_ARRAY_AT(2, &BluetoothDaemonHandsfreeModule::VoiceRecognitionNtf), - INIT_ARRAY_AT(3, &BluetoothDaemonHandsfreeModule::AnswerCallNtf), - INIT_ARRAY_AT(4, &BluetoothDaemonHandsfreeModule::HangupCallNtf), - INIT_ARRAY_AT(5, &BluetoothDaemonHandsfreeModule::VolumeNtf), - INIT_ARRAY_AT(6, &BluetoothDaemonHandsfreeModule::DialCallNtf), - INIT_ARRAY_AT(7, &BluetoothDaemonHandsfreeModule::DtmfNtf), - INIT_ARRAY_AT(8, &BluetoothDaemonHandsfreeModule::NRECNtf), - INIT_ARRAY_AT(9, &BluetoothDaemonHandsfreeModule::CallHoldNtf), - INIT_ARRAY_AT(10, &BluetoothDaemonHandsfreeModule::CnumNtf), - INIT_ARRAY_AT(11, &BluetoothDaemonHandsfreeModule::CindNtf), - INIT_ARRAY_AT(12, &BluetoothDaemonHandsfreeModule::CopsNtf), - INIT_ARRAY_AT(13, &BluetoothDaemonHandsfreeModule::ClccNtf), - INIT_ARRAY_AT(14, &BluetoothDaemonHandsfreeModule::UnknownAtNtf), - INIT_ARRAY_AT(15, &BluetoothDaemonHandsfreeModule::KeyPressedNtf) + [0] = &BluetoothDaemonHandsfreeModule::ConnectionStateNtf, + [1] = &BluetoothDaemonHandsfreeModule::AudioStateNtf, + [2] = &BluetoothDaemonHandsfreeModule::VoiceRecognitionNtf, + [3] = &BluetoothDaemonHandsfreeModule::AnswerCallNtf, + [4] = &BluetoothDaemonHandsfreeModule::HangupCallNtf, + [5] = &BluetoothDaemonHandsfreeModule::VolumeNtf, + [6] = &BluetoothDaemonHandsfreeModule::DialCallNtf, + [7] = &BluetoothDaemonHandsfreeModule::DtmfNtf, + [8] = &BluetoothDaemonHandsfreeModule::NRECNtf, + [9] = &BluetoothDaemonHandsfreeModule::CallHoldNtf, + [10] = &BluetoothDaemonHandsfreeModule::CnumNtf, + [11] = &BluetoothDaemonHandsfreeModule::CindNtf, + [12] = &BluetoothDaemonHandsfreeModule::CopsNtf, + [13] = &BluetoothDaemonHandsfreeModule::ClccNtf, + [14] = &BluetoothDaemonHandsfreeModule::UnknownAtNtf, + [15] = &BluetoothDaemonHandsfreeModule::KeyPressedNtf }; MOZ_ASSERT(!NS_IsMainThread()); diff --git a/dom/bluetooth/bluedroid/BluetoothDaemonInterface.cpp b/dom/bluetooth/bluedroid/BluetoothDaemonInterface.cpp index 69568db8dec8..99fff7c6ebea 100644 --- a/dom/bluetooth/bluedroid/BluetoothDaemonInterface.cpp +++ b/dom/bluetooth/bluedroid/BluetoothDaemonInterface.cpp @@ -113,10 +113,10 @@ protected: const DaemonSocketPDUHeader&, DaemonSocketPDU&, BluetoothSetupResultHandler*) = { - INIT_ARRAY_AT(0x00, &BluetoothDaemonSetupModule::ErrorRsp), - INIT_ARRAY_AT(0x01, &BluetoothDaemonSetupModule::RegisterModuleRsp), - INIT_ARRAY_AT(0x02, &BluetoothDaemonSetupModule::UnregisterModuleRsp), - INIT_ARRAY_AT(0x03, &BluetoothDaemonSetupModule::ConfigurationRsp) + [0x00] = &BluetoothDaemonSetupModule::ErrorRsp, + [0x01] = &BluetoothDaemonSetupModule::RegisterModuleRsp, + [0x02] = &BluetoothDaemonSetupModule::UnregisterModuleRsp, + [0x03] = &BluetoothDaemonSetupModule::ConfigurationRsp }; if (NS_WARN_IF(aHeader.mOpcode >= MOZ_ARRAY_LENGTH(HandleRsp)) || @@ -604,8 +604,8 @@ protected: { static void (BluetoothDaemonCoreModule::* const HandleOp[])( const DaemonSocketPDUHeader&, DaemonSocketPDU&, void*) = { - INIT_ARRAY_AT(0, &BluetoothDaemonCoreModule::HandleRsp), - INIT_ARRAY_AT(1, &BluetoothDaemonCoreModule::HandleNtf), + [0] = &BluetoothDaemonCoreModule::HandleRsp, + [1] = &BluetoothDaemonCoreModule::HandleNtf }; MOZ_ASSERT(!NS_IsMainThread()); @@ -831,31 +831,27 @@ private: const DaemonSocketPDUHeader&, DaemonSocketPDU&, BluetoothResultHandler*) = { - INIT_ARRAY_AT(0x00, &BluetoothDaemonCoreModule::ErrorRsp), - INIT_ARRAY_AT(0x01, &BluetoothDaemonCoreModule::EnableRsp), - INIT_ARRAY_AT(0x02, &BluetoothDaemonCoreModule::DisableRsp), - INIT_ARRAY_AT(0x03, &BluetoothDaemonCoreModule::GetAdapterPropertiesRsp), - INIT_ARRAY_AT(0x04, &BluetoothDaemonCoreModule::GetAdapterPropertyRsp), - INIT_ARRAY_AT(0x05, &BluetoothDaemonCoreModule::SetAdapterPropertyRsp), - INIT_ARRAY_AT(0x06, - &BluetoothDaemonCoreModule::GetRemoteDevicePropertiesRsp), - INIT_ARRAY_AT(0x07, - &BluetoothDaemonCoreModule::GetRemoteDevicePropertyRsp), - INIT_ARRAY_AT(0x08, - &BluetoothDaemonCoreModule::SetRemoteDevicePropertyRsp), - INIT_ARRAY_AT(0x09, - &BluetoothDaemonCoreModule::GetRemoteServiceRecordRsp), - INIT_ARRAY_AT(0x0a, &BluetoothDaemonCoreModule::GetRemoteServicesRsp), - INIT_ARRAY_AT(0x0b, &BluetoothDaemonCoreModule::StartDiscoveryRsp), - INIT_ARRAY_AT(0x0c, &BluetoothDaemonCoreModule::CancelDiscoveryRsp), - INIT_ARRAY_AT(0x0d, &BluetoothDaemonCoreModule::CreateBondRsp), - INIT_ARRAY_AT(0x0e, &BluetoothDaemonCoreModule::RemoveBondRsp), - INIT_ARRAY_AT(0x0f, &BluetoothDaemonCoreModule::CancelBondRsp), - INIT_ARRAY_AT(0x10, &BluetoothDaemonCoreModule::PinReplyRsp), - INIT_ARRAY_AT(0x11, &BluetoothDaemonCoreModule::SspReplyRsp), - INIT_ARRAY_AT(0x12, &BluetoothDaemonCoreModule::DutModeConfigureRsp), - INIT_ARRAY_AT(0x13, &BluetoothDaemonCoreModule::DutModeSendRsp), - INIT_ARRAY_AT(0x14, &BluetoothDaemonCoreModule::LeTestModeRsp), + [0x00] = &BluetoothDaemonCoreModule::ErrorRsp, + [0x01] = &BluetoothDaemonCoreModule::EnableRsp, + [0x02] = &BluetoothDaemonCoreModule::DisableRsp, + [0x03] = &BluetoothDaemonCoreModule::GetAdapterPropertiesRsp, + [0x04] = &BluetoothDaemonCoreModule::GetAdapterPropertyRsp, + [0x05] = &BluetoothDaemonCoreModule::SetAdapterPropertyRsp, + [0x06] = &BluetoothDaemonCoreModule::GetRemoteDevicePropertiesRsp, + [0x07] = &BluetoothDaemonCoreModule::GetRemoteDevicePropertyRsp, + [0x08] = &BluetoothDaemonCoreModule::SetRemoteDevicePropertyRsp, + [0x09] = &BluetoothDaemonCoreModule::GetRemoteServiceRecordRsp, + [0x0a] = &BluetoothDaemonCoreModule::GetRemoteServicesRsp, + [0x0b] = &BluetoothDaemonCoreModule::StartDiscoveryRsp, + [0x0c] = &BluetoothDaemonCoreModule::CancelDiscoveryRsp, + [0x0d] = &BluetoothDaemonCoreModule::CreateBondRsp, + [0x0e] = &BluetoothDaemonCoreModule::RemoveBondRsp, + [0x0f] = &BluetoothDaemonCoreModule::CancelBondRsp, + [0x10] = &BluetoothDaemonCoreModule::PinReplyRsp, + [0x11] = &BluetoothDaemonCoreModule::SspReplyRsp, + [0x12] = &BluetoothDaemonCoreModule::DutModeConfigureRsp, + [0x13] = &BluetoothDaemonCoreModule::DutModeSendRsp, + [0x14] = &BluetoothDaemonCoreModule::LeTestModeRsp, }; MOZ_ASSERT(!NS_IsMainThread()); @@ -1353,17 +1349,17 @@ private: { static void (BluetoothDaemonCoreModule::* const HandleNtf[])( const DaemonSocketPDUHeader&, DaemonSocketPDU&) = { - INIT_ARRAY_AT(0, &BluetoothDaemonCoreModule::AdapterStateChangedNtf), - INIT_ARRAY_AT(1, &BluetoothDaemonCoreModule::AdapterPropertiesNtf), - INIT_ARRAY_AT(2, &BluetoothDaemonCoreModule::RemoteDevicePropertiesNtf), - INIT_ARRAY_AT(3, &BluetoothDaemonCoreModule::DeviceFoundNtf), - INIT_ARRAY_AT(4, &BluetoothDaemonCoreModule::DiscoveryStateChangedNtf), - INIT_ARRAY_AT(5, &BluetoothDaemonCoreModule::PinRequestNtf), - INIT_ARRAY_AT(6, &BluetoothDaemonCoreModule::SspRequestNtf), - INIT_ARRAY_AT(7, &BluetoothDaemonCoreModule::BondStateChangedNtf), - INIT_ARRAY_AT(8, &BluetoothDaemonCoreModule::AclStateChangedNtf), - INIT_ARRAY_AT(9, &BluetoothDaemonCoreModule::DutModeRecvNtf), - INIT_ARRAY_AT(10, &BluetoothDaemonCoreModule::LeTestModeNtf) + [0] = &BluetoothDaemonCoreModule::AdapterStateChangedNtf, + [1] = &BluetoothDaemonCoreModule::AdapterPropertiesNtf, + [2] = &BluetoothDaemonCoreModule::RemoteDevicePropertiesNtf, + [3] = &BluetoothDaemonCoreModule::DeviceFoundNtf, + [4] = &BluetoothDaemonCoreModule::DiscoveryStateChangedNtf, + [5] = &BluetoothDaemonCoreModule::PinRequestNtf, + [6] = &BluetoothDaemonCoreModule::SspRequestNtf, + [7] = &BluetoothDaemonCoreModule::BondStateChangedNtf, + [8] = &BluetoothDaemonCoreModule::AclStateChangedNtf, + [9] = &BluetoothDaemonCoreModule::DutModeRecvNtf, + [10] = &BluetoothDaemonCoreModule::LeTestModeNtf }; MOZ_ASSERT(!NS_IsMainThread()); @@ -1594,20 +1590,20 @@ BluetoothDaemonProtocol::Handle(DaemonSocketPDU& aPDU) { static void (BluetoothDaemonProtocol::* const HandleSvc[])( const DaemonSocketPDUHeader&, DaemonSocketPDU&, void*) = { - INIT_ARRAY_AT(0x00, &BluetoothDaemonProtocol::HandleSetupSvc), - INIT_ARRAY_AT(0x01, &BluetoothDaemonProtocol::HandleCoreSvc), - INIT_ARRAY_AT(0x02, &BluetoothDaemonProtocol::HandleSocketSvc), - INIT_ARRAY_AT(0x03, nullptr), // HID host - INIT_ARRAY_AT(0x04, nullptr), // PAN - INIT_ARRAY_AT(BluetoothDaemonHandsfreeModule::SERVICE_ID, - &BluetoothDaemonProtocol::HandleHandsfreeSvc), - INIT_ARRAY_AT(BluetoothDaemonA2dpModule::SERVICE_ID, - &BluetoothDaemonProtocol::HandleA2dpSvc), - INIT_ARRAY_AT(0x07, nullptr), // Health - INIT_ARRAY_AT(BluetoothDaemonAvrcpModule::SERVICE_ID, - &BluetoothDaemonProtocol::HandleAvrcpSvc), - INIT_ARRAY_AT(BluetoothDaemonGattModule::SERVICE_ID, - &BluetoothDaemonProtocol::HandleGattSvc) + [0x00] = &BluetoothDaemonProtocol::HandleSetupSvc, + [0x01] = &BluetoothDaemonProtocol::HandleCoreSvc, + [0x02] = &BluetoothDaemonProtocol::HandleSocketSvc, + [0x03] = nullptr, // HID host + [0x04] = nullptr, // PAN + [BluetoothDaemonHandsfreeModule::SERVICE_ID] = + &BluetoothDaemonProtocol::HandleHandsfreeSvc, + [BluetoothDaemonA2dpModule::SERVICE_ID] = + &BluetoothDaemonProtocol::HandleA2dpSvc, + [0x07] = nullptr, // Health + [BluetoothDaemonAvrcpModule::SERVICE_ID] = + &BluetoothDaemonProtocol::HandleAvrcpSvc, + [BluetoothDaemonGattModule::SERVICE_ID] = + &BluetoothDaemonProtocol::HandleGattSvc }; DaemonSocketPDUHeader header; diff --git a/dom/bluetooth/bluedroid/BluetoothDaemonSocketInterface.cpp b/dom/bluetooth/bluedroid/BluetoothDaemonSocketInterface.cpp index 4d0b1b4ca52d..95e13404d26e 100644 --- a/dom/bluetooth/bluedroid/BluetoothDaemonSocketInterface.cpp +++ b/dom/bluetooth/bluedroid/BluetoothDaemonSocketInterface.cpp @@ -166,9 +166,9 @@ BluetoothDaemonSocketModule::HandleSvc(const DaemonSocketPDUHeader& aHeader, const DaemonSocketPDUHeader&, DaemonSocketPDU&, BluetoothSocketResultHandler*) = { - INIT_ARRAY_AT(0x00, &BluetoothDaemonSocketModule::ErrorRsp), - INIT_ARRAY_AT(0x01, &BluetoothDaemonSocketModule::ListenRsp), - INIT_ARRAY_AT(0x02, &BluetoothDaemonSocketModule::ConnectRsp), + [0x00] = &BluetoothDaemonSocketModule::ErrorRsp, + [0x01] = &BluetoothDaemonSocketModule::ListenRsp, + [0x02] = &BluetoothDaemonSocketModule::ConnectRsp }; if (NS_WARN_IF(MOZ_ARRAY_LENGTH(HandleRsp) <= aHeader.mOpcode) ||