Move wstring to string conversion to StringUtils.cpp and update most HID get serial number functions to use it

This commit is contained in:
Adam Honse committed 2024-07-28 17:42:01 -05:00
1 parent 366fda30f5
commit b4d15b9545
159 files changed
+623 -930

No files matched your search

+9
View File
@@ -7,6 +7,8 @@
| SPDX-License-Identifier: GPL-2.0-only |
\*---------------------------------------------------------*/
#include <codecvt>
#include <locale>
#include <string>
#include "StringUtils.h"
@@ -48,6 +50,13 @@ const char* StringUtils::wchar_to_char(const wchar_t* pwchar)
return filePathC;
}
std::string StringUtils::wstring_to_string(const std::wstring wstring)
{
std::wstring_convert<std::codecvt_utf8<wchar_t>, wchar_t> converter;
return(converter.to_bytes(wstring));
}
const std::string StringUtils::remove_null_terminating_chars(std::string input)
{
while (!input.empty() && input.back() == 0)