Fix wstring to string conversion warnings in GigabyteAorusMouseController.cpp
This commit is contained in:
parent
2225ca0ec4
commit
bb34aba76e
2 changed files with 10 additions and 15 deletions
|
|
@ -11,25 +11,13 @@
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include "GigabyteAorusMouseController.h"
|
#include "GigabyteAorusMouseController.h"
|
||||||
|
#include "StringUtils.h"
|
||||||
|
|
||||||
GigabyteAorusMouseController::GigabyteAorusMouseController(hid_device* dev_handle, const hid_device_info& info)
|
GigabyteAorusMouseController::GigabyteAorusMouseController(hid_device* dev_handle, const hid_device_info& info)
|
||||||
{
|
{
|
||||||
dev = dev_handle;
|
dev = dev_handle;
|
||||||
location = info.path;
|
location = info.path;
|
||||||
version = "";
|
version = "";
|
||||||
|
|
||||||
wchar_t serial_string[128];
|
|
||||||
int ret = hid_get_serial_number_string(dev, serial_string, 128);
|
|
||||||
|
|
||||||
if(ret != 0)
|
|
||||||
{
|
|
||||||
serial_number = "";
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
std::wstring return_wstring = serial_string;
|
|
||||||
serial_number = std::string(return_wstring.begin(), return_wstring.end());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
GigabyteAorusMouseController::~GigabyteAorusMouseController()
|
GigabyteAorusMouseController::~GigabyteAorusMouseController()
|
||||||
|
|
@ -44,7 +32,15 @@ std::string GigabyteAorusMouseController::GetDeviceLocation()
|
||||||
|
|
||||||
std::string GigabyteAorusMouseController::GetSerialString()
|
std::string GigabyteAorusMouseController::GetSerialString()
|
||||||
{
|
{
|
||||||
return(serial_number);
|
wchar_t serial_string[128];
|
||||||
|
int ret = hid_get_serial_number_string(dev, serial_string, 128);
|
||||||
|
|
||||||
|
if(ret != 0)
|
||||||
|
{
|
||||||
|
return("");
|
||||||
|
}
|
||||||
|
|
||||||
|
return(StringUtils::wstring_to_string(serial_string));
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string GigabyteAorusMouseController::GetFirmwareVersion()
|
std::string GigabyteAorusMouseController::GetFirmwareVersion()
|
||||||
|
|
|
||||||
|
|
@ -54,6 +54,5 @@ private:
|
||||||
hid_device* dev;
|
hid_device* dev;
|
||||||
|
|
||||||
std::string location;
|
std::string location;
|
||||||
std::string serial_number;
|
|
||||||
std::string version;
|
std::string version;
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue