allocs the space in outPath -- call NFDi_Free()
| 724 | |
| 725 | // allocs the space in outPath -- call NFDi_Free() |
| 726 | nfdresult_t CopyWCharToNFDChar(const nfdnchar_t* inStr, nfdu8char_t*& outStr) { |
| 727 | int bytesNeeded = WideCharToMultiByte(CP_UTF8, 0, inStr, -1, nullptr, 0, nullptr, nullptr); |
| 728 | assert(bytesNeeded); |
| 729 | |
| 730 | nfdu8char_t* tmp_outStr = NFDi_Malloc<nfdu8char_t>(sizeof(nfdu8char_t) * bytesNeeded); |
| 731 | if (!tmp_outStr) { |
| 732 | return NFD_ERROR; |
| 733 | } |
| 734 | |
| 735 | int ret = WideCharToMultiByte(CP_UTF8, 0, inStr, -1, tmp_outStr, bytesNeeded, nullptr, nullptr); |
| 736 | assert(ret && ret == bytesNeeded); |
| 737 | (void)ret; // prevent warning in release build |
| 738 | outStr = tmp_outStr; |
| 739 | return NFD_OKAY; |
| 740 | } |
| 741 | |
| 742 | struct FilterItem_Guard { |
| 743 | nfdnfilteritem_t* data; |
no outgoing calls
no test coverage detected