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

Unified Diff: device/bluetooth/bluetooth_task_manager_win.cc

Issue 2941193002: Fix unique_ptr usage warning in bluetooth_task_manager_win.cc. (Closed)
Patch Set: static_cast to reinterpret_cast Created 3 years, 6 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: device/bluetooth/bluetooth_task_manager_win.cc
diff --git a/device/bluetooth/bluetooth_task_manager_win.cc b/device/bluetooth/bluetooth_task_manager_win.cc
index 3ff036515967d154e762fe9c635116ad95f5c8e4..ed2c651bd67580fcb4f113b60572001a689a8aae 100644
--- a/device/bluetooth/bluetooth_task_manager_win.cc
+++ b/device/bluetooth/bluetooth_task_manager_win.cc
@@ -864,8 +864,9 @@ void BluetoothTaskManagerWin::WriteGattCharacteristicValue(
std::vector<uint8_t> new_value,
const HResultCallback& callback) {
ULONG length = (ULONG)(sizeof(ULONG) + new_value.size());
- std::unique_ptr<BTH_LE_GATT_CHARACTERISTIC_VALUE> win_new_value(
- (PBTH_LE_GATT_CHARACTERISTIC_VALUE)(new UCHAR[length]));
+ std::vector<UCHAR> data(length);
+ auto* win_new_value =
+ reinterpret_cast<PBTH_LE_GATT_CHARACTERISTIC_VALUE>(&data[0]);
win_new_value->DataSize = (ULONG)new_value.size();
for (ULONG i = 0; i < new_value.size(); i++)
win_new_value->Data[i] = new_value[i];
@@ -873,7 +874,7 @@ void BluetoothTaskManagerWin::WriteGattCharacteristicValue(
HRESULT hr =
win::BluetoothLowEnergyWrapper::GetInstance()->WriteCharacteristicValue(
service_path, (PBTH_LE_GATT_CHARACTERISTIC)(&characteristic),
- win_new_value.get());
+ win_new_value);
ui_task_runner_->PostTask(FROM_HERE, base::Bind(callback, hr));
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698