allocs the space in outStr -- call NFDi_Free()
| 707 | namespace { |
| 708 | // allocs the space in outStr -- call NFDi_Free() |
| 709 | nfdresult_t CopyCharToWChar(const nfdu8char_t* inStr, nfdnchar_t*& outStr) { |
| 710 | int charsNeeded = MultiByteToWideChar(CP_UTF8, 0, inStr, -1, nullptr, 0); |
| 711 | assert(charsNeeded); |
| 712 | |
| 713 | nfdnchar_t* tmp_outStr = NFDi_Malloc<nfdnchar_t>(sizeof(nfdnchar_t) * charsNeeded); |
| 714 | if (!tmp_outStr) { |
| 715 | return NFD_ERROR; |
| 716 | } |
| 717 | |
| 718 | int ret = MultiByteToWideChar(CP_UTF8, 0, inStr, -1, tmp_outStr, charsNeeded); |
| 719 | assert(ret && ret == charsNeeded); |
| 720 | (void)ret; // prevent warning in release build |
| 721 | outStr = tmp_outStr; |
| 722 | return NFD_OKAY; |
| 723 | } |
| 724 | |
| 725 | // allocs the space in outPath -- call NFDi_Free() |
| 726 | nfdresult_t CopyWCharToNFDChar(const nfdnchar_t* inStr, nfdu8char_t*& outStr) { |
no outgoing calls
no test coverage detected