MCPcopy Create free account
hub / github.com/OpenImageDebugger/OpenImageDebugger / utf8_to_wide

Function utf8_to_wide

src/system/process/process_win32.cpp:42–65  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

40namespace {
41
42std::wstring utf8_to_wide(const std::string& text) {
43 if (text.empty()) {
44 return {};
45 }
46
47 const auto size = MultiByteToWideChar(CP_UTF8,
48 MB_ERR_INVALID_CHARS,
49 text.data(),
50 static_cast<int>(text.size()),
51 nullptr,
52 0);
53 if (size <= 0) {
54 return {};
55 }
56
57 std::wstring wide(static_cast<size_t>(size), L'\0');
58 MultiByteToWideChar(CP_UTF8,
59 MB_ERR_INVALID_CHARS,
60 text.data(),
61 static_cast<int>(text.size()),
62 wide.data(),
63 size);
64 return wide;
65}
66
67std::wstring quote_windows_arg(const std::wstring& arg) {
68 if (arg.empty()) {

Callers 1

build_command_lineFunction · 0.85

Calls 2

dataMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected