MCPcopy Create free account
hub / github.com/KhronosGroup/KTX-Software / InitUTF8CLI

Function InitUTF8CLI

utils/platform_utils.h:45–62  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

43#endif
44
45inline void InitUTF8CLI(int& argc, char* argv[]) {
46#if defined(_WIN32)
47 // Windows does not support UTF-8 argv so we have to manually acquire it
48 static std::vector<std::unique_ptr<char[]>> utf8Argv(argc);
49 LPWSTR commandLine = GetCommandLineW();
50 LPWSTR* wideArgv = CommandLineToArgvW(commandLine, &argc);
51 for (int i = 0; i < argc; ++i) {
52 int byteSize = WideCharToMultiByte(CP_UTF8, 0, wideArgv[i], -1, nullptr, 0, nullptr, nullptr);
53 utf8Argv[i] = std::make_unique<char[]>(byteSize);
54 WideCharToMultiByte(CP_UTF8, 0, wideArgv[i], -1, utf8Argv[i].get(), byteSize, nullptr, nullptr);
55 argv[i] = utf8Argv[i].get();
56 }
57#else
58 // Nothing to do for other platforms
59 (void)argc;
60 (void)argv;
61#endif
62}
63
64inline FILE* fopenUTF8(const std::string& path, const std::string& mode) {
65#if defined(_WIN32)

Callers 4

mainFunction · 0.85
mainFunction · 0.85
mainFunction · 0.85
mainFunction · 0.85

Calls 1

getMethod · 0.45

Tested by

no test coverage detected