| 139 | |
| 140 | |
| 141 | const WCHAR * |
| 142 | utf8_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 | |
| 165 | static const char * |
| 166 | add_base64_padding(const char *str, string& storage) |
no test coverage detected