MCPcopy Create free account
hub / github.com/bailey27/cppcryptfs / utf8_to_unicode

Function utf8_to_unicode

libcppcryptfs/util/util.cpp:141–163  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

139
140
141const WCHAR *
142utf8_to_unicode(const char *utf8_str, wstring& storage)
143{
144 int len = MultiByteToWideChar(CP_UTF8, 0, utf8_str, -1, NULL, 0);
145
146 if (len == 0)
147 return NULL;
148
149 // len includes space for null char
150 TempBuffer<WCHAR, 2048> unicode(len);
151 WCHAR* p_unicode = unicode.get();
152
153 if (!p_unicode)
154 return NULL;
155
156 if (MultiByteToWideChar(CP_UTF8, 0, utf8_str, -1, p_unicode, len) == 0) {
157 return NULL;
158 }
159
160 storage = p_unicode;
161
162 return &storage[0];
163}
164
165static const char *
166add_base64_padding(const char *str, string& storage)

Callers 4

OnInitDialogMethod · 0.85
decrypt_string_gcmFunction · 0.85
readMethod · 0.85
decrypt_filenameFunction · 0.85

Calls 1

getMethod · 0.45

Tested by

no test coverage detected