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

Function CopyCharToWChar

extern/nfd/nfd_win.cpp:709–723  ·  view source on GitHub ↗

allocs the space in outStr -- call NFDi_Free()

Source from the content-addressed store, hash-verified

707namespace {
708// allocs the space in outStr -- call NFDi_Free()
709nfdresult_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()
726nfdresult_t CopyWCharToNFDChar(const nfdnchar_t* inStr, nfdu8char_t*& outStr) {

Callers 2

CopyFilterItemFunction · 0.85
ConvertU8ToNativeFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected