MCPcopy Create free account
hub / github.com/InteractiveComputerGraphics/SPlisHSPlasH / CopyWCharToNFDChar

Function CopyWCharToNFDChar

extern/nfd/nfd_win.cpp:726–740  ·  view source on GitHub ↗

allocs the space in outPath -- call NFDi_Free()

Source from the content-addressed store, hash-verified

724
725// allocs the space in outPath -- call NFDi_Free()
726nfdresult_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
742struct FilterItem_Guard {
743 nfdnfilteritem_t* data;

Callers 5

NFD_OpenDialogU8Function · 0.85
NFD_SaveDialogU8Function · 0.85
NFD_PickFolderU8Function · 0.85
NFD_PathSet_GetPathU8Function · 0.85
NFD_PathSet_EnumNextU8Function · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected