From d2d3457b2fd0635e3a32a701bd0b2d17b0374b4a Mon Sep 17 00:00:00 2001 From: Shauren Date: Tue, 1 Oct 2024 21:03:44 +0200 Subject: Core/Utilities: Extend make_unique_ptr_with_deleter functionality to allow it to create deleters with compile time constant functions (reduces its size to just sizeof(void*)) (cherry picked from commit b13b5142f1009a71ff06786ac8c8db92891f566a) --- src/tools/vmap4_extractor/adtfile.cpp | 4 ++-- src/tools/vmap4_extractor/wdtfile.cpp | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'src/tools/vmap4_extractor') diff --git a/src/tools/vmap4_extractor/adtfile.cpp b/src/tools/vmap4_extractor/adtfile.cpp index 44b1198bbeb..7c09833d1d8 100644 --- a/src/tools/vmap4_extractor/adtfile.cpp +++ b/src/tools/vmap4_extractor/adtfile.cpp @@ -107,7 +107,7 @@ bool ADTFile::init(uint32 map_num, uint32 originalMapId) uint32 size; std::string dirname = Trinity::StringFormat("{}/dir_bin/{:04}", szWorkDirWmo, map_num); - auto dirfile = Trinity::make_unique_ptr_with_deleter(fopen(dirname.c_str(), "ab"), &::fclose); + auto dirfile = Trinity::make_unique_ptr_with_deleter<&::fclose>(fopen(dirname.c_str(), "ab")); if(!dirfile) { printf("Can't open dirfile!'%s'\n", dirname.c_str()); @@ -239,7 +239,7 @@ bool ADTFile::initFromCache(uint32 map_num, uint32 originalMapId) return true; std::string dirname = Trinity::StringFormat("{}/dir_bin/{:04}", szWorkDirWmo, map_num); - auto dirfile = Trinity::make_unique_ptr_with_deleter(fopen(dirname.c_str(), "ab"), &::fclose); + auto dirfile = Trinity::make_unique_ptr_with_deleter<&::fclose>(fopen(dirname.c_str(), "ab")); if (!dirfile) { printf("Can't open dirfile!'%s'\n", dirname.c_str()); diff --git a/src/tools/vmap4_extractor/wdtfile.cpp b/src/tools/vmap4_extractor/wdtfile.cpp index 43778067f1b..f213affa768 100644 --- a/src/tools/vmap4_extractor/wdtfile.cpp +++ b/src/tools/vmap4_extractor/wdtfile.cpp @@ -51,7 +51,7 @@ bool WDTFile::init(uint32 mapId) uint32 size; std::string dirname = Trinity::StringFormat("{}/dir_bin/{:04}", szWorkDirWmo, mapId); - auto dirfile = Trinity::make_unique_ptr_with_deleter(fopen(dirname.c_str(), "ab"), &::fclose); + auto dirfile = Trinity::make_unique_ptr_with_deleter<&::fclose>(fopen(dirname.c_str(), "ab")); if (!dirfile) { printf("Can't open dirfile!'%s'\n", dirname.c_str()); -- cgit v1.2.3