[vlc-commits] contribs: pthreads: Fix use of forbidden functions on winrt

Hugo Beauzée-Luyssen git at videolan.org
Wed May 11 23:13:09 CEST 2016


vlc | branch: master | Hugo Beauzée-Luyssen <hugo at beauzee.fr> | Wed May 11 21:39:38 2016 +0200| [35742fb7e033188737120c0d7d6f7cc6e2d0059b] | committer: Hugo Beauzée-Luyssen

contribs: pthreads: Fix use of forbidden functions on winrt

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=35742fb7e033188737120c0d7d6f7cc6e2d0059b
---

 contrib/src/pthreads/rules.mak   |    3 ++
 contrib/src/pthreads/winrt.patch |   56 ++++++++++++++++++++++++++++++++++++++
 2 files changed, 59 insertions(+)

diff --git a/contrib/src/pthreads/rules.mak b/contrib/src/pthreads/rules.mak
index 08ea7a5..d4b4f69 100644
--- a/contrib/src/pthreads/rules.mak
+++ b/contrib/src/pthreads/rules.mak
@@ -16,6 +16,9 @@ ifdef HAVE_WIN32
 pthreads: pthreads-w32-$(PTHREADS_W32_VERSION)-release.tar.gz .sum-pthreads
 	$(UNPACK)
 	sed -e 's/^CROSS.*=/CROSS ?=/' -i.orig $(UNPACK_DIR)/GNUmakefile
+ifdef HAVE_WINRT
+	$(APPLY) $(SRC)/pthreads/winrt.patch
+endif
 	$(MOVE)
 
 ifdef HAVE_CROSS_COMPILE
diff --git a/contrib/src/pthreads/winrt.patch b/contrib/src/pthreads/winrt.patch
new file mode 100644
index 0000000..e780f6f
--- /dev/null
+++ b/contrib/src/pthreads/winrt.patch
@@ -0,0 +1,56 @@
+--- pthreads/ptw32_getprocessors.c.orig	2016-05-11 20:50:47.774849703 +0200
++++ pthreads/ptw32_getprocessors.c	2016-05-11 20:50:56.054865989 +0200
+@@ -55,6 +55,11 @@
+ int
+ ptw32_getprocessors (int *count)
+ {
++     SYSTEM_INFO systemInfo;
++     GetNativeSystemInfo(&systemInfo);
++     return systemInfo.dwNumberOfProcessors;
++#if 0
++
+   DWORD_PTR vProcessCPUs;
+   DWORD_PTR vSystemCPUs;
+   int result = 0;
+@@ -88,4 +93,5 @@
+ #endif
+ 
+   return (result);
++#endif
+ }
+--- pthreads/pthread_win32_attach_detach_np.c.orig	2016-05-11 21:08:47.988487073 +0200
++++ pthreads/pthread_win32_attach_detach_np.c	2016-05-11 21:09:06.804511207 +0200
+@@ -70,6 +70,7 @@
+    *
+    * This should take care of any security issues.
+    */
++#if 0
+ #if defined(__GNUC__) || _MSC_VER < 1400
+   if(GetSystemDirectory(QuserExDLLPathBuf, sizeof(QuserExDLLPathBuf)))
+   {
+@@ -97,6 +98,7 @@
+ 	GetProcAddress (ptw32_h_quserex, (LPCSTR) "QueueUserAPCEx");
+ #endif
+     }
++#endif
+ 
+   if (NULL == ptw32_register_cancelation)
+     {
+--- pthreads/pthread_cancel.c.orig	2016-05-11 22:43:53.653343096 +0200
++++ pthreads/pthread_cancel.c	2016-05-11 22:54:22.110220490 +0200
+@@ -62,6 +62,7 @@
+ DWORD
+ ptw32_RegisterCancelation (PAPCFUNC unused1, HANDLE threadH, DWORD unused2)
+ {
++#if WINAPI_FAMILY_PARTITION (WINAPI_PARTITION_DESKTOP)
+   CONTEXT context;
+ 
+   context.ContextFlags = CONTEXT_CONTROL;
+@@ -69,6 +70,7 @@
+   PTW32_PROGCTR (context) = (DWORD_PTR) ptw32_cancel_self;
+   SetThreadContext (threadH, &context);
+   return 0;
++#endif
+ }
+ 
+ int



More information about the vlc-commits mailing list