From 773a59cf2ed096999246c201dcc7d6397005e8c7 Mon Sep 17 00:00:00 2001 From: Adam Honse Date: Wed, 31 Jul 2024 22:07:14 -0500 Subject: [PATCH] Fix wstring to string conversion warning in CougarKeyboardController.cpp --- .../CougarKeyboardController.cpp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/Controllers/CougarController/CougarKeyboardController/CougarKeyboardController.cpp b/Controllers/CougarController/CougarKeyboardController/CougarKeyboardController.cpp index 5a4fa047..4b7c3fa6 100644 --- a/Controllers/CougarController/CougarKeyboardController/CougarKeyboardController.cpp +++ b/Controllers/CougarController/CougarKeyboardController/CougarKeyboardController.cpp @@ -56,19 +56,19 @@ static uint8_t keyvalue_map[113] = CougarKeyboardController::CougarKeyboardController(hid_device* dev_handle, const char* path) { - const uint8_t sz = HID_MAX_STR; - wchar_t tmp[sz]; - dev = dev_handle; location = path; - hid_get_manufacturer_string(dev, tmp, sz); - std::wstring wName = std::wstring(tmp); - device_name = std::string(wName.begin(), wName.end()); + /*---------------------------------------------------------*\ + | Get device name from HID manufacturer and product strings | + \*---------------------------------------------------------*/ + wchar_t name_string[HID_MAX_STR]; - hid_get_product_string(dev, tmp, sz); - wName = std::wstring(tmp); - device_name.append(" ").append(std::string(wName.begin(), wName.end())); + hid_get_manufacturer_string(dev, name_string, HID_MAX_STR); + device_name = StringUtils::wstring_to_string(name_string); + + hid_get_product_string(dev, name_string, HID_MAX_STR); + device_name.append(" ").append(StringUtils::wstring_to_string(name_string)); } CougarKeyboardController::~CougarKeyboardController()