Bug 1202386: Output clear Bluetooth IPC errors, r=shuang
authorThomas Zimmermann <tdz@users.sourceforge.net>
Thu, 10 Sep 2015 11:32:26 +0200
changeset 261650 ac0a29169cc9fbdf077a812c95c00d002df6ceb8
parent 261649 f353659e96a7acaf3b23be1469ca90206107e60a
child 261651 5cedd3a9d283ca10c4a40552aa2d3475ad551ed4
push id15125
push userphilringnalda@gmail.com
push dateThu, 10 Sep 2015 22:34:15 +0000
treeherderfx-team@0426cdc486e7 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersshuang
bugs1202386
milestone43.0a1
Bug 1202386: Output clear Bluetooth IPC errors, r=shuang This patch improves error logging in the Bluetooth IPC code.
dom/bluetooth/bluedroid/BluetoothDaemonHelpers.cpp
--- a/dom/bluetooth/bluedroid/BluetoothDaemonHelpers.cpp
+++ b/dom/bluetooth/bluedroid/BluetoothDaemonHelpers.cpp
@@ -20,96 +20,108 @@ using mozilla::ipc::DaemonSocketPDUHelpe
 
 nsresult
 Convert(bool aIn, BluetoothScanMode& aOut)
 {
   static const BluetoothScanMode sScanMode[] = {
     [false] = SCAN_MODE_CONNECTABLE,
     [true] = SCAN_MODE_CONNECTABLE_DISCOVERABLE
   };
-  if (NS_WARN_IF(aIn >= MOZ_ARRAY_LENGTH(sScanMode))) {
+  if (MOZ_HAL_IPC_CONVERT_WARN_IF(
+        aIn >= MOZ_ARRAY_LENGTH(sScanMode), bool, BluetoothScanMode)) {
     aOut = SCAN_MODE_NONE; // silences compiler warning
     return NS_ERROR_ILLEGAL_VALUE;
   }
   aOut = sScanMode[aIn];
   return NS_OK;
 }
 
 nsresult
 Convert(int32_t aIn, BluetoothTypeOfDevice& aOut)
 {
   static const BluetoothTypeOfDevice sTypeOfDevice[] = {
     [0x00] = static_cast<BluetoothTypeOfDevice>(0), // invalid, required by gcc
     [0x01] = TYPE_OF_DEVICE_BREDR,
     [0x02] = TYPE_OF_DEVICE_BLE,
     [0x03] = TYPE_OF_DEVICE_DUAL
   };
-  if (NS_WARN_IF(!aIn) ||
-      NS_WARN_IF(static_cast<size_t>(aIn) >= MOZ_ARRAY_LENGTH(sTypeOfDevice))) {
+  if (MOZ_HAL_IPC_CONVERT_WARN_IF(
+        !aIn, int32_t, BluetoothTypeOfDevice) ||
+      MOZ_HAL_IPC_CONVERT_WARN_IF(
+        static_cast<size_t>(aIn) >= MOZ_ARRAY_LENGTH(sTypeOfDevice), int32_t,
+        BluetoothTypeOfDevice)) {
     return NS_ERROR_ILLEGAL_VALUE;
   }
   aOut = sTypeOfDevice[aIn];
   return NS_OK;
 }
 
 nsresult
 Convert(int32_t aIn, BluetoothScanMode& aOut)
 {
   static const BluetoothScanMode sScanMode[] = {
     [0x00] = SCAN_MODE_NONE,
     [0x01] = SCAN_MODE_CONNECTABLE,
     [0x02] = SCAN_MODE_CONNECTABLE_DISCOVERABLE
   };
-  if (NS_WARN_IF(aIn < 0) ||
-      NS_WARN_IF(static_cast<size_t>(aIn) >= MOZ_ARRAY_LENGTH(sScanMode))) {
+  if (MOZ_HAL_IPC_CONVERT_WARN_IF(
+        aIn < 0, int32_t, BluetoothScanMode) ||
+      MOZ_HAL_IPC_CONVERT_WARN_IF(
+        static_cast<size_t>(aIn) >= MOZ_ARRAY_LENGTH(sScanMode), int32_t,
+        BluetoothScanMode)) {
     return NS_ERROR_ILLEGAL_VALUE;
   }
   aOut = sScanMode[aIn];
   return NS_OK;
 }
 
 nsresult
 Convert(uint8_t aIn, BluetoothA2dpAudioState& aOut)
 {
   static const BluetoothA2dpAudioState sAudioState[] = {
     [0x00] = A2DP_AUDIO_STATE_REMOTE_SUSPEND,
     [0x01] = A2DP_AUDIO_STATE_STOPPED,
     [0x02] = A2DP_AUDIO_STATE_STARTED
   };
-  if (NS_WARN_IF(aIn >= MOZ_ARRAY_LENGTH(sAudioState))) {
+  if (MOZ_HAL_IPC_CONVERT_WARN_IF(
+        aIn >= MOZ_ARRAY_LENGTH(sAudioState), uint8_t,
+        BluetoothA2dpAudioState)) {
     return NS_ERROR_ILLEGAL_VALUE;
   }
   aOut = sAudioState[aIn];
   return NS_OK;
 }
 
 nsresult
 Convert(uint8_t aIn, BluetoothA2dpConnectionState& aOut)
 {
   static const BluetoothA2dpConnectionState sConnectionState[] = {
     [0x00] = A2DP_CONNECTION_STATE_DISCONNECTED,
     [0x01] = A2DP_CONNECTION_STATE_CONNECTING,
     [0x02] = A2DP_CONNECTION_STATE_CONNECTED,
     [0x03] = A2DP_CONNECTION_STATE_DISCONNECTING
   };
-  if (NS_WARN_IF(aIn >= MOZ_ARRAY_LENGTH(sConnectionState))) {
+  if (MOZ_HAL_IPC_CONVERT_WARN_IF(
+        aIn >= MOZ_ARRAY_LENGTH(sConnectionState), uint8_t,
+        BluetoothA2dpConnectionState)) {
     return NS_ERROR_ILLEGAL_VALUE;
   }
   aOut = sConnectionState[aIn];
   return NS_OK;
 }
 
 nsresult
 Convert(uint8_t aIn, BluetoothAclState& aOut)
 {
   static const BluetoothAclState sAclState[] = {
     [0x00] = ACL_STATE_CONNECTED,
     [0x01] = ACL_STATE_DISCONNECTED
   };
-  if (NS_WARN_IF(aIn >= MOZ_ARRAY_LENGTH(sAclState))) {
+  if (MOZ_HAL_IPC_CONVERT_WARN_IF(
+        aIn >= MOZ_ARRAY_LENGTH(sAclState), uint8_t, BluetoothAclState)) {
     return NS_ERROR_ILLEGAL_VALUE;
   }
   aOut = sAclState[aIn];
   return NS_OK;
 }
 
 nsresult
 Convert(uint8_t aIn, BluetoothAvrcpEvent& aOut)
@@ -120,20 +132,24 @@ Convert(uint8_t aIn, BluetoothAvrcpEvent
     [0x02] = AVRCP_EVENT_TRACK_CHANGE,
     [0x03] = AVRCP_EVENT_TRACK_REACHED_END,
     [0x04] = AVRCP_EVENT_TRACK_REACHED_START,
     [0x05] = AVRCP_EVENT_PLAY_POS_CHANGED,
     [0x06] = static_cast<BluetoothAvrcpEvent>(0),
     [0x07] = static_cast<BluetoothAvrcpEvent>(0),
     [0x08] = AVRCP_EVENT_APP_SETTINGS_CHANGED
   };
-  if (NS_WARN_IF(!aIn) ||
-      NS_WARN_IF(aIn == 0x06) ||
-      NS_WARN_IF(aIn == 0x07) ||
-      NS_WARN_IF(aIn >= MOZ_ARRAY_LENGTH(sAvrcpEvent))) {
+  if (MOZ_HAL_IPC_CONVERT_WARN_IF(
+        !aIn, uint8_t, BluetoothAvrcpEvent) ||
+      MOZ_HAL_IPC_CONVERT_WARN_IF(
+        aIn == 0x06, uint8_t, BluetoothAvrcpEvent) ||
+      MOZ_HAL_IPC_CONVERT_WARN_IF(
+        aIn == 0x07, uint8_t, BluetoothAvrcpEvent) ||
+      MOZ_HAL_IPC_CONVERT_WARN_IF(
+        aIn >= MOZ_ARRAY_LENGTH(sAvrcpEvent), uint8_t, BluetoothAvrcpEvent)) {
     aOut = static_cast<BluetoothAvrcpEvent>(0); // silences compiler warning
     return NS_ERROR_ILLEGAL_VALUE;
   }
   aOut = sAvrcpEvent[aIn];
   return NS_OK;
 }
 
 nsresult
@@ -144,18 +160,21 @@ Convert(uint8_t aIn, BluetoothAvrcpMedia
     [0x01] = AVRCP_MEDIA_ATTRIBUTE_TITLE,
     [0x02] = AVRCP_MEDIA_ATTRIBUTE_ARTIST,
     [0x03] = AVRCP_MEDIA_ATTRIBUTE_ALBUM,
     [0x04] = AVRCP_MEDIA_ATTRIBUTE_TRACK_NUM,
     [0x05] = AVRCP_MEDIA_ATTRIBUTE_NUM_TRACKS,
     [0x06] = AVRCP_MEDIA_ATTRIBUTE_GENRE,
     [0x07] = AVRCP_MEDIA_ATTRIBUTE_PLAYING_TIME
   };
-  if (NS_WARN_IF(!aIn) ||
-      NS_WARN_IF(aIn >= MOZ_ARRAY_LENGTH(sAvrcpMediaAttribute))) {
+  if (MOZ_HAL_IPC_CONVERT_WARN_IF(
+        !aIn, uint8_t, BluetoothAvrcpMediaAttrbiute) ||
+      MOZ_HAL_IPC_CONVERT_WARN_IF(
+        aIn >= MOZ_ARRAY_LENGTH(sAvrcpMediaAttribute), uint8_t,
+        BluetoothAvrcpMediaAttribute)) {
     // silences compiler warning
     aOut = static_cast<BluetoothAvrcpMediaAttribute>(0);
     return NS_ERROR_ILLEGAL_VALUE;
   }
   aOut = sAvrcpMediaAttribute[aIn];
   return NS_OK;
 }
 
@@ -164,18 +183,21 @@ Convert(uint8_t aIn, BluetoothAvrcpPlaye
 {
   static const BluetoothAvrcpPlayerAttribute sAvrcpPlayerAttribute[] = {
     [0x00] = static_cast<BluetoothAvrcpPlayerAttribute>(0),
     [0x01] = AVRCP_PLAYER_ATTRIBUTE_EQUALIZER,
     [0x02] = AVRCP_PLAYER_ATTRIBUTE_REPEAT,
     [0x03] = AVRCP_PLAYER_ATTRIBUTE_SHUFFLE,
     [0x04] = AVRCP_PLAYER_ATTRIBUTE_SCAN
   };
-  if (NS_WARN_IF(!aIn) ||
-      NS_WARN_IF(aIn >= MOZ_ARRAY_LENGTH(sAvrcpPlayerAttribute))) {
+  if (MOZ_HAL_IPC_CONVERT_WARN_IF(
+        !aIn, uint8_t, BluetoothAvrcpPlayerAttrbiute) ||
+      MOZ_HAL_IPC_CONVERT_WARN_IF(
+        aIn >= MOZ_ARRAY_LENGTH(sAvrcpPlayerAttribute), uint8_t,
+        BluetoothAvrcpPlayerAttribute)) {
     // silences compiler warning
     aOut = static_cast<BluetoothAvrcpPlayerAttribute>(0);
     return NS_ERROR_ILLEGAL_VALUE;
   }
   aOut = sAvrcpPlayerAttribute[aIn];
   return NS_OK;
 }
 
@@ -183,141 +205,159 @@ nsresult
 Convert(uint8_t aIn, BluetoothAvrcpRemoteFeature& aOut)
 {
   static const BluetoothAvrcpRemoteFeature sAvrcpRemoteFeature[] = {
     [0x00] = AVRCP_REMOTE_FEATURE_NONE,
     [0x01] = AVRCP_REMOTE_FEATURE_METADATA,
     [0x02] = AVRCP_REMOTE_FEATURE_ABSOLUTE_VOLUME,
     [0x03] = AVRCP_REMOTE_FEATURE_BROWSE
   };
-  if (NS_WARN_IF(!aIn) ||
-      NS_WARN_IF(aIn >= MOZ_ARRAY_LENGTH(sAvrcpRemoteFeature))) {
+  if (MOZ_HAL_IPC_CONVERT_WARN_IF(
+        !aIn, uint8_t, BluetoothAvrcpRemoteFeature) ||
+      MOZ_HAL_IPC_CONVERT_WARN_IF(
+        aIn >= MOZ_ARRAY_LENGTH(sAvrcpRemoteFeature), uint8_t,
+        BluetoothAvrcpRemoteFeature)) {
     // silences compiler warning
     aOut = static_cast<BluetoothAvrcpRemoteFeature>(0);
     return NS_ERROR_ILLEGAL_VALUE;
   }
   aOut = sAvrcpRemoteFeature[aIn];
   return NS_OK;
 }
 
 nsresult
 Convert(uint8_t aIn, BluetoothBondState& aOut)
 {
   static const BluetoothBondState sBondState[] = {
     [0x00] = BOND_STATE_NONE,
     [0x01] = BOND_STATE_BONDING,
     [0x02] = BOND_STATE_BONDED
   };
-  if (NS_WARN_IF(aIn >= MOZ_ARRAY_LENGTH(sBondState))) {
+  if (MOZ_HAL_IPC_CONVERT_WARN_IF(
+        aIn >= MOZ_ARRAY_LENGTH(sBondState), uint8_t, BluetoothBondState)) {
     return NS_ERROR_ILLEGAL_VALUE;
   }
   aOut = sBondState[aIn];
   return NS_OK;
 }
 
 nsresult
 Convert(uint8_t aIn, BluetoothHandsfreeAudioState& aOut)
 {
   static const BluetoothHandsfreeAudioState sAudioState[] = {
     [0x00] = HFP_AUDIO_STATE_DISCONNECTED,
     [0x01] = HFP_AUDIO_STATE_CONNECTING,
     [0x02] = HFP_AUDIO_STATE_CONNECTED,
     [0x03] = HFP_AUDIO_STATE_DISCONNECTING
   };
-  if (NS_WARN_IF(aIn >= MOZ_ARRAY_LENGTH(sAudioState))) {
+  if (MOZ_HAL_IPC_CONVERT_WARN_IF(
+        aIn >= MOZ_ARRAY_LENGTH(sAudioState), uint8_t,
+        BluetoothHandsfreeAudioState)) {
     return NS_ERROR_ILLEGAL_VALUE;
   }
   aOut = sAudioState[aIn];
   return NS_OK;
 }
 
 nsresult
 Convert(uint8_t aIn, BluetoothHandsfreeCallHoldType& aOut)
 {
   static const BluetoothHandsfreeCallHoldType sCallHoldType[] = {
     [0x00] = HFP_CALL_HOLD_RELEASEHELD,
     [0x01] = HFP_CALL_HOLD_RELEASEACTIVE_ACCEPTHELD,
     [0x02] = HFP_CALL_HOLD_HOLDACTIVE_ACCEPTHELD,
     [0x03] = HFP_CALL_HOLD_ADDHELDTOCONF
   };
-  if (NS_WARN_IF(aIn >= MOZ_ARRAY_LENGTH(sCallHoldType))) {
+  if (MOZ_HAL_IPC_CONVERT_WARN_IF(
+        aIn >= MOZ_ARRAY_LENGTH(sCallHoldType), uint8_t,
+        BluetoothHandsfreeCallHoldType)) {
     return NS_ERROR_ILLEGAL_VALUE;
   }
   aOut = sCallHoldType[aIn];
   return NS_OK;
 }
 
 nsresult
 Convert(uint8_t aIn, BluetoothHandsfreeConnectionState& aOut)
 {
   static const BluetoothHandsfreeConnectionState sConnectionState[] = {
     [0x00] = HFP_CONNECTION_STATE_DISCONNECTED,
     [0x01] = HFP_CONNECTION_STATE_CONNECTING,
     [0x02] = HFP_CONNECTION_STATE_CONNECTED,
     [0x03] = HFP_CONNECTION_STATE_SLC_CONNECTED,
     [0x04] = HFP_CONNECTION_STATE_DISCONNECTING
   };
-  if (NS_WARN_IF(aIn >= MOZ_ARRAY_LENGTH(sConnectionState))) {
+  if (MOZ_HAL_IPC_CONVERT_WARN_IF(
+        aIn >= MOZ_ARRAY_LENGTH(sConnectionState), uint8_t,
+        BluetoothHandsfreeConnectionState)) {
     return NS_ERROR_ILLEGAL_VALUE;
   }
   aOut = sConnectionState[aIn];
   return NS_OK;
 }
 
 nsresult
 Convert(uint8_t aIn, BluetoothHandsfreeNRECState& aOut)
 {
   static const BluetoothHandsfreeNRECState sNRECState[] = {
     [0x00] = HFP_NREC_STOPPED,
     [0x01] = HFP_NREC_STARTED
   };
-  if (NS_WARN_IF(aIn >= MOZ_ARRAY_LENGTH(sNRECState))) {
+  if (MOZ_HAL_IPC_CONVERT_WARN_IF(
+        aIn >= MOZ_ARRAY_LENGTH(sNRECState), uint8_t,
+        BluetoothHandsfreeNRECState)) {
     return NS_ERROR_ILLEGAL_VALUE;
   }
   aOut = sNRECState[aIn];
   return NS_OK;
 }
 
 nsresult
 Convert(uint8_t aIn, BluetoothHandsfreeVoiceRecognitionState& aOut)
 {
   static const BluetoothHandsfreeVoiceRecognitionState sState[] = {
     [0x00] = HFP_VOICE_RECOGNITION_STOPPED,
     [0x01] = HFP_VOICE_RECOGNITION_STARTED
   };
-  if (NS_WARN_IF(aIn >= MOZ_ARRAY_LENGTH(sState))) {
+  if (MOZ_HAL_IPC_CONVERT_WARN_IF(
+        aIn >= MOZ_ARRAY_LENGTH(sState), uint8_t,
+        BluetoothHandsfreeVoiceRecognitionState)) {
     return NS_ERROR_ILLEGAL_VALUE;
   }
   aOut = sState[aIn];
   return NS_OK;
 }
 
 nsresult
 Convert(uint8_t aIn, BluetoothHandsfreeVolumeType& aOut)
 {
   static const BluetoothHandsfreeVolumeType sVolumeType[] = {
     [0x00] = HFP_VOLUME_TYPE_SPEAKER,
     [0x01] = HFP_VOLUME_TYPE_MICROPHONE
   };
-  if (NS_WARN_IF(aIn >= MOZ_ARRAY_LENGTH(sVolumeType))) {
+  if (MOZ_HAL_IPC_CONVERT_WARN_IF(
+        aIn >= MOZ_ARRAY_LENGTH(sVolumeType), uint8_t,
+        BluetoothHandsfreeVolumeType)) {
     return NS_ERROR_ILLEGAL_VALUE;
   }
   aOut = sVolumeType[aIn];
   return NS_OK;
 }
 
 nsresult
 Convert(uint8_t aIn, BluetoothHandsfreeWbsConfig& aOut)
 {
   static const BluetoothHandsfreeWbsConfig sWbsConfig[] = {
     [0x00] = HFP_WBS_NONE,
     [0x01] = HFP_WBS_NO,
     [0x02] = HFP_WBS_YES
   };
-  if (NS_WARN_IF(aIn >= MOZ_ARRAY_LENGTH(sWbsConfig))) {
+  if (MOZ_HAL_IPC_CONVERT_WARN_IF(
+        aIn >= MOZ_ARRAY_LENGTH(sWbsConfig), uint8_t,
+        BluetoothHandsfreeWbsConfig)) {
     return NS_ERROR_ILLEGAL_VALUE;
   }
   aOut = sWbsConfig[aIn];
   return NS_OK;
 }
 
 nsresult
 Convert(uint8_t aIn, BluetoothTypeOfDevice& aOut)
@@ -344,54 +384,61 @@ Convert(uint8_t aIn, BluetoothPropertyTy
     [0x0c] = PROPERTY_REMOTE_VERSION_INFO
   };
   if (aIn == 0xff) {
     /* This case is handled separately to not populate
      * |sPropertyType| with empty entries. */
     aOut = PROPERTY_REMOTE_DEVICE_TIMESTAMP;
     return NS_OK;
   }
-  if (NS_WARN_IF(!aIn) ||
-      NS_WARN_IF(aIn >= MOZ_ARRAY_LENGTH(sPropertyType))) {
+  if (MOZ_HAL_IPC_CONVERT_WARN_IF(
+        !aIn, uint8_t, BluetoothPropertyType) ||
+      MOZ_HAL_IPC_CONVERT_WARN_IF(
+        aIn >= MOZ_ARRAY_LENGTH(sPropertyType), uint8_t,
+        BluetoothPropertyType)) {
     return NS_ERROR_ILLEGAL_VALUE;
   }
   aOut = sPropertyType[aIn];
   return NS_OK;
 }
 
 nsresult
 Convert(BluetoothSocketType aIn, uint8_t& aOut)
 {
   static const uint8_t sSocketType[] = {
     [0] = 0, // silences compiler warning
     [BluetoothSocketType::RFCOMM] = 0x01,
     [BluetoothSocketType::SCO] = 0x02,
     [BluetoothSocketType::L2CAP] = 0x03
     // EL2CAP not supported
   };
-  if (NS_WARN_IF(aIn == BluetoothSocketType::EL2CAP) ||
-      NS_WARN_IF(aIn >= MOZ_ARRAY_LENGTH(sSocketType)) ||
-      NS_WARN_IF(!sSocketType[aIn])) {
+  if (MOZ_HAL_IPC_CONVERT_WARN_IF(
+        aIn == BluetoothSocketType::EL2CAP, BluetoothSocketType, uint8_t) ||
+      MOZ_HAL_IPC_CONVERT_WARN_IF(
+        aIn >= MOZ_ARRAY_LENGTH(sSocketType), BluetoothSocketType, uint8_t) ||
+      MOZ_HAL_IPC_CONVERT_WARN_IF(
+        !sSocketType[aIn], BluetoothSocketType, uint8_t)) {
     aOut = 0; // silences compiler warning
     return NS_ERROR_ILLEGAL_VALUE;
   }
   aOut = sSocketType[aIn];
   return NS_OK;
 }
 
 nsresult
 Convert(uint8_t aIn, BluetoothSspVariant& aOut)
 {
   static const BluetoothSspVariant sSspVariant[] = {
     [0x00] = SSP_VARIANT_PASSKEY_CONFIRMATION,
     [0x01] = SSP_VARIANT_PASSKEY_ENTRY,
     [0x02] = SSP_VARIANT_CONSENT,
     [0x03] = SSP_VARIANT_PASSKEY_NOTIFICATION
   };
-  if (NS_WARN_IF(aIn >= MOZ_ARRAY_LENGTH(sSspVariant))) {
+  if (MOZ_HAL_IPC_CONVERT_WARN_IF(
+        aIn >= MOZ_ARRAY_LENGTH(sSspVariant), uint8_t, BluetoothSspVariant)) {
     return NS_ERROR_ILLEGAL_VALUE;
   }
   aOut = sSspVariant[aIn];
   return NS_OK;
 }
 
 nsresult
 Convert(uint8_t aIn, BluetoothStatus& aOut)
@@ -404,17 +451,18 @@ Convert(uint8_t aIn, BluetoothStatus& aO
     [0x04] = STATUS_BUSY,
     [0x05] = STATUS_DONE,
     [0x06] = STATUS_UNSUPPORTED,
     [0x07] = STATUS_PARM_INVALID,
     [0x08] = STATUS_UNHANDLED,
     [0x09] = STATUS_AUTH_FAILURE,
     [0x0a] = STATUS_RMT_DEV_DOWN
   };
-  if (NS_WARN_IF(aIn >= MOZ_ARRAY_LENGTH(sStatus))) {
+  if (MOZ_HAL_IPC_CONVERT_WARN_IF(
+        aIn >= MOZ_ARRAY_LENGTH(sStatus), uint8_t, BluetoothStatus)) {
     return NS_ERROR_ILLEGAL_VALUE;
   }
   aOut = sStatus[aIn];
   return NS_OK;
 }
 
 nsresult
 Convert(int32_t aIn, BluetoothGattStatus& aOut)
@@ -435,18 +483,21 @@ Convert(int32_t aIn, BluetoothGattStatus
     [0x000b] = GATT_STATUS_ATTRIBUTE_NOT_LONG,
     [0x000c] = GATT_STATUS_INSUFFICIENT_ENCRYPTION_KEY_SIZE,
     [0x000d] = GATT_STATUS_INVALID_ATTRIBUTE_LENGTH,
     [0x000e] = GATT_STATUS_UNLIKELY_ERROR,
     [0x000f] = GATT_STATUS_INSUFFICIENT_ENCRYPTION,
     [0x0010] = GATT_STATUS_UNSUPPORTED_GROUP_TYPE,
     [0x0011] = GATT_STATUS_INSUFFICIENT_RESOURCES
   };
-  if (NS_WARN_IF(aIn < 0) ||
-      NS_WARN_IF(aIn >= static_cast<ssize_t>(MOZ_ARRAY_LENGTH(sGattStatus)))) {
+  if (MOZ_HAL_IPC_CONVERT_WARN_IF(
+        aIn < 0, int32_t, BluetoothGattStatus) ||
+      MOZ_HAL_IPC_CONVERT_WARN_IF(
+        aIn >= static_cast<ssize_t>(MOZ_ARRAY_LENGTH(sGattStatus)), int32_t,
+        BluetoothGattStatus)) {
     aOut = GATT_STATUS_UNKNOWN_ERROR;
   } else {
     aOut = sGattStatus[aIn];
   }
   return NS_OK;
 }
 
 nsresult
@@ -461,17 +512,19 @@ Convert(const nsAString& aIn, BluetoothA
   }
 
   return NS_OK;
 }
 
 nsresult
 Convert(const nsAString& aIn, BluetoothPinCode& aOut)
 {
-  if (NS_WARN_IF(aIn.Length() > MOZ_ARRAY_LENGTH(aOut.mPinCode))) {
+  if (MOZ_HAL_IPC_CONVERT_WARN_IF(
+        aIn.Length() > MOZ_ARRAY_LENGTH(aOut.mPinCode), nsAString,
+        BluetoothPinCode)) {
     return NS_ERROR_ILLEGAL_VALUE;
   }
 
   NS_ConvertUTF16toUTF8 pinCodeUTF8(aIn);
   const char* str = pinCodeUTF8.get();
 
   nsAString::size_type i;
 
@@ -494,32 +547,34 @@ nsresult
 Convert(const nsAString& aIn, BluetoothPropertyType& aOut)
 {
   if (aIn.EqualsLiteral("Name")) {
     aOut = PROPERTY_BDNAME;
   } else if (aIn.EqualsLiteral("Discoverable")) {
     aOut = PROPERTY_ADAPTER_SCAN_MODE;
   } else if (aIn.EqualsLiteral("DiscoverableTimeout")) {
     aOut = PROPERTY_ADAPTER_DISCOVERY_TIMEOUT;
-  } else {
+  } else if (MOZ_HAL_IPC_CONVERT_WARN_IF(
+        false, nsAString, BluetoothPropertyType)) {
     BT_LOGR("Invalid property name: %s", NS_ConvertUTF16toUTF8(aIn).get());
     aOut = static_cast<BluetoothPropertyType>(0); // silences compiler warning
     return NS_ERROR_ILLEGAL_VALUE;
   }
   return NS_OK;
 }
 
 nsresult
 Convert(const nsAString& aIn, BluetoothServiceName& aOut)
 {
   NS_ConvertUTF16toUTF8 serviceNameUTF8(aIn);
   const char* str = serviceNameUTF8.get();
   size_t len = strlen(str);
 
-  if (NS_WARN_IF(len > sizeof(aOut.mName))) {
+  if (MOZ_HAL_IPC_CONVERT_WARN_IF(
+        len > sizeof(aOut.mName), nsAString, BluetoothServiceName)) {
     return NS_ERROR_ILLEGAL_VALUE;
   }
 
   memcpy(aOut.mName, str, len);
   memset(aOut.mName + len, 0, sizeof(aOut.mName) - len);
 
   return NS_OK;
 }
@@ -539,17 +594,18 @@ Convert(nsresult aIn, BluetoothStatus& a
 
 nsresult
 Convert(BluetoothAclState aIn, bool& aOut)
 {
   static const bool sBool[] = {
     [ACL_STATE_CONNECTED] = true,
     [ACL_STATE_DISCONNECTED] = false
   };
-  if (NS_WARN_IF(aIn >= MOZ_ARRAY_LENGTH(sBool))) {
+  if (MOZ_HAL_IPC_CONVERT_WARN_IF(
+        aIn >= MOZ_ARRAY_LENGTH(sBool), BluetoothAclState, bool)) {
     return NS_ERROR_ILLEGAL_VALUE;
   }
   aOut = sBool[aIn];
   return NS_OK;
 }
 
 nsresult
 Convert(const BluetoothAddress& aIn, nsAString& aOut)
@@ -558,19 +614,21 @@ Convert(const BluetoothAddress& aIn, nsA
 
   int res = snprintf(str, sizeof(str), "%02x:%02x:%02x:%02x:%02x:%02x",
                      static_cast<int>(aIn.mAddr[0]),
                      static_cast<int>(aIn.mAddr[1]),
                      static_cast<int>(aIn.mAddr[2]),
                      static_cast<int>(aIn.mAddr[3]),
                      static_cast<int>(aIn.mAddr[4]),
                      static_cast<int>(aIn.mAddr[5]));
-  if (NS_WARN_IF(res < 0)) {
+  if (MOZ_HAL_IPC_CONVERT_WARN_IF(
+        res < 0, BluetoothAddress, nsAString)) {
     return NS_ERROR_ILLEGAL_VALUE;
-  } else if (NS_WARN_IF((size_t)res >= sizeof(str))) {
+  } else if (MOZ_HAL_IPC_CONVERT_WARN_IF(
+        (size_t)res >= sizeof(str), BluetoothAddress, nsAString)) {
     return NS_ERROR_OUT_OF_MEMORY; /* string buffer too small */
   }
 
   aOut = NS_ConvertUTF8toUTF16(str);
 
   return NS_OK;
 }
 
@@ -580,58 +638,66 @@ Convert(BluetoothAvrcpEvent aIn, uint8_t
   static const uint8_t sValue[] = {
     [AVRCP_EVENT_PLAY_STATUS_CHANGED] = 0x01,
     [AVRCP_EVENT_TRACK_CHANGE] = 0x02,
     [AVRCP_EVENT_TRACK_REACHED_END] = 0x03,
     [AVRCP_EVENT_TRACK_REACHED_START] = 0x04,
     [AVRCP_EVENT_PLAY_POS_CHANGED] = 0x05,
     [AVRCP_EVENT_APP_SETTINGS_CHANGED] = 0x08
   };
-  if (NS_WARN_IF(aIn >= MOZ_ARRAY_LENGTH(sValue))) {
+  if (MOZ_HAL_IPC_CONVERT_WARN_IF(
+        aIn >= MOZ_ARRAY_LENGTH(sValue), BluetoothAvrcpEvent, uint8_t)) {
     return NS_ERROR_ILLEGAL_VALUE;
   }
   aOut = sValue[aIn];
   return NS_OK;
 }
 
 nsresult
 Convert(BluetoothAvrcpNotification aIn, uint8_t& aOut)
 {
   static const bool sValue[] = {
     [AVRCP_NTF_INTERIM] = 0x00,
     [AVRCP_NTF_CHANGED] = 0x01
   };
-  if (NS_WARN_IF(aIn >= MOZ_ARRAY_LENGTH(sValue))) {
+  if (MOZ_HAL_IPC_CONVERT_WARN_IF(
+        aIn >= MOZ_ARRAY_LENGTH(sValue), BluetoothAvrcpNotification,
+        uint8_t)) {
     return NS_ERROR_ILLEGAL_VALUE;
   }
   aOut = sValue[aIn];
   return NS_OK;
 }
 
 nsresult
 Convert(BluetoothAvrcpPlayerAttribute aIn, uint8_t& aOut)
 {
   static const uint8_t sValue[] = {
     [AVRCP_PLAYER_ATTRIBUTE_EQUALIZER] = 0x01,
     [AVRCP_PLAYER_ATTRIBUTE_REPEAT] = 0x02,
     [AVRCP_PLAYER_ATTRIBUTE_SHUFFLE] = 0x03,
     [AVRCP_PLAYER_ATTRIBUTE_SCAN] = 0x04
   };
-  if (NS_WARN_IF(aIn >= MOZ_ARRAY_LENGTH(sValue))) {
+  if (MOZ_HAL_IPC_CONVERT_WARN_IF(
+        aIn >= MOZ_ARRAY_LENGTH(sValue), BluetoothAvrcpPlayerAttribute, uint8_t)) {
     return NS_ERROR_ILLEGAL_VALUE;
   }
   aOut = sValue[aIn];
   return NS_OK;
 }
 
 nsresult
 Convert(BluetoothAvrcpRemoteFeature aIn, unsigned long& aOut)
 {
-  if (NS_WARN_IF(aIn < std::numeric_limits<unsigned long>::min()) ||
-      NS_WARN_IF(aIn > std::numeric_limits<unsigned long>::max())) {
+  if (MOZ_HAL_IPC_CONVERT_WARN_IF(
+        aIn < std::numeric_limits<unsigned long>::min(),
+        BluetoothAvrcpRemoteFeature, unsigned long) ||
+      MOZ_HAL_IPC_CONVERT_WARN_IF(
+        aIn > std::numeric_limits<unsigned long>::max(),
+        BluetoothAvrcpRemoteFeature, unsigned long)) {
     aOut = 0; // silences compiler warning
     return NS_ERROR_ILLEGAL_VALUE;
   }
   aOut = static_cast<unsigned long>(aIn);
   return NS_OK;
 }
 
 nsresult
@@ -639,61 +705,68 @@ Convert(BluetoothAvrcpStatus aIn, uint8_
 {
   static const uint8_t sValue[] = {
     [AVRCP_STATUS_BAD_COMMAND] = 0x00,
     [AVRCP_STATUS_BAD_PARAMETER] = 0x01,
     [AVRCP_STATUS_NOT_FOUND] = 0x02,
     [AVRCP_STATUS_INTERNAL_ERROR] = 0x03,
     [AVRCP_STATUS_SUCCESS] = 0x04
   };
-  if (NS_WARN_IF(aIn >= MOZ_ARRAY_LENGTH(sValue))) {
+  if (MOZ_HAL_IPC_CONVERT_WARN_IF(
+        aIn >= MOZ_ARRAY_LENGTH(sValue), BluetoothAvrcpStatus, uint8_t)) {
     return NS_ERROR_ILLEGAL_VALUE;
   }
   aOut = sValue[aIn];
   return NS_OK;
 }
 
 nsresult
 Convert(BluetoothHandsfreeAtResponse aIn, uint8_t& aOut)
 {
   static const uint8_t sAtResponse[] = {
     [HFP_AT_RESPONSE_ERROR] = 0x00,
     [HFP_AT_RESPONSE_OK] = 0x01
   };
-  if (NS_WARN_IF(aIn >= MOZ_ARRAY_LENGTH(sAtResponse))) {
+  if (MOZ_HAL_IPC_CONVERT_WARN_IF(
+        aIn >= MOZ_ARRAY_LENGTH(sAtResponse), BluetoothHandsfreeAtResponse,
+        uint8_t)) {
     aOut = 0x00; // silences compiler warning
     return NS_ERROR_ILLEGAL_VALUE;
   }
   aOut = sAtResponse[aIn];
   return NS_OK;
 }
 
 nsresult
 Convert(BluetoothHandsfreeCallAddressType aIn, uint8_t& aOut)
 {
   static const uint8_t sCallAddressType[] = {
     [HFP_CALL_ADDRESS_TYPE_UNKNOWN] = 0x81,
     [HFP_CALL_ADDRESS_TYPE_INTERNATIONAL] = 0x91
   };
-  if (NS_WARN_IF(aIn >= MOZ_ARRAY_LENGTH(sCallAddressType))) {
+  if (MOZ_HAL_IPC_CONVERT_WARN_IF(
+        aIn >= MOZ_ARRAY_LENGTH(sCallAddressType),
+        BluetoothHandsfreeCallAddressType, uint8_t)) {
     aOut = 0x00; // silences compiler warning
     return NS_ERROR_ILLEGAL_VALUE;
   }
   aOut = sCallAddressType[aIn];
   return NS_OK;
 }
 
 nsresult
 Convert(BluetoothHandsfreeCallDirection aIn, uint8_t& aOut)
 {
   static const uint8_t sCallDirection[] = {
     [HFP_CALL_DIRECTION_OUTGOING] = 0x00,
     [HFP_CALL_DIRECTION_INCOMING] = 0x01
   };
-  if (NS_WARN_IF(aIn >= MOZ_ARRAY_LENGTH(sCallDirection))) {
+  if (MOZ_HAL_IPC_CONVERT_WARN_IF(
+        aIn >= MOZ_ARRAY_LENGTH(sCallDirection),
+        BluetoothHandsfreeCallDirection, uint8_t)) {
     aOut = 0x00; // silences compiler warning
     return NS_ERROR_ILLEGAL_VALUE;
   }
   aOut = sCallDirection[aIn];
   return NS_OK;
 }
 
 nsresult
@@ -703,109 +776,122 @@ Convert(BluetoothHandsfreeCallState aIn,
     [HFP_CALL_STATE_ACTIVE] = 0x00,
     [HFP_CALL_STATE_HELD] = 0x01,
     [HFP_CALL_STATE_DIALING] = 0x02,
     [HFP_CALL_STATE_ALERTING] = 0x03,
     [HFP_CALL_STATE_INCOMING] = 0x04,
     [HFP_CALL_STATE_WAITING] = 0x05,
     [HFP_CALL_STATE_IDLE] = 0x06
   };
-  if (NS_WARN_IF(aIn >= MOZ_ARRAY_LENGTH(sCallState))) {
+  if (MOZ_HAL_IPC_CONVERT_WARN_IF(
+        aIn >= MOZ_ARRAY_LENGTH(sCallState), BluetoothHandsfreeCallState,
+        uint8_t)) {
     aOut = 0x00; // silences compiler warning
     return NS_ERROR_ILLEGAL_VALUE;
   }
   aOut = sCallState[aIn];
   return NS_OK;
 }
 
 nsresult
 Convert(BluetoothHandsfreeCallMode aIn, uint8_t& aOut)
 {
   static const uint8_t sCallMode[] = {
     [HFP_CALL_MODE_VOICE] = 0x00,
     [HFP_CALL_MODE_DATA] = 0x01,
     [HFP_CALL_MODE_FAX] = 0x02
   };
-  if (NS_WARN_IF(aIn >= MOZ_ARRAY_LENGTH(sCallMode))) {
+  if (MOZ_HAL_IPC_CONVERT_WARN_IF(
+        aIn >= MOZ_ARRAY_LENGTH(sCallMode), BluetoothHandsfreeCallMode, uint8_t)) {
     aOut = 0x00; // silences compiler warning
     return NS_ERROR_ILLEGAL_VALUE;
   }
   aOut = sCallMode[aIn];
   return NS_OK;
 }
 
 nsresult
 Convert(BluetoothHandsfreeCallMptyType aIn, uint8_t& aOut)
 {
   static const uint8_t sCallMptyType[] = {
     [HFP_CALL_MPTY_TYPE_SINGLE] = 0x00,
     [HFP_CALL_MPTY_TYPE_MULTI] = 0x01
   };
-  if (NS_WARN_IF(aIn >= MOZ_ARRAY_LENGTH(sCallMptyType))) {
+  if (MOZ_HAL_IPC_CONVERT_WARN_IF(
+        aIn >= MOZ_ARRAY_LENGTH(sCallMptyType),
+        BluetoothHandsfreeCallMptyType, uint8_t)) {
     aOut = 0x00; // silences compiler warning
     return NS_ERROR_ILLEGAL_VALUE;
   }
   aOut = sCallMptyType[aIn];
   return NS_OK;
 }
 
 nsresult
 Convert(BluetoothHandsfreeNetworkState aIn, uint8_t& aOut)
 {
   static const uint8_t sNetworkState[] = {
     [HFP_NETWORK_STATE_NOT_AVAILABLE] = 0x00,
     [HFP_NETWORK_STATE_AVAILABLE] = 0x01
   };
-  if (NS_WARN_IF(aIn >= MOZ_ARRAY_LENGTH(sNetworkState))) {
+  if (MOZ_HAL_IPC_CONVERT_WARN_IF(
+        aIn >= MOZ_ARRAY_LENGTH(sNetworkState), BluetoothHandsfreeNetworkState,
+        uint8_t)) {
     aOut = 0x00; // silences compiler warning
     return NS_ERROR_ILLEGAL_VALUE;
   }
   aOut = sNetworkState[aIn];
   return NS_OK;
 }
 
 nsresult
 Convert(BluetoothHandsfreeServiceType aIn, uint8_t& aOut)
 {
   static const uint8_t sServiceType[] = {
     [HFP_SERVICE_TYPE_HOME] = 0x00,
     [HFP_SERVICE_TYPE_ROAMING] = 0x01
   };
-  if (NS_WARN_IF(aIn >= MOZ_ARRAY_LENGTH(sServiceType))) {
+  if (MOZ_HAL_IPC_CONVERT_WARN_IF(
+        aIn >= MOZ_ARRAY_LENGTH(sServiceType), BluetoothHandsfreeServiceType,
+        uint8_t)) {
     aOut = 0x00; // silences compiler warning
     return NS_ERROR_ILLEGAL_VALUE;
   }
   aOut = sServiceType[aIn];
   return NS_OK;
 }
 
 nsresult
 Convert(BluetoothHandsfreeVolumeType aIn, uint8_t& aOut)
 {
   static const uint8_t sVolumeType[] = {
     [HFP_VOLUME_TYPE_SPEAKER] = 0x00,
     [HFP_VOLUME_TYPE_MICROPHONE] = 0x01
   };
-  if (NS_WARN_IF(aIn >= MOZ_ARRAY_LENGTH(sVolumeType))) {
+  if (MOZ_HAL_IPC_CONVERT_WARN_IF(
+        aIn >= MOZ_ARRAY_LENGTH(sVolumeType), BluetoothHandsfreeVolumeType,
+        uint8_t)) {
     aOut = 0x00; // silences compiler warning
     return NS_ERROR_ILLEGAL_VALUE;
   }
   aOut = sVolumeType[aIn];
   return NS_OK;
 }
 
 nsresult
 Convert(BluetoothHandsfreeWbsConfig aIn, uint8_t& aOut)
 {
   static const uint8_t sWbsConfig[] = {
     [HFP_WBS_NONE] = 0x00,
     [HFP_WBS_NO] = 0x01,
     [HFP_WBS_YES] = 0x02
   };
-  if (NS_WARN_IF(aIn >= MOZ_ARRAY_LENGTH(sWbsConfig))) {
+  if (MOZ_HAL_IPC_CONVERT_WARN_IF(
+        aIn >= MOZ_ARRAY_LENGTH(sWbsConfig), BluetoothHandsfreeWbsConfig,
+        uint8_t)) {
     aOut = 0x00; // silences compiler warning
     return NS_ERROR_ILLEGAL_VALUE;
   }
   aOut = sWbsConfig[aIn];
   return NS_OK;
 }
 
 nsresult
@@ -822,17 +908,19 @@ Convert(BluetoothPropertyType aIn, uint8
     [PROPERTY_ADAPTER_SCAN_MODE] = 0x07,
     [PROPERTY_ADAPTER_BONDED_DEVICES] = 0x08,
     [PROPERTY_ADAPTER_DISCOVERY_TIMEOUT] = 0x09,
     [PROPERTY_REMOTE_FRIENDLY_NAME] = 0x0a,
     [PROPERTY_REMOTE_RSSI] = 0x0b,
     [PROPERTY_REMOTE_VERSION_INFO] = 0x0c,
     [PROPERTY_REMOTE_DEVICE_TIMESTAMP] = 0xff
   };
-  if (NS_WARN_IF(aIn >= MOZ_ARRAY_LENGTH(sPropertyType))) {
+  if (MOZ_HAL_IPC_CONVERT_WARN_IF(
+        aIn >= MOZ_ARRAY_LENGTH(sPropertyType), BluetoothPropertyType,
+        uint8_t)) {
     aOut = 0x00; // silences compiler warning
     return NS_ERROR_ILLEGAL_VALUE;
   }
   aOut = sPropertyType[aIn];
   return NS_OK;
 }
 
 nsresult
@@ -850,34 +938,36 @@ Convert(const BluetoothRemoteName& aIn, 
 nsresult
 Convert(BluetoothScanMode aIn, int32_t& aOut)
 {
   static const int32_t sScanMode[] = {
     [SCAN_MODE_NONE] = 0x00,
     [SCAN_MODE_CONNECTABLE] = 0x01,
     [SCAN_MODE_CONNECTABLE_DISCOVERABLE] = 0x02
   };
-  if (NS_WARN_IF(aIn >= MOZ_ARRAY_LENGTH(sScanMode))) {
+  if (MOZ_HAL_IPC_CONVERT_WARN_IF(
+        aIn >= MOZ_ARRAY_LENGTH(sScanMode), BluetoothScanMode, int32_t)) {
     aOut = 0; // silences compiler warning
     return NS_ERROR_ILLEGAL_VALUE;
   }
   aOut = sScanMode[aIn];
   return NS_OK;
 }
 
 nsresult
 Convert(BluetoothSspVariant aIn, uint8_t& aOut)
 {
   static const uint8_t sValue[] = {
     [SSP_VARIANT_PASSKEY_CONFIRMATION] = 0x00,
     [SSP_VARIANT_PASSKEY_ENTRY] = 0x01,
     [SSP_VARIANT_CONSENT] = 0x02,
     [SSP_VARIANT_PASSKEY_NOTIFICATION] = 0x03
   };
-  if (NS_WARN_IF(aIn >= MOZ_ARRAY_LENGTH(sValue))) {
+  if (MOZ_HAL_IPC_CONVERT_WARN_IF(
+        aIn >= MOZ_ARRAY_LENGTH(sValue), BluetoothSspVariant, uint8_t)) {
     aOut = 0; // silences compiler warning
     return NS_ERROR_ILLEGAL_VALUE;
   }
   aOut = sValue[aIn];
   return NS_OK;
 }
 
 nsresult
@@ -891,17 +981,18 @@ Convert(ControlPlayStatus aIn, uint8_t& 
     [PLAYSTATUS_REV_SEEK] = 0x04
   };
   if (aIn == PLAYSTATUS_ERROR) {
     /* This case is handled separately to not populate
      * |sValue| with empty entries. */
     aOut = 0xff;
     return NS_OK;
   }
-  if (NS_WARN_IF(aIn >= MOZ_ARRAY_LENGTH(sValue))) {
+  if (MOZ_HAL_IPC_CONVERT_WARN_IF(
+        aIn >= MOZ_ARRAY_LENGTH(sValue), ControlPlayStatus, uint8_t)) {
     aOut = 0; // silences compiler warning
     return NS_ERROR_ILLEGAL_VALUE;
   }
   aOut = sValue[aIn];
   return NS_OK;
 }
 
 nsresult
@@ -909,34 +1000,38 @@ Convert(BluetoothGattAuthReq aIn, int32_
 {
   static const int32_t sGattAuthReq[] = {
     [GATT_AUTH_REQ_NONE] = 0x00,
     [GATT_AUTH_REQ_NO_MITM] = 0x01,
     [GATT_AUTH_REQ_MITM] = 0x02,
     [GATT_AUTH_REQ_SIGNED_NO_MITM] = 0x03,
     [GATT_AUTH_REQ_SIGNED_MITM] = 0x04
   };
-  if (NS_WARN_IF(aIn >= MOZ_ARRAY_LENGTH(sGattAuthReq))) {
+  if (MOZ_HAL_IPC_CONVERT_WARN_IF(
+        aIn >= MOZ_ARRAY_LENGTH(sGattAuthReq), BluetoothGattAuthReq,
+        int32_t)) {
     aOut = GATT_AUTH_REQ_NONE; // silences compiler warning
     return NS_ERROR_ILLEGAL_VALUE;
   }
   aOut = sGattAuthReq[aIn];
   return NS_OK;
 }
 
 nsresult
 Convert(BluetoothGattWriteType aIn, int32_t& aOut)
 {
   static const int32_t sGattWriteType[] = {
     [GATT_WRITE_TYPE_NO_RESPONSE] = 0x01,
     [GATT_WRITE_TYPE_NORMAL] = 0x02,
     [GATT_WRITE_TYPE_PREPARE] = 0x03,
     [GATT_WRITE_TYPE_SIGNED] = 0x04
   };
-  if (NS_WARN_IF(aIn >= MOZ_ARRAY_LENGTH(sGattWriteType))) {
+  if (MOZ_HAL_IPC_CONVERT_WARN_IF(
+        aIn >= MOZ_ARRAY_LENGTH(sGattWriteType), BluetoothGattWriteType,
+        int32_t)) {
     aOut = GATT_WRITE_TYPE_NORMAL; // silences compiler warning
     return NS_ERROR_ILLEGAL_VALUE;
   }
   aOut = sGattWriteType[aIn];
   return NS_OK;
 }
 
 /* |ConvertArray| is a helper for converting arrays. Pass an
@@ -1043,17 +1138,18 @@ PackPDU(const BluetoothAvrcpElementAttri
 {
   nsresult rv = PackPDU(PackConversion<uint32_t, uint8_t>(aIn.mId), aPDU);
   if (NS_FAILED(rv)) {
     return rv;
   }
 
   const NS_ConvertUTF16toUTF8 cstr(aIn.mValue);
 
-  if (NS_WARN_IF(cstr.Length() == PR_UINT32_MAX)) {
+  if (MOZ_HAL_IPC_PACK_WARN_IF(
+        cstr.Length() == PR_UINT32_MAX, BluetoothAvrcpElementAttribute)) {
     return NS_ERROR_ILLEGAL_VALUE; /* integer overflow detected */
   }
 
   uint32_t clen = cstr.Length() + 1; /* include \0 character */
 
   rv = PackPDU(PackConversion<uint32_t, uint8_t>(clen), aPDU);
   if (NS_FAILED(rv)) {
     return rv;
@@ -1233,17 +1329,17 @@ PackPDU(const BluetoothNamedValue& aIn, 
                    value.Length()),
                  aPDU);
   } else if (aIn.value().type() == BluetoothValue::Tbool) {
     // Set scan mode
     bool value = aIn.value().get_bool();
 
     rv = PackPDU(static_cast<uint16_t>(sizeof(int32_t)),
                  PackConversion<bool, BluetoothScanMode>(value), aPDU);
-  } else {
+  } else if (MOZ_HAL_IPC_PACK_WARN_IF(true, BluetoothNamedValue)) {
     BT_LOGR("Invalid property value type");
     rv = NS_ERROR_ILLEGAL_VALUE;
   }
   return rv;
 }
 
 nsresult
 PackPDU(const BluetoothPinCode& aIn, DaemonSocketPDU& aPDU)
@@ -1485,17 +1581,17 @@ UnpackPDU(DaemonSocketPDU& aPDU, Bluetoo
     return rv;
   }
 
   switch (aOut.mType) {
     case PROPERTY_BDNAME:
       /* fall through */
     case PROPERTY_REMOTE_FRIENDLY_NAME: {
         const uint8_t* data = aPDU.Consume(len);
-        if (NS_WARN_IF(!data)) {
+        if (MOZ_HAL_IPC_UNPACK_WARN_IF(!data, BluetoothProperty)) {
           return NS_ERROR_ILLEGAL_VALUE;
         }
         // We construct an nsCString here because the string
         // returned from the PDU is not 0-terminated.
         aOut.mString = NS_ConvertUTF8toUTF16(
           nsCString(reinterpret_cast<const char*>(data), len));
       }
       break;