Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(749)

Unified Diff: device/bluetooth/bluetooth_low_energy_win.cc

Issue 2317773002: Fix bluetooth callback function declaration (Closed)
Patch Set: Add comment to explain and justify cast Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: device/bluetooth/bluetooth_low_energy_win.cc
diff --git a/device/bluetooth/bluetooth_low_energy_win.cc b/device/bluetooth/bluetooth_low_energy_win.cc
index 77cfc225312f13a6495d468122675bdad817ff60..29abbad9eef86626b24e792fdd7cacd6d2078dbb 100644
--- a/device/bluetooth/bluetooth_low_energy_win.cc
+++ b/device/bluetooth/bluetooth_low_energy_win.cc
@@ -836,15 +836,20 @@ HRESULT BluetoothLowEnergyWrapper::RegisterGattEvents(
base::FilePath& service_path,
BTH_LE_GATT_EVENT_TYPE event_type,
PVOID event_parameter,
- PFNBLUETOOTH_GATT_EVENT_CALLBACK callback,
+ PFNBLUETOOTH_GATT_EVENT_CALLBACK_CORRECTED callback,
PVOID context,
BLUETOOTH_GATT_EVENT_HANDLE* out_handle) {
base::File file(service_path, base::File::FLAG_OPEN | base::File::FLAG_READ);
if (!file.IsValid())
return HRESULT_FROM_WIN32(ERROR_OPEN_FAILED);
- return BluetoothGATTRegisterEvent(file.GetPlatformFile(), event_type,
- event_parameter, callback, context,
- out_handle, BLUETOOTH_GATT_FLAG_NONE);
+ // Cast to the official callback type for compatibility with the Windows
+ // 10.0.10586 definition, even though it is incorrect. This cast can be
+ // removed when we mandate building Chromium with the 10.0.14393 SDK or
+ // higher.
+ return BluetoothGATTRegisterEvent(
+ file.GetPlatformFile(), event_type, event_parameter,
+ reinterpret_cast<PFNBLUETOOTH_GATT_EVENT_CALLBACK>(callback), context,
+ out_handle, BLUETOOTH_GATT_FLAG_NONE);
}
HRESULT BluetoothLowEnergyWrapper::UnregisterGattEvent(

Powered by Google App Engine
This is Rietveld 408576698