From 013213b4bd76c8acb90a00bc5dc0b151f50c3649 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Br=C3=A6nne?= Date: Mon, 9 Sep 2024 08:42:29 -0700 Subject: [PATCH] Automated Code Change PiperOrigin-RevId: 672557543 --- .../platform/implementation/windows/bluetooth_adapter.cc | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/internal/platform/implementation/windows/bluetooth_adapter.cc b/internal/platform/implementation/windows/bluetooth_adapter.cc index ef8618c4..01cb325d 100644 --- a/internal/platform/implementation/windows/bluetooth_adapter.cc +++ b/internal/platform/implementation/windows/bluetooth_adapter.cc @@ -428,7 +428,8 @@ std::string BluetoothAdapter::GetName() const { HKEY hKey; // Retrieve the size required - size_t registry_query_size = absl::SNPrintF(nullptr, // output + char empty[0]; + size_t registry_query_size = absl::SNPrintF(empty, // output 0, // size REGISTRY_QUERY_FORMAT, // format instance_id.c_str()); // args @@ -599,8 +600,9 @@ bool BluetoothAdapter::SetName(absl::string_view name, bool persist) { // Convert the P&P instance id, to one that CreateFileA expects find_and_replace(instance_id_modified.data(), "\\", "#"); + char empty[0]; size_t file_name_size = - absl::SNPrintF(nullptr, 0, "\\\\.\\%s#%s", instance_id_modified.c_str(), + absl::SNPrintF(empty, 0, "\\\\.\\%s#%s", instance_id_modified.c_str(), guid_str.c_str()); std::string file_name; @@ -636,7 +638,7 @@ bool BluetoothAdapter::SetName(absl::string_view name, bool persist) { // Change radio module local name in registry HKEY hKey; size_t buffer_size = - absl::SNPrintF(nullptr, 0, REGISTRY_QUERY_FORMAT, instance_id); + absl::SNPrintF(empty, 0, REGISTRY_QUERY_FORMAT, instance_id); std::string local_name_key; local_name_key.reserve(buffer_size + 1);