MCPcopy Create free account
hub / github.com/Tencent/libpag / WstringToString

Function WstringToString

exporter/src/platform/win/PAGViewerCheck.cpp:86–100  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

84}
85
86static std::string WstringToString(const std::wstring& wstr) {
87 if (wstr.empty()) {
88 return "";
89 }
90
91 auto size = WideCharToMultiByte(CP_UTF8, 0, wstr.c_str(), static_cast<int>(wstr.length()),
92 nullptr, 0, nullptr, nullptr);
93 if (size <= 0) {
94 return std::string();
95 }
96 std::string result(size, 0);
97 WideCharToMultiByte(CP_UTF8, 0, wstr.c_str(), static_cast<int>(wstr.length()), &result[0], size,
98 nullptr, nullptr);
99 return result;
100}
101
102static std::string ReadRegistryStringValue(const RegistryKey& key, const std::wstring& valueName) {
103 if (!key.isValid()) {

Callers 1

ReadRegistryStringValueFunction · 0.85

Calls 2

emptyMethod · 0.80
lengthMethod · 0.45

Tested by

no test coverage detected