Callback declarations - part 1

Francois Gouget fgouget at free.fr
Mon Feb 5 22:32:58 CST 2001


   I noticed that a number of callback declarations have are of the form 

typedef HRESULT (CALLBACK* DLLGETVERSIONPROC)(DLLVERSIONINFO *);

   instead of 

typedef HRESULT CALLBACK (*DLLGETVERSIONPROC)(DLLVERSIONINFO *);


   Since we often had trouble with the first type of declaration
(especially with g++), I decided to change these to the second
form. This patch comes in two parts: the first one changes only the
headers (which maight be included by C++ programs) and the second one
changes Wine's private declarations (where trouble is less likely).

   Here's the changelog for part 1.

Changelog:

 * include/process.h,
   include/vfw.h,
   include/winbase.h,
   include/winsvc.h,
   include/setupapi.h,
   include/shlwapi.h,
   include/winsock2.h,
   include/wine/undocshell.h

   Change the callback declarations to a safer format


--
Francois Gouget         fgouget at free.fr        http://fgouget.free.fr/
 Advice is what we ask for when we already know the answer but wish we didn't
                                 -- Eric Jong
-------------- next part --------------
Index: include/process.h
===================================================================
RCS file: /home/cvs/wine/wine/include/process.h,v
retrieving revision 1.55
diff -u -r1.55 process.h
--- include/process.h	2000/12/11 03:48:15	1.55
+++ include/process.h	2001/01/23 19:15:48
@@ -8,7 +8,7 @@
 #define _INC_PROCESS
 
 typedef void (*LPBEGINTHREAD)(LPVOID);
-typedef UINT (WINAPI *LPBEGINTHREADEX)(LPVOID);
+typedef UINT WINAPI (*LPBEGINTHREADEX)(LPVOID);
 
 ULONG _beginthread(LPBEGINTHREAD,UINT,LPVOID);
 void  _endthread(void);
Index: include/vfw.h
===================================================================
RCS file: /home/cvs/wine/wine/include/vfw.h,v
retrieving revision 1.21
diff -u -r1.21 vfw.h
--- include/vfw.h	2000/12/26 00:07:25	1.21
+++ include/vfw.h	2001/01/29 11:01:33
@@ -680,7 +680,7 @@
     ICSendMessage(hic, ICM_DRAW_RENDERBUFFER, 0, 0)
 
 inline static LRESULT VFWAPI ICSetStatusProc(HIC hic, DWORD dwFlags, LRESULT lParam,
-					     LONG (CALLBACK *fpfnStatus)(LPARAM, UINT, LONG))
+					     LONG CALLBACK (*fpfnStatus)(LPARAM, UINT, LONG))
 {
     ICSETSTATUSPROC ic;
 
Index: include/winbase.h
===================================================================
RCS file: /home/cvs/wine/wine/include/winbase.h,v
retrieving revision 1.103
diff -u -r1.103 winbase.h
--- include/winbase.h	2001/01/21 21:09:22	1.103
+++ include/winbase.h	2001/01/23 19:15:50
@@ -23,7 +23,7 @@
 
 typedef DWORD CALLBACK (*LPTHREAD_START_ROUTINE)(LPVOID);
 
-typedef VOID (WINAPI *PFIBER_START_ROUTINE)( LPVOID lpFiberParameter );
+typedef VOID WINAPI (*PFIBER_START_ROUTINE)( LPVOID lpFiberParameter );
 typedef PFIBER_START_ROUTINE LPFIBER_START_ROUTINE;
 
 typedef RTL_CRITICAL_SECTION CRITICAL_SECTION;
Index: include/winsvc.h
===================================================================
RCS file: /home/cvs/wine/wine/include/winsvc.h,v
retrieving revision 1.6
diff -u -r1.6 winsvc.h
--- include/winsvc.h	2001/01/02 20:17:15	1.6
+++ include/winsvc.h	2001/01/23 19:15:50
@@ -136,7 +136,7 @@
 
 /* Service control handler function prototype */
 
-typedef VOID (WINAPI *LPHANDLER_FUNCTION)(DWORD);
+typedef VOID WINAPI (*LPHANDLER_FUNCTION)(DWORD);
 
 /* API function prototypes */
 
Index: include/setupapi.h
===================================================================
RCS file: /home/cvs/wine/wine/include/setupapi.h,v
retrieving revision 1.2
diff -u -r1.2 setupapi.h
--- include/setupapi.h	2001/01/17 20:17:46	1.2
+++ include/setupapi.h	2001/01/29 11:01:27
@@ -26,9 +26,9 @@
    UINT  Line;
 } INFCONTEXT, *PINFCONTEXT;
 
-typedef UINT (CALLBACK* PSP_FILE_CALLBACK_A)( PVOID Context, UINT Notification,
+typedef UINT CALLBACK (*PSP_FILE_CALLBACK_A)( PVOID Context, UINT Notification,
                                               UINT Param1, UINT Param2 );
-typedef UINT (CALLBACK* PSP_FILE_CALLBACK_W)( PVOID Context, UINT Notification,
+typedef UINT CALLBACK (*PSP_FILE_CALLBACK_W)( PVOID Context, UINT Notification,
                                               UINT Param1, UINT Param2 );
 #define PSP_FILE_CALLBACK WINELIB_NAME_AW(PSP_FILE_CALLBACK_)
 
Index: include/shlwapi.h
===================================================================
RCS file: /home/cvs/wine/wine/include/shlwapi.h,v
retrieving revision 1.12
diff -u -r1.12 shlwapi.h
--- include/shlwapi.h	2001/01/07 21:50:54	1.12
+++ include/shlwapi.h	2001/01/29 11:01:28
@@ -237,7 +237,7 @@
 #define DLLVER_PLATFORM_WINDOWS         0x00000001      // Windows 9x
 #define DLLVER_PLATFORM_NT              0x00000002      // Windows NT
 
-typedef HRESULT (CALLBACK* DLLGETVERSIONPROC)(DLLVERSIONINFO *);
+typedef HRESULT CALLBACK (*DLLGETVERSIONPROC)(DLLVERSIONINFO *);
 
 #ifdef __cplusplus
 } /* extern "C" */
Index: include/winsock2.h
===================================================================
RCS file: /home/cvs/wine/wine/include/winsock2.h,v
retrieving revision 1.6
diff -u -r1.6 winsock2.h
--- include/winsock2.h	2000/12/02 23:46:10	1.6
+++ include/winsock2.h	2001/01/29 11:01:34
@@ -196,8 +196,7 @@
 typedef HANDLE WSAEVENT;
 typedef unsigned int   GROUP;
 
-typedef void 
-(CALLBACK * LPWSAOVERLAPPED_COMPLETION_ROUTINE)
+typedef void CALLBACK (*LPWSAOVERLAPPED_COMPLETION_ROUTINE)
 (
      DWORD dwError,
      DWORD cbTransferred,
Index: include/wine/undocshell.h
===================================================================
RCS file: /home/cvs/wine/wine/include/wine/undocshell.h,v
retrieving revision 1.14
diff -u -r1.14 undocshell.h
--- include/wine/undocshell.h	2001/01/07 21:50:54	1.14
+++ include/wine/undocshell.h	2001/01/29 11:01:36
@@ -641,7 +641,7 @@
  */
 
 /* SHCreateShellFolderViewEx callback function */
-typedef HRESULT (CALLBACK* LPFNSFVCALLBACK)(
+typedef HRESULT CALLBACK (*LPFNSFVCALLBACK)(
 	DWORD dwUser,
 	LPSHELLFOLDER pshf,
 	HWND hWnd,


More information about the wine-patches mailing list