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

Function DecodeUTF8Path

tests/texturetests/texturetests.cc:3143–3154  ·  view source on GitHub ↗

For Windows, we convert the UTF-8 path to a UTF-16 path to force using the APIs that correctly handle unicode characters.

Source from the content-addressed store, hash-verified

3141// For Windows, we convert the UTF-8 path to a UTF-16 path to force using
3142// the APIs that correctly handle unicode characters.
3143inline std::wstring
3144DecodeUTF8Path(std::string path) {
3145 std::wstring result;
3146 int len =
3147 MultiByteToWideChar(CP_UTF8, 0, path.c_str(), static_cast<int>(path.length()), NULL, 0);
3148 if (len > 0) {
3149 result.resize(len);
3150 MultiByteToWideChar(CP_UTF8, 0, path.c_str(), static_cast<int>(path.length()), &result[0],
3151 len);
3152 }
3153 return result;
3154}
3155#else
3156// For other platforms there is no need for any conversion, they
3157// support UTF-8 natively.

Callers 14

statUTF8Function · 0.70
validateFileMethod · 0.50
executeDeflateMethod · 0.50
executeEncodeMethod · 0.50
InputStreamMethod · 0.50
OutputStreamMethod · 0.50
writeKTX2Method · 0.50
executeTranscodeMethod · 0.50
executeExtractMethod · 0.50
executeCreateMethod · 0.50
mainMethod · 0.50
mainMethod · 0.50

Calls 3

c_strMethod · 0.45
lengthMethod · 0.45
resizeMethod · 0.45

Tested by

no test coverage detected