Fix wstring to string conversion warning in WootingTwoKeyboardController.cpp

This commit is contained in:
Adam Honse 2024-08-07 22:01:42 -05:00
parent 68709e91f9
commit c6e315ff2a

View file

@ -10,6 +10,7 @@
\*---------------------------------------------------------*/ \*---------------------------------------------------------*/
#include <cstring> #include <cstring>
#include "StringUtils.h"
#include "WootingTwoKeyboardController.h" #include "WootingTwoKeyboardController.h"
#define WOOTING_TWO_REPORT_SIZE 257 #define WOOTING_TWO_REPORT_SIZE 257
@ -37,21 +38,22 @@ static unsigned int matrix_to_led_index_map_full[WOOTING_RGB_ROWS * WOOTING_TWO_
WootingTwoKeyboardController::WootingTwoKeyboardController(hid_device* dev_handle, const char *path, uint8_t wooting_type) WootingTwoKeyboardController::WootingTwoKeyboardController(hid_device* dev_handle, const char *path, uint8_t wooting_type)
{ {
const int szTemp = 256;
wchar_t tmpName[szTemp];
dev = dev_handle; dev = dev_handle;
location = path; location = path;
this->wooting_type = wooting_type; this->wooting_type = wooting_type;
key_code_limit = (wooting_type == WOOTING_KB_TKL) ? WOOTING_ONE_KEY_CODE_LIMIT : WOOTING_TWO_KEY_CODE_LIMIT; key_code_limit = (wooting_type == WOOTING_KB_TKL) ? WOOTING_ONE_KEY_CODE_LIMIT : WOOTING_TWO_KEY_CODE_LIMIT;
/*---------------------------------------------------------*\
| Get device HID manufacturer and product strings |
\*---------------------------------------------------------*/
const int szTemp = 256;
wchar_t tmpName[szTemp];
hid_get_manufacturer_string(dev, tmpName, szTemp); hid_get_manufacturer_string(dev, tmpName, szTemp);
std::wstring wName = std::wstring(tmpName); vendor = std::string(StringUtils::wstring_to_string(tmpName));
vendor = std::string(wName.begin(), wName.end());
hid_get_product_string(dev, tmpName, szTemp); hid_get_product_string(dev, tmpName, szTemp);
wName = std::wstring(tmpName); description = std::string(StringUtils::wstring_to_string(tmpName));
description = std::string(wName.begin(), wName.end());
SendInitialize(); SendInitialize();
} }