Fix wstring to string conversion warnings in GigabyteAorusLaptopControllercpp
This commit is contained in:
parent
2805476fb8
commit
2225ca0ec4
2 changed files with 10 additions and 15 deletions
|
|
@ -12,6 +12,7 @@
|
|||
#include <cmath>
|
||||
#include <string.h>
|
||||
#include "GigabyteAorusLaptopController.h"
|
||||
#include "StringUtils.h"
|
||||
|
||||
/*---------------------------------------------------------*\
|
||||
| Indexed colors mapping |
|
||||
|
|
@ -36,19 +37,6 @@ GigabyteAorusLaptopController::GigabyteAorusLaptopController(hid_device* dev_han
|
|||
dev = dev_handle;
|
||||
location = info.path;
|
||||
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());
|
||||
}
|
||||
}
|
||||
|
||||
GigabyteAorusLaptopController::~GigabyteAorusLaptopController()
|
||||
|
|
@ -63,7 +51,15 @@ std::string GigabyteAorusLaptopController::GetDeviceLocation()
|
|||
|
||||
std::string GigabyteAorusLaptopController::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 GigabyteAorusLaptopController::GetFirmwareVersion()
|
||||
|
|
|
|||
|
|
@ -69,6 +69,5 @@ private:
|
|||
unsigned char GetColourIndex(unsigned char red, unsigned char green, unsigned char blue);
|
||||
|
||||
std::string location;
|
||||
std::string serial_number;
|
||||
std::string version;
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue