From 958e7dbd8f5ee006cce6c8f6e078653158290f78 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=80=9A=E6=B4=B2?= Date: Mon, 9 Feb 2026 13:33:18 +0800 Subject: [PATCH] Bluetooth (Windows): simplifies code --- src/common/windows/unicode.hpp | 5 +++++ src/detection/bluetooth/bluetooth_windows.cpp | 3 +-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/common/windows/unicode.hpp b/src/common/windows/unicode.hpp index f3bca6f48..418a206df 100644 --- a/src/common/windows/unicode.hpp +++ b/src/common/windows/unicode.hpp @@ -13,6 +13,11 @@ static inline void ffStrbufInitWSV(FFstrbuf* result, const std::wstring_view sou return ffStrbufInitNWS(result, (uint32_t) source.size(), source.data()); } +static inline FFstrbuf ffStrbufCreateWSV(const std::wstring_view source) +{ + return ffStrbufCreateNWS((uint32_t) source.size(), source.data()); +} + static inline void ffStrbufSetWSV(FFstrbuf* result, const std::wstring_view source) { return ffStrbufSetNWS(result, (uint32_t) source.size(), source.data()); diff --git a/src/detection/bluetooth/bluetooth_windows.cpp b/src/detection/bluetooth/bluetooth_windows.cpp index f4ac9c9c7..b54882d61 100644 --- a/src/detection/bluetooth/bluetooth_windows.cpp +++ b/src/detection/bluetooth/bluetooth_windows.cpp @@ -79,8 +79,7 @@ const char* ffBluetoothDetectBattery(FFlist* devices) batt = data.get(); else { - FF_STRBUF_AUTO_DESTROY addr; // MAC address without colon - ffStrbufInitWSV(&addr, data.get()); + FF_STRBUF_AUTO_DESTROY addr = ffStrbufCreateWSV(data.get()); // MAC address without colon if (__builtin_expect(addr.length != 12, 0)) continue;