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 "StringUtils.h"
#include "WootingTwoKeyboardController.h"
#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)
{
const int szTemp = 256;
wchar_t tmpName[szTemp];
dev = dev_handle;
location = path;
this->wooting_type = wooting_type;
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);
std::wstring wName = std::wstring(tmpName);
vendor = std::string(wName.begin(), wName.end());
vendor = std::string(StringUtils::wstring_to_string(tmpName));
hid_get_product_string(dev, tmpName, szTemp);
wName = std::wstring(tmpName);
description = std::string(wName.begin(), wName.end());
description = std::string(StringUtils::wstring_to_string(tmpName));
SendInitialize();
}