MCPcopy Create free account
hub / github.com/bruderstein/nppPluginManager / wchar2char

Method wchar2char

pluginManager/src/WcharMbcsConverter.cpp:30–49  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

28
29
30shared_ptr<char> WcharMbcsConverter::wchar2char(const wchar_t* wcStr)
31{
32
33 shared_ptr<char> multiByteStr;
34
35 int len = WideCharToMultiByte(CP_UTF8, 0, wcStr, -1, NULL, 0, NULL, NULL);
36
37 if (len > 0)
38 {
39 multiByteStr.reset(new char[len]);
40 WideCharToMultiByte(CP_UTF8, 0, wcStr, -1, multiByteStr.get(), len, NULL, NULL);
41 }
42 else
43 {
44 multiByteStr.reset(new char[1]);
45 multiByteStr.get()[0] = 0;
46 }
47
48 return multiByteStr;
49}
50
51
52shared_ptr<TCHAR> WcharMbcsConverter::char2tchar(const char* mbStr)

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected