From b5d9fefe0e3ac56eef247c90b137d4b6d7a667c6 Mon Sep 17 00:00:00 2001 From: Mike Kaganski Date: Fri, 7 Jan 2022 13:42:20 +0300 Subject: Use CreateThread instead of _beginthreadex Change-Id: I7c272880d6567bc669d4c3c2684aa2e0daeca1b0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/128120 Tested-by: Jenkins Reviewed-by: Mike Kaganski --- vcl/win/dtrans/MtaOleClipb.cxx | 14 +++++++------- vcl/win/dtrans/MtaOleClipb.hxx | 14 +++++--------- 2 files changed, 12 insertions(+), 16 deletions(-) (limited to 'vcl/win/dtrans') diff --git a/vcl/win/dtrans/MtaOleClipb.cxx b/vcl/win/dtrans/MtaOleClipb.cxx index 4faba21367f2..6f7304fe3828 100644 --- a/vcl/win/dtrans/MtaOleClipb.cxx +++ b/vcl/win/dtrans/MtaOleClipb.cxx @@ -246,8 +246,8 @@ CMtaOleClipboard::CMtaOleClipboard( ) : s_theMtaOleClipboardInst = this; - m_hOleThread = reinterpret_cast(_beginthreadex( - nullptr, 0, CMtaOleClipboard::oleThreadProc, this, 0, &m_uOleThreadId )); + m_hOleThread = CreateThread( + nullptr, 0, CMtaOleClipboard::oleThreadProc, this, 0, &m_uOleThreadId ); OSL_ASSERT( nullptr != m_hOleThread ); // setup the clipboard changed notifier thread @@ -258,9 +258,9 @@ CMtaOleClipboard::CMtaOleClipboard( ) : m_hClipboardChangedNotifierEvents[1] = CreateEventW( nullptr, MANUAL_RESET, INIT_NONSIGNALED, nullptr ); OSL_ASSERT( nullptr != m_hClipboardChangedNotifierEvents[1] ); - unsigned uThreadId; - m_hClipboardChangedNotifierThread = reinterpret_cast(_beginthreadex( - nullptr, 0, CMtaOleClipboard::clipboardChangedNotifierThreadProc, this, 0, &uThreadId )); + DWORD uThreadId; + m_hClipboardChangedNotifierThread = CreateThread( + nullptr, 0, CMtaOleClipboard::clipboardChangedNotifierThreadProc, this, 0, &uThreadId ); OSL_ASSERT( nullptr != m_hClipboardChangedNotifierThread ); } @@ -680,7 +680,7 @@ unsigned int CMtaOleClipboard::run( ) return nRet; } -unsigned int WINAPI CMtaOleClipboard::oleThreadProc( LPVOID pParam ) +DWORD WINAPI CMtaOleClipboard::oleThreadProc( _In_ LPVOID pParam ) { osl_setThreadName("CMtaOleClipboard::run()"); @@ -691,7 +691,7 @@ unsigned int WINAPI CMtaOleClipboard::oleThreadProc( LPVOID pParam ) return pInst->run( ); } -unsigned int WINAPI CMtaOleClipboard::clipboardChangedNotifierThreadProc( LPVOID pParam ) +DWORD WINAPI CMtaOleClipboard::clipboardChangedNotifierThreadProc( _In_ LPVOID pParam ) { osl_setThreadName("CMtaOleClipboard::clipboardChangedNotifierThreadProc()"); CMtaOleClipboard* pInst = static_cast< CMtaOleClipboard* >( pParam ); diff --git a/vcl/win/dtrans/MtaOleClipb.hxx b/vcl/win/dtrans/MtaOleClipb.hxx index c406f81aafd3..a76b85e3b059 100644 --- a/vcl/win/dtrans/MtaOleClipb.hxx +++ b/vcl/win/dtrans/MtaOleClipb.hxx @@ -75,15 +75,15 @@ private: LRESULT onClipboardUpdate(); static LRESULT CALLBACK mtaOleReqWndProc( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam ); - static unsigned int WINAPI oleThreadProc( LPVOID pParam ); + static DWORD WINAPI oleThreadProc( _In_ LPVOID pParam ); - static unsigned int WINAPI clipboardChangedNotifierThreadProc( LPVOID pParam ); + static DWORD WINAPI clipboardChangedNotifierThreadProc( _In_ LPVOID pParam ); bool WaitForThreadReady( ) const; private: HANDLE m_hOleThread; - unsigned m_uOleThreadId; + DWORD m_uOleThreadId; HANDLE m_hEvtThrdReady; HWND m_hwndMtaOleReqWnd; HANDLE m_hEvtWndDisposed; @@ -103,12 +103,8 @@ private: static CMtaOleClipboard* s_theMtaOleClipboardInst; -// not allowed -private: - CMtaOleClipboard( const CMtaOleClipboard& ); - CMtaOleClipboard& operator=( const CMtaOleClipboard& ); - - friend LRESULT CALLBACK mtaOleReqWndProc( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam ); + CMtaOleClipboard( const CMtaOleClipboard& ) = delete; + CMtaOleClipboard& operator=( const CMtaOleClipboard& ) = delete; }; /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ -- cgit