diff options
author | Wolfgang Draxinger <Wolfgang.Draxinger@physik.uni-muenchen.de> | 2014-06-03 18:02:36 +0200 |
---|---|---|
committer | Wolfgang Draxinger <Wolfgang.Draxinger@physik.uni-muenchen.de> | 2014-06-03 18:02:36 +0200 |
commit | 8fd64d5e3783607ce31e89c7f4db78528dbe17fa (patch) | |
tree | 4ff657d11945ad9ad6f2ce45b842ba0a86a9acf0 | |
parent | 20f7478da933e74238e868bb592efb4e783ebdb9 (diff) | |
download | wglarb-8fd64d5e3783607ce31e89c7f4db78528dbe17fa.tar.gz wglarb-8fd64d5e3783607ce31e89c7f4db78528dbe17fa.tar.bz2 |
C99 compliant function pointer casting
-rw-r--r-- | test/Makefile | 4 | ||||
-rw-r--r-- | wglarb.c | 21 |
2 files changed, 14 insertions, 11 deletions
diff --git a/test/Makefile b/test/Makefile index 946272e..52128ef 100644 --- a/test/Makefile +++ b/test/Makefile @@ -1,5 +1,5 @@ TARGET64=x86_64-w64-mingw32 -TARGET32=mingw32 +TARGET32=i686-w64-mingw32 CC64=-$(TARGET64)-gcc CC32=-$(TARGET32)-gcc CFLAGS=-static-libgcc -static-libstdc++ -I.. @@ -25,3 +25,5 @@ layered64_rc.o: layered.rc manifest.xml layered32_rc.o: layered.rc manifest.xml $(WINDRES32) --input layered.rc --output layered32_rc.o +clean: + rm *.o *.exe @@ -33,7 +33,9 @@ static DWORD wglarb_intermediary_lock(void) if( !wglarb_intermediary_mutex ) { /* Between testing for the validity of the mutex handle, * creating a new mutex handle and using the interlocked - * exchange there is a race. */ + * exchange there is a race... */ + + /* //// START \\\\ */ HANDLE const new_mutex = CreateMutex(NULL, TRUE, NULL); @@ -44,6 +46,8 @@ static DWORD wglarb_intermediary_lock(void) new_mutex, NULL ); + /* //// FINISH \\\\ */ + if( dst_mutex ) { /* In this case we lost the race and another thread * beat this thread in creating a mutex object. @@ -85,7 +89,6 @@ static BOOL wglarb_intermediary_create_Wnd(void) wc.lpszClassName = WGLARB_INTERMEDIARY_CLASS; RegisterClass(&wc); - /* Create a temporaray context to get address of wgl extensions. */ wglarb_intermediary_hWnd = CreateWindowEx( WGLARB_INTERMEDIARY_EXSTYLE, @@ -95,7 +98,7 @@ static BOOL wglarb_intermediary_create_Wnd(void) 0,0,0,0, NULL,NULL, hInstance, - NULL); + NULL ); if( !wglarb_intermediary_hWnd ) { FALSE; @@ -160,7 +163,7 @@ static BOOL wglarb_intermediary_makecurrent(HDC *hOrigDC, HGLRC *hOrigRC) *hOrigRC = wglGetCurrentContext(); if( !wglarb_intermediary_hRC - && !wglarb_intermediary_create_RC() ) { + && !wglarb_intermediary_create_RC() ) { return FALSE; } @@ -183,9 +186,8 @@ HGLRC WINAPI wglarb_CreateContextAttribsARB( return NULL; } - PFNWGLCREATECONTEXTATTRIBSARBPROC impl = - (PFNWGLCREATECONTEXTATTRIBSARBPROC) wglGetProcAddress( - "wglCreateContextAttribsARB"); + PFNWGLCREATECONTEXTATTRIBSARBPROC impl; + *(PROC*)(&impl) = wglGetProcAddress("wglCreateContextAttribsARB"); HGLRC ret = NULL; if( impl ) { @@ -216,9 +218,8 @@ BOOL WINAPI wglarb_ChoosePixelFormatARB( return FALSE; } - PFNWGLCHOOSEPIXELFORMATARBPROC impl = - (PFNWGLCHOOSEPIXELFORMATARBPROC) wglGetProcAddress( - "wglChoosePixelFormatARB"); + PFNWGLCHOOSEPIXELFORMATARBPROC impl; + *(PROC*)(&impl) = wglGetProcAddress("wglChoosePixelFormatARB"); BOOL ret = FALSE; if( impl ) { |