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

Function CopyFilterItem

extern/nfd/nfd_win.cpp:756–784  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

754};
755
756nfdresult_t CopyFilterItem(const nfdu8filteritem_t* filterList,
757 nfdfiltersize_t count,
758 FilterItem_Guard& filterItemsNGuard) {
759 if (count) {
760 nfdnfilteritem_t*& filterItemsN = filterItemsNGuard.data;
761 filterItemsN = NFDi_Malloc<nfdnfilteritem_t>(sizeof(nfdnfilteritem_t) * count);
762 if (!filterItemsN) {
763 return NFD_ERROR;
764 }
765
766 nfdfiltersize_t& index = filterItemsNGuard.index;
767 for (; index != count; ++index) {
768 nfdresult_t res = CopyCharToWChar(filterList[index].name,
769 const_cast<nfdnchar_t*&>(filterItemsN[index].name));
770 if (!res) {
771 return NFD_ERROR;
772 }
773 res = CopyCharToWChar(filterList[index].spec,
774 const_cast<nfdnchar_t*&>(filterItemsN[index].spec));
775 if (!res) {
776 // remember to free the name, because we also created it (and it won't be protected
777 // by the guard, because we have not incremented the index)
778 NFDi_Free(const_cast<nfdnchar_t*>(filterItemsN[index].name));
779 return NFD_ERROR;
780 }
781 }
782 }
783 return NFD_OKAY;
784}
785nfdresult_t ConvertU8ToNative(const nfdu8char_t* u8Text, FreeCheck_Guard<nfdnchar_t>& nativeText) {
786 if (u8Text) {
787 nfdresult_t res = CopyCharToWChar(u8Text, nativeText.data);

Callers 3

NFD_OpenDialogU8Function · 0.85
NFD_OpenDialogMultipleU8Function · 0.85
NFD_SaveDialogU8Function · 0.85

Calls 2

CopyCharToWCharFunction · 0.85
NFDi_FreeFunction · 0.70

Tested by

no test coverage detected