[Libreoffice-commits] core.git: sal/osl sfx2/source ucbhelper/source vcl/inc vcl/source vcl/win

2023-08-09 Thread Mike Kaganski (via logerrit)
 sal/osl/w32/dllentry.cxx |9 -
 sal/osl/w32/thread.cxx   |8 
 sfx2/source/appl/shutdowniconw32.cxx |6 +++---
 ucbhelper/source/client/proxydecider.cxx |6 --
 vcl/inc/win/dnd_target.hxx   |4 ++--
 vcl/source/app/svmain.cxx|7 +++
 vcl/win/dtrans/MtaOleClipb.cxx   |   13 ++---
 vcl/win/dtrans/MtaOleClipb.hxx   |6 +++---
 vcl/win/dtrans/source.cxx|8 
 vcl/win/dtrans/target.cxx|8 
 10 files changed, 37 insertions(+), 38 deletions(-)

New commits:
commit 8a0c43fa86bd32b4d47fd7e46d3ed414c9282ffa
Author: Mike Kaganski 
AuthorDate: Wed Aug 9 14:29:54 2023 +0300
Commit: Mike Kaganski 
CommitDate: Wed Aug 9 20:15:43 2023 +0200

Use _beginthreadex instead of CreateThread

The documentation for ExitThread [1] has this comment:

  A thread in an executable that calls the C run-time library (CRT) should 
use
  the _beginthreadex and _endthreadex functions for thread management rather
  than CreateThread and ExitThread; this requires the use of the 
multithreaded
  version of the CRT. If a thread created using CreateThread calls the CRT,
  the CRT may terminate the process in low-memory conditions.

Since ~all our code uses CRT, be safe and use _beginthreadex.

[1] 
https://learn.microsoft.com/en-us/windows/win32/api/processthreadsapi/nf-processthreadsapi-createthread

Change-Id: If3e566592e921b00240e08aa759d8cdbc421d44b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155513
Tested-by: Jenkins
Reviewed-by: Mike Kaganski 

diff --git a/sal/osl/w32/dllentry.cxx b/sal/osl/w32/dllentry.cxx
index 81139a05852b..5389c056d5a2 100644
--- a/sal/osl/w32/dllentry.cxx
+++ b/sal/osl/w32/dllentry.cxx
@@ -18,6 +18,7 @@
  */
 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -159,7 +160,7 @@ static DWORD GetParentProcessId()
 return dwParentProcessId;
 }
 
