Bug 1128441 - [BlueDroid] Set Bluetooth discoverable timeout properly in 'Convert' function of Bluetooth interface. r=shuang
authorJamin Liu <jaliu@mozilla.com>
Thu, 05 Mar 2015 13:32:23 +0800
changeset 232076 839a1eb14d2071211f808b3f39b0ff0431016812
parent 232075 db595b5a24578a6fffab652994e7928221f08562
child 232077 1778759ae4fc4a8aa549b3b56fdd9d0097fb685d
push id28369
push userkwierso@gmail.com
push dateThu, 05 Mar 2015 23:36:09 +0000
treeherdermozilla-central@0189941a3fd5 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersshuang
bugs1128441
milestone39.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1128441 - [BlueDroid] Set Bluetooth discoverable timeout properly in 'Convert' function of Bluetooth interface. r=shuang
dom/bluetooth/bluedroid/BluetoothHALHelpers.cpp
dom/bluetooth2/bluedroid/BluetoothHALHelpers.cpp
--- a/dom/bluetooth/bluedroid/BluetoothHALHelpers.cpp
+++ b/dom/bluetooth/bluedroid/BluetoothHALHelpers.cpp
@@ -35,18 +35,19 @@ Convert(ConvertNamedValue& aIn, bt_prope
 {
   nsresult rv = Convert(aIn.mNamedValue.name(), aOut.type);
   if (NS_FAILED(rv)) {
     return rv;
   }
 
   if (aIn.mNamedValue.value().type() == BluetoothValue::Tuint32_t) {
     // Set discoverable timeout
-    aOut.val =
-      reinterpret_cast<void*>(aIn.mNamedValue.value().get_uint32_t());
+    aOut.val = const_cast<void*>(static_cast<const void*>(
+      &(aIn.mNamedValue.value().get_uint32_t())));
+      aOut.len = sizeof(uint32_t);
   } else if (aIn.mNamedValue.value().type() == BluetoothValue::TnsString) {
     // Set name
     aIn.mStringValue =
       NS_ConvertUTF16toUTF8(aIn.mNamedValue.value().get_nsString());
     aOut.val =
       const_cast<void*>(static_cast<const void*>(aIn.mStringValue.get()));
     aOut.len = strlen(static_cast<char*>(aOut.val));
   } else if (aIn.mNamedValue.value().type() == BluetoothValue::Tbool) {
--- a/dom/bluetooth2/bluedroid/BluetoothHALHelpers.cpp
+++ b/dom/bluetooth2/bluedroid/BluetoothHALHelpers.cpp
@@ -35,18 +35,19 @@ Convert(ConvertNamedValue& aIn, bt_prope
 {
   nsresult rv = Convert(aIn.mNamedValue.name(), aOut.type);
   if (NS_FAILED(rv)) {
     return rv;
   }
 
   if (aIn.mNamedValue.value().type() == BluetoothValue::Tuint32_t) {
     // Set discoverable timeout
-    aOut.val =
-      reinterpret_cast<void*>(aIn.mNamedValue.value().get_uint32_t());
+    aOut.val = const_cast<void*>(static_cast<const void*>(
+      &(aIn.mNamedValue.value().get_uint32_t())));
+      aOut.len = sizeof(uint32_t);
   } else if (aIn.mNamedValue.value().type() == BluetoothValue::TnsString) {
     // Set name
     aIn.mStringValue =
       NS_ConvertUTF16toUTF8(aIn.mNamedValue.value().get_nsString());
     aOut.val =
       const_cast<void*>(static_cast<const void*>(aIn.mStringValue.get()));
     aOut.len = strlen(static_cast<char*>(aOut.val));
   } else if (aIn.mNamedValue.value().type() == BluetoothValue::Tbool) {