PATCH: server/ aliasing
Marcus Meissner
marcus at jet.franken.de
Sun Nov 17 16:50:41 CST 2002
Hi,
This fixes strict aliasing problems in the scheduler subdir.
I am not 100% sure about the pthread_once_t part, it might break
on non-Linux systems.
Ciao, Marcus
Changelog:
Fixed strict aliasing issue in __pthread_once and SetWaitableTimer.
Index: scheduler/pthread.c
===================================================================
RCS file: /home/wine/wine/scheduler/pthread.c,v
retrieving revision 1.27
diff -u -u -r1.27 pthread.c
--- scheduler/pthread.c 22 Oct 2002 00:44:24 -0000 1.27
+++ scheduler/pthread.c 17 Nov 2002 22:43:50 -0000
@@ -198,8 +198,9 @@
int __pthread_once(pthread_once_t *once_control, void (*init_routine)(void))
{
static pthread_once_t the_once = PTHREAD_ONCE_INIT;
- LONG once_now = *(LONG *)&the_once;
+ LONG once_now;
+ memcpy(&once_now,&the_once,sizeof(once_now));
if (InterlockedCompareExchange((LONG*)once_control, once_now+1, once_now) == once_now)
(*init_routine)();
return 0;
Index: scheduler/timer.c
===================================================================
RCS file: /home/wine/wine/scheduler/timer.c,v
retrieving revision 1.14
diff -u -u -r1.14 timer.c
--- scheduler/timer.c 7 Oct 2002 21:46:03 -0000 1.14
+++ scheduler/timer.c 17 Nov 2002 22:43:50 -0000
@@ -147,7 +147,11 @@
else
{
DWORD remainder;
- req->sec = DOSFS_FileTimeToUnixTime( (FILETIME *)&exp, &remainder );
+ FILETIME ft;
+
+ ft.dwLowDateTime = exp.s.LowPart;
+ ft.dwHighDateTime = exp.s.HighPart;
+ req->sec = DOSFS_FileTimeToUnixTime( &ft, &remainder );
req->usec = remainder / 10; /* convert from 100-ns to us units */
}
req->handle = handle;
More information about the wine-patches
mailing list