-static DWORD WINAPI ParentMonitorThreadProc( LPVOID lpParam )
+static unsigned __stdcall ParentMonitorThreadProc(void* lpParam)
 {
 DWORD_PTR dwParentProcessId = reinterpret_cast(lpParam);
 
@@ -196,8 +197,6 @@ BOOL WINAPI DllMain( HINSTANCE, DWORD fdwReason, LPVOID )
 
 if ( dwResult && dwResult < SAL_N_ELEMENTS(szBuffer) )
 {
-DWORD   dwThreadId = 0;
-
 DWORD_PTR dwParentProcessId = static_cast(_wtol( 
szBuffer ));
 
 if ( dwParentProcessId && GetParentProcessId() == 
dwParentProcessId )
@@ -205,8 +204,8 @@ BOOL WINAPI DllMain( HINSTANCE, DWORD fdwReason, LPVOID )
 // No error check, it works or it does not
 // Thread should only be started for headless mode, see 
desktop/win32/source/officeloader.cxx
 HANDLE hThread
-= CreateThread(nullptr, 0, ParentMonitorThreadProc,
-   
reinterpret_cast(dwParentProcessId), 0, );
+= reinterpret_cast(_beginthreadex(nullptr, 0, 
ParentMonitorThreadProc,
+   
reinterpret_cast(dwParentProcessId), 0, nullptr));
 // Note: calling CreateThread in DllMain is discouraged
 // but this is only done in the headless mode and in
 // that case no other threads should be running at startup
diff --git a/sal/osl/w32/thread.cxx b/sal/osl/w32/thread.cxx
index f6b3109adfb9..3640d43b9992 100644
--- a/sal/osl/w32/thread.cxx
+++ b/sal/osl/w32/thread.cxx
@@ -43,7 +43,7 @@ namespace {
 typedef struct
 {
 HANDLE  m_hThread;  /* OS-handle used for all 
thread-functions */
-DWORD   m_ThreadId; /* identifier for this thread */
+unsignedm_ThreadId; /* identifier for this thread */
 sal_Int32   m_nTerminationRequested;
 oslWorkerFunction   m_WorkerFunction;
 void*   m_pData;
@@ -54,7 +54,7 @@ typedef struct
 
 static oslThread oslCreateThread(oslWorkerFunction pWorker, void* pThreadData, 
sal_uInt32 nFlags);
 
-static DWORD WINAPI oslWorkerWrapperFunction(_In_ LPVOID pData)
+static unsigned __stdcall oslWorkerWrapperFunction(void* pData)
 {
 osl_TThreadImpl* pThreadImpl= static_cast(pData);
 
@@ -89,13 +89,13 @@ static oslThread oslCreateThread(oslWorkerFunction pWorker,
 pThreadImpl->m_pData= pThreadData;
 pThreadImpl->m_nTerminationRequested= 0;
 
-pThreadImpl->m_hThread= CreateThread(
+pThreadImpl->m_hThread= reinterpret_cast(_beginthreadex(
nullptr, /* no security */
0,   /* default 
stack-size */
oslWorkerWrapperFunction,/* worker-function 
*/
pThreadImpl, /* provide 

[Libreoffice-commits] core.git: sal/osl sfx2/source

2021-03-12 Thread Andrea Gelmini (via logerrit)
 sal/osl/w32/file.cxx|2 +-
 sfx2/source/devtools/ObjectInspectorTreeHandler.cxx |2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

New commits:
commit 5e404d6289f433e72218e13ed5a083b59dbc307b
Author: Andrea Gelmini 
AuthorDate: Fri Mar 12 17:19:32 2021 +0100
Commit: Adolfo Jayme Barrientos 
CommitDate: Fri Mar 12 19:54:29 2021 +0100

Fix typos

Change-Id: I7366c5e7d6c9fb4dd7aa17a5d0405f28179a92af
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112399
Tested-by: Jenkins
Reviewed-by: Adolfo Jayme Barrientos 

diff --git a/sal/osl/w32/file.cxx b/sal/osl/w32/file.cxx
index 44b8ac97ba09..1c13b6211779 100644
--- a/sal/osl/w32/file.cxx
+++ b/sal/osl/w32/file.cxx
@@ -657,7 +657,7 @@ oslFileError SAL_CALL osl_openFile(
 if (result != osl_File_E_None)
 return result;
 
-// tdf126742 use FILE_SHARE_WRITE to get closer to non-Windows plattform 
behavoiur,
+// tdf126742 use FILE_SHARE_WRITE to get closer to non-Windows platform 
behaviour,
 // for details and discussion see task please
 DWORD dwAccess = GENERIC_READ, dwShare = FILE_SHARE_READ | 
FILE_SHARE_WRITE, dwCreation = 0;
 
diff --git a/sfx2/source/devtools/ObjectInspectorTreeHandler.cxx 
b/sfx2/source/devtools/ObjectInspectorTreeHandler.cxx
index 6b6a1bdfcc1d..58f14e16274a 100644
--- a/sfx2/source/devtools/ObjectInspectorTreeHandler.cxx
+++ b/sfx2/source/devtools/ObjectInspectorTreeHandler.cxx
@@ -442,7 +442,7 @@ public:
 
 bool shouldShowExpander() override
 {
-// Show expnder only if the sequence has elements
+// Show expander only if the sequence has elements
 int nLength = mxIdlArray->getLen(maAny);
 return nLength > 0;
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits