Skip to content

Commit

Permalink
Merge pull request #323 from Flamefire/function-ptr-cast
Browse files Browse the repository at this point in the history
Avoid -Wcast-function-type in get_proc_addr
  • Loading branch information
Lastique authored Aug 26, 2024
2 parents 35f348a + 4a687b1 commit c4ffb7b
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/operations.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1401,12 +1401,12 @@ BOOST_FILESYSTEM_INIT_FUNC init_winapi_func_ptrs()
boost::winapi::HMODULE_ h = boost::winapi::GetModuleHandleW(L"kernel32.dll");
if (BOOST_LIKELY(!!h))
{
GetFileInformationByHandleEx_t* get_file_information_by_handle_ex = (GetFileInformationByHandleEx_t*)boost::winapi::get_proc_address(h, "GetFileInformationByHandleEx");
GetFileInformationByHandleEx_t* get_file_information_by_handle_ex = boost::winapi::get_proc_address<GetFileInformationByHandleEx_t*>(h, "GetFileInformationByHandleEx");
filesystem::detail::atomic_store_relaxed(get_file_information_by_handle_ex_api, get_file_information_by_handle_ex);
SetFileInformationByHandle_t* set_file_information_by_handle = (SetFileInformationByHandle_t*)boost::winapi::get_proc_address(h, "SetFileInformationByHandle");
SetFileInformationByHandle_t* set_file_information_by_handle = boost::winapi::get_proc_address<SetFileInformationByHandle_t*>(h, "SetFileInformationByHandle");
filesystem::detail::atomic_store_relaxed(set_file_information_by_handle_api, set_file_information_by_handle);
filesystem::detail::atomic_store_relaxed(create_hard_link_api, (CreateHardLinkW_t*)boost::winapi::get_proc_address(h, "CreateHardLinkW"));
filesystem::detail::atomic_store_relaxed(create_symbolic_link_api, (CreateSymbolicLinkW_t*)boost::winapi::get_proc_address(h, "CreateSymbolicLinkW"));
filesystem::detail::atomic_store_relaxed(create_hard_link_api, boost::winapi::get_proc_address<CreateHardLinkW_t*>(h, "CreateHardLinkW"));
filesystem::detail::atomic_store_relaxed(create_symbolic_link_api, boost::winapi::get_proc_address<CreateSymbolicLinkW_t*>(h, "CreateSymbolicLinkW"));

if (get_file_information_by_handle_ex && set_file_information_by_handle)
{
Expand All @@ -1419,8 +1419,8 @@ BOOST_FILESYSTEM_INIT_FUNC init_winapi_func_ptrs()
h = boost::winapi::GetModuleHandleW(L"ntdll.dll");
if (BOOST_LIKELY(!!h))
{
filesystem::detail::atomic_store_relaxed(nt_create_file_api, (NtCreateFile_t*)boost::winapi::get_proc_address(h, "NtCreateFile"));
filesystem::detail::atomic_store_relaxed(nt_query_directory_file_api, (NtQueryDirectoryFile_t*)boost::winapi::get_proc_address(h, "NtQueryDirectoryFile"));
filesystem::detail::atomic_store_relaxed(nt_create_file_api, boost::winapi::get_proc_address<NtCreateFile_t*>(h, "NtCreateFile"));
filesystem::detail::atomic_store_relaxed(nt_query_directory_file_api, boost::winapi::get_proc_address<NtQueryDirectoryFile_t*>(h, "NtQueryDirectoryFile"));
}

init_directory_iterator_impl();
Expand Down

0 comments on commit c4ffb7b

Please sign in to comment.