* WINDOWS function to convert utf-8 strings to wchar_t (utf16) strings. * Windows wchar_t is utf-16. * Memory is allocated by the calling program memory allocation function. * The calling function must check for errors. */
| 2619 | * The calling function must check for errors. |
| 2620 | */ |
| 2621 | wchar_t* ASLibrary::convertUtf8ToUtf16(const char* utf8In, fpAlloc fpMemoryAlloc) const |
| 2622 | { |
| 2623 | int wideLen = MultiByteToWideChar(CP_UTF8, 0, utf8In, -1, 0, 0); |
| 2624 | if (wideLen == 0) |
| 2625 | return NULL; |
| 2626 | wchar_t* wide = reinterpret_cast<wchar_t*>(fpMemoryAlloc(wideLen * 2)); |
| 2627 | if (wide == NULL) |
| 2628 | return NULL; |
| 2629 | MultiByteToWideChar(CP_UTF8, 0, utf8In, -1, wide, wideLen); |
| 2630 | return wide; |
| 2631 | } |
| 2632 | |
| 2633 | /** |
| 2634 | * WINDOWS function to convert wchar_t (utf16) strings to utf-8 strings. |
nothing calls this directly
no outgoing calls
no test coverage detected