From e69ff22721f9fb968a18d8da6ef67d062a9e5db1 Mon Sep 17 00:00:00 2001 From: Kenny Kerr Date: Thu, 8 Feb 2024 12:46:38 -0600 Subject: [PATCH] Remove dead code related to Windows 7 support (#1390) --- strings/base_agile_ref.h | 55 ----------------------- strings/base_error.h | 97 ---------------------------------------- 2 files changed, 152 deletions(-) diff --git a/strings/base_agile_ref.h b/strings/base_agile_ref.h index 8993d846b..b85cb7e61 100644 --- a/strings/base_agile_ref.h +++ b/strings/base_agile_ref.h @@ -71,61 +71,6 @@ namespace winrt::impl using update_module_lock = module_lock_updater; - struct agile_ref_fallback final : IAgileReference, update_module_lock - { - agile_ref_fallback(com_ptr&& git, uint32_t cookie) noexcept : - m_git(std::move(git)), - m_cookie(cookie) - { - } - - ~agile_ref_fallback() noexcept - { - m_git->RevokeInterfaceFromGlobal(m_cookie); - } - - int32_t __stdcall QueryInterface(guid const& id, void** object) noexcept final - { - if (is_guid_of(id) || is_guid_of(id) || is_guid_of(id)) - { - *object = static_cast(this); - AddRef(); - return 0; - } - - *object = nullptr; - return error_no_interface; - } - - uint32_t __stdcall AddRef() noexcept final - { - return ++m_references; - } - - uint32_t __stdcall Release() noexcept final - { - auto const remaining = --m_references; - - if (remaining == 0) - { - delete this; - } - - return remaining; - } - - int32_t __stdcall Resolve(guid const& id, void** object) noexcept final - { - return m_git->GetInterfaceFromGlobal(m_cookie, id, object); - } - - private: - - com_ptr m_git; - uint32_t m_cookie{}; - atomic_ref_count m_references{ 1 }; - }; - inline void* load_library(wchar_t const* library) noexcept { return WINRT_IMPL_LoadLibraryExW(library, nullptr, 0x00001000 /* LOAD_LIBRARY_SEARCH_DEFAULT_DIRS */); diff --git a/strings/base_error.h b/strings/base_error.h index 07d688472..6e0aa103a 100644 --- a/strings/base_error.h +++ b/strings/base_error.h @@ -78,103 +78,6 @@ namespace winrt::impl { return ((int32_t)((x) | 0x10000000)); } - - struct error_info_fallback final : IErrorInfo, IRestrictedErrorInfo, update_module_lock - { - error_info_fallback(int32_t code, void* message) noexcept : - m_code(code), - m_message(message ? *reinterpret_cast(&message) : message_from_hresult(code)) - { - } - - int32_t __stdcall QueryInterface(guid const& id, void** object) noexcept final - { - if (is_guid_of(id) || is_guid_of(id) || is_guid_of(id)) - { - *object = static_cast(this); - AddRef(); - return 0; - } - - if (is_guid_of(id)) - { - *object = static_cast(this); - AddRef(); - return 0; - } - - *object = nullptr; - return error_no_interface; - } - - uint32_t __stdcall AddRef() noexcept final - { - return ++m_references; - } - - uint32_t __stdcall Release() noexcept final - { - auto const remaining = --m_references; - - if (remaining == 0) - { - delete this; - } - - return remaining; - } - - int32_t __stdcall GetGUID(guid* value) noexcept final - { - *value = {}; - return 0; - } - - int32_t __stdcall GetSource(bstr* value) noexcept final - { - *value = nullptr; - return 0; - } - - int32_t __stdcall GetDescription(bstr* value) noexcept final - { - *value = WINRT_IMPL_SysAllocString(m_message.c_str()); - return *value ? error_ok : error_bad_alloc; - } - - int32_t __stdcall GetHelpFile(bstr* value) noexcept final - { - *value = nullptr; - return 0; - } - - int32_t __stdcall GetHelpContext(uint32_t* value) noexcept final - { - *value = 0; - return 0; - } - - int32_t __stdcall GetErrorDetails(bstr* fallback, int32_t* error, bstr* message, bstr* capability) noexcept final - { - *fallback = nullptr; - *error = m_code; - *capability = nullptr; - *message = WINRT_IMPL_SysAllocString(m_message.c_str()); - return *message ? error_ok : error_bad_alloc; - } - - int32_t __stdcall GetReference(bstr* value) noexcept final - { - *value = nullptr; - return 0; - } - - private: - - hresult const m_code; - hstring const m_message; - atomic_ref_count m_references{ 1 }; - }; } WINRT_EXPORT namespace winrt