MCPcopy Create free account
hub / github.com/WallBreaker2/op / decodeUnicodeBytes

Function decodeUnicodeBytes

libop/memory/ProcessMemory.cpp:41–51  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

39}
40
41wstring decodeUnicodeBytes(const vector<uchar> &bin) {
42 if (bin.size() < sizeof(wchar_t))
43 return L"";
44 const size_t chars = bin.size() / sizeof(wchar_t);
45 wstring out(chars, L'\0');
46 memcpy(&out[0], bin.data(), chars * sizeof(wchar_t));
47 const size_t z = out.find(L'\0');
48 if (z != wstring::npos)
49 out.resize(z);
50 return out;
51}
52
53vector<uchar> encodeUnicodeBytes(const wstring &text) {
54 vector<uchar> bin((text.size() + 1) * sizeof(wchar_t));

Callers 1

ReadStringMethod · 0.85

Calls 3

findMethod · 0.80
sizeMethod · 0.45
dataMethod · 0.45

Tested by

no test coverage detected