MCPcopy Create free account
hub / github.com/crownengine/crown / wstr_to_utf8

Function wstr_to_utf8

3rdparty/openal/common/strutils.cpp:13–26  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

11#include <windows.h>
12
13std::string wstr_to_utf8(const WCHAR *wstr)
14{
15 std::string ret;
16
17 int len = WideCharToMultiByte(CP_UTF8, 0, wstr, -1, nullptr, 0, nullptr, nullptr);
18 if(len > 0)
19 {
20 ret.resize(len);
21 WideCharToMultiByte(CP_UTF8, 0, wstr, -1, &ret[0], len, nullptr, nullptr);
22 ret.pop_back();
23 }
24
25 return ret;
26}
27
28std::wstring utf8_to_wstr(const char *str)
29{

Callers 8

ReadALConfigFunction · 0.85
helpers.cppFile · 0.85
DirectorySearchFunction · 0.85
SearchDataFilesFunction · 0.85
get_device_name_and_guidFunction · 0.85
DSoundEnumDevicesFunction · 0.85
ProbePlaybackDevicesFunction · 0.85
ProbeCaptureDevicesFunction · 0.85

Calls 2

resizeMethod · 0.45
pop_backMethod · 0.45

Tested by

no test coverage detected