| 39 | } |
| 40 | |
| 41 | wstring 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 | |
| 53 | vector<uchar> encodeUnicodeBytes(const wstring &text) { |
| 54 | vector<uchar> bin((text.size() + 1) * sizeof(wchar_t)); |
no test coverage detected