Fix wstring to string conversion warnings in TecknetController.cpp
This commit is contained in:
parent
840bf4189a
commit
c3dccb071e
2 changed files with 15 additions and 15 deletions
|
|
@ -26,21 +26,20 @@ static unsigned char tecknet_speed_mode_data[][9] =
|
|||
|
||||
TecknetController::TecknetController(hid_device* dev_handle, char *_path)
|
||||
{
|
||||
const int szTemp = 256;
|
||||
wchar_t tmpName[szTemp];
|
||||
|
||||
dev = dev_handle;
|
||||
|
||||
hid_get_manufacturer_string(dev, tmpName, szTemp);
|
||||
std::wstring wName = std::wstring(tmpName);
|
||||
device_name = std::string(wName.begin(), wName.end());
|
||||
|
||||
hid_get_product_string(dev, tmpName, szTemp);
|
||||
wName = std::wstring(tmpName);
|
||||
device_name.append(" ").append(std::string(wName.begin(), wName.end()));
|
||||
|
||||
dev = dev_handle;
|
||||
location = _path;
|
||||
|
||||
/*---------------------------------------------------------*\
|
||||
| Get device name from HID manufacturer and product strings |
|
||||
\*---------------------------------------------------------*/
|
||||
wchar_t name_string[HID_MAX_STR];
|
||||
|
||||
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));
|
||||
|
||||
current_mode = TECKNET_MODE_DIRECT;
|
||||
current_speed = TECKNET_SPEED_NORMAL;
|
||||
current_brightness = TECKNET_BRIGHTNESS_HIGH;
|
||||
|
|
|
|||
|
|
@ -14,9 +14,10 @@
|
|||
#include <string>
|
||||
#include <hidapi/hidapi.h>
|
||||
|
||||
#define HID_MAX_STR 255
|
||||
#define TECKNET_COLOUR_MODE_DATA_SIZE (sizeof(tecknet_colour_mode_data[0]) / sizeof(tecknet_colour_mode_data[0][0]))
|
||||
#define TECKNET_DEVICE_NAME_SIZE (sizeof(device_name) / sizeof(device_name[ 0 ]))
|
||||
#define TECKNET_PACKET_LENGTH 0x10 //16 bytes
|
||||
#define TECKNET_DEVICE_NAME_SIZE (sizeof(device_name) / sizeof(device_name[ 0 ]))
|
||||
#define TECKNET_PACKET_LENGTH 0x10 //16 bytes
|
||||
|
||||
enum
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue