From 82d454c95b7f6df2d8b33f0814365c11ee19dd91 Mon Sep 17 00:00:00 2001 From: Magnus Olsen Date: Wed, 13 Dec 2006 21:48:35 +0000 Subject: [PATCH] more cleanup, 1. fixed more tab to space 2. rewrite addref for some inteface. svn path=/trunk/; revision=25149 --- reactos/dll/directx/ddraw/iface_clipper.c | 54 ++++++++----------- reactos/dll/directx/ddraw/iface_color.c | 52 ++++++++---------- reactos/dll/directx/ddraw/iface_gamma.c | 54 ++++++++----------- reactos/dll/directx/ddraw/iface_kernel.c | 48 +++++++---------- reactos/dll/directx/ddraw/iface_palette.c | 45 +++++++--------- reactos/dll/directx/ddraw/iface_videoport.c | 45 +++++++--------- reactos/dll/directx/ddraw/main/surface_main.c | 37 ++++++------- reactos/dll/directx/ddraw/rosdraw.h | 2 + 8 files changed, 140 insertions(+), 197 deletions(-) diff --git a/reactos/dll/directx/ddraw/iface_clipper.c b/reactos/dll/directx/ddraw/iface_clipper.c index 1333d84069a..27633ec175b 100644 --- a/reactos/dll/directx/ddraw/iface_clipper.c +++ b/reactos/dll/directx/ddraw/iface_clipper.c @@ -13,45 +13,35 @@ ULONG WINAPI DirectDrawClipper_Release(LPDIRECTDRAWCLIPPER iface) -{ - +{ LPDDRAWI_DDRAWCLIPPER_INT This = (LPDDRAWI_DDRAWCLIPPER_INT)iface; - ULONG ref=0; - + DX_WINDBG_trace(); - - if (iface!=NULL) - { - ref = InterlockedDecrement( (PLONG) &This->dwIntRefCnt); - - if (ref == 0) - { - /* Add here if we need releae some memory pointer before - * exists - */ - - if (This!=NULL) - { - HeapFree(GetProcessHeap(), 0, This); - } - } - } - return ref; + /* FIXME + This is not right exiame how it should be done + */ + DX_STUB_str("FIXME This is not right exiame how it should be done\n"); + return This->dwIntRefCnt; } ULONG WINAPI DirectDrawClipper_AddRef (LPDIRECTDRAWCLIPPER iface) -{ - LPDDRAWI_DDRAWCLIPPER_INT This = (LPDDRAWI_DDRAWCLIPPER_INT)iface; - ULONG ref=0; +{ + LPDDRAWI_DDRAWCLIPPER_INT This = (LPDDRAWI_DDRAWCLIPPER_INT)iface; - DX_WINDBG_trace(); - - if (iface!=NULL) - { - ref = InterlockedIncrement( (PLONG) &This->dwIntRefCnt); - } - return ref; + DX_WINDBG_trace(); + + if (iface!=NULL) + { + This->dwIntRefCnt++; + This->lpLcl->dwLocalRefCnt++; + + if (This->lpLcl->lpGbl != NULL) + { + This->lpLcl->lpGbl->dwRefCnt++; + } + } + return This->dwIntRefCnt; } HRESULT WINAPI diff --git a/reactos/dll/directx/ddraw/iface_color.c b/reactos/dll/directx/ddraw/iface_color.c index 0c7a8de7d58..cc6c8b72fdc 100644 --- a/reactos/dll/directx/ddraw/iface_color.c +++ b/reactos/dll/directx/ddraw/iface_color.c @@ -13,48 +13,40 @@ ULONG WINAPI DirectDrawColorControl_AddRef( LPDIRECTDRAWCOLORCONTROL iface) { - LPDDRAWI_DDCOLORCONTROL_INT This = (LPDDRAWI_DDCOLORCONTROL_INT)iface; - ULONG ref=0; + LPDDRAWI_DDCOLORCONTROL_INT This = (LPDDRAWI_DDCOLORCONTROL_INT)iface; DX_WINDBG_trace(); - - if (iface!=NULL) - { - ref = InterlockedIncrement( (PLONG) &This->dwIntRefCnt); - } - return ref; + + if (iface!=NULL) + { + This->dwIntRefCnt++; + // This->lpLcl->dwLocalRefCnt++; + + + //if (This->lpLcl->lpGbl != NULL) + //{ + // This->lpLcl->lpGbl->dwRefCnt++; + //} + } + return This->dwIntRefCnt; } ULONG WINAPI DirectDrawColorControl_Release( LPDIRECTDRAWCOLORCONTROL iface) -{ +{ LPDDRAWI_DDCOLORCONTROL_INT This = (LPDDRAWI_DDCOLORCONTROL_INT)iface; - ULONG ref=0; - DX_WINDBG_trace(); - - if (iface!=NULL) - { - ref = InterlockedDecrement( (PLONG) &This->dwIntRefCnt); - - if (ref == 0) - { - /* Add here if we need releae some memory pointer before - * exists - */ - - if (This!=NULL) - { - HeapFree(GetProcessHeap(), 0, This); - } - } - } - return ref; + DX_WINDBG_trace(); + /* FIXME + This is not right exiame how it should be done + */ + DX_STUB_str("FIXME This is not right exiame how it should be done\n"); + return This->dwIntRefCnt; } HRESULT WINAPI DirectDrawColorControl_QueryInterface( LPDIRECTDRAWCOLORCONTROL iface, - REFIID riid, + REFIID riid, LPVOID* ppvObj) { DX_WINDBG_trace(); diff --git a/reactos/dll/directx/ddraw/iface_gamma.c b/reactos/dll/directx/ddraw/iface_gamma.c index eb597d0bb94..9df0c2a1bda 100644 --- a/reactos/dll/directx/ddraw/iface_gamma.c +++ b/reactos/dll/directx/ddraw/iface_gamma.c @@ -15,53 +15,41 @@ DirectDrawGammaControl_AddRef( LPDIRECTDRAWGAMMACONTROL iface) { LPDDRAWI_DDGAMMACONTROL_INT This = (LPDDRAWI_DDGAMMACONTROL_INT)iface; - ULONG ref=0; - DX_WINDBG_trace(); - - if (iface!=NULL) - { - This->dwIntRefCnt++; - ref = This->dwIntRefCnt; - } - return ref; + DX_WINDBG_trace(); + + if (iface!=NULL) + { + This->dwIntRefCnt++; + //This->lpLcl->dwLocalRefCnt++; + + //if (This->lpLcl->lpGbl != NULL) + //{ + // This->lpLcl->lpGbl->dwRefCnt++; + //} + } + return This->dwIntRefCnt; } ULONG WINAPI DirectDrawGammaControl_Release( LPDIRECTDRAWGAMMACONTROL iface) { LPDDRAWI_DDGAMMACONTROL_INT This = (LPDDRAWI_DDGAMMACONTROL_INT)iface; - ULONG ref=0; - DX_WINDBG_trace(); - - if (iface!=NULL) - { - This->dwIntRefCnt--; - - if (This->dwIntRefCnt == 0) - { - /* Add here if we need releae some memory pointer before - * exists - */ - - if (This!=NULL) - { - HeapFree(GetProcessHeap(), 0, This); - } - } - - ref = This->dwIntRefCnt; - } - return ref; + DX_WINDBG_trace(); + /* FIXME + This is not right exiame how it should be done + */ + DX_STUB_str("FIXME This is not right exiame how it should be done\n"); + return This->dwIntRefCnt; } HRESULT WINAPI DirectDrawGammaControl_QueryInterface( LPDIRECTDRAWGAMMACONTROL iface, REFIID riid, - LPVOID *ppObj) + LPVOID *ppObj) { DX_WINDBG_trace(); - DX_STUB; + DX_STUB; } HRESULT WINAPI diff --git a/reactos/dll/directx/ddraw/iface_kernel.c b/reactos/dll/directx/ddraw/iface_kernel.c index cc0c37d3db4..0a075e7ebc0 100644 --- a/reactos/dll/directx/ddraw/iface_kernel.c +++ b/reactos/dll/directx/ddraw/iface_kernel.c @@ -89,44 +89,32 @@ DDSurfaceKernel_AddRef ( LPDIRECTDRAWSURFACEKERNEL iface) { LPDDRAWI_DDKERNELSURFACE_INT This = (LPDDRAWI_DDKERNELSURFACE_INT)iface; - ULONG ref=0; DX_WINDBG_trace(); - - if (iface!=NULL) - { - This->dwIntRefCnt++; - ref = This->dwIntRefCnt; - } - return ref; + + if (iface!=NULL) + { + This->dwIntRefCnt++; + //This->lpLcl->dwLocalRefCnt++; + + //if (This->lpLcl->lpGbl != NULL) + //{ + // This->lpLcl->lpGbl->dwRefCnt++; + //} + } + return This->dwIntRefCnt; } ULONG WINAPI DDSurfaceKernel_Release ( LPDIRECTDRAWSURFACEKERNEL iface) { LPDDRAWI_DDKERNELSURFACE_INT This = (LPDDRAWI_DDKERNELSURFACE_INT)iface; - ULONG ref=0; - DX_WINDBG_trace(); - - if (iface!=NULL) - { - This->dwIntRefCnt--; - - if (This->dwIntRefCnt == 0) - { - /* Add here if we need releae some memory pointer before - * exists - */ - - if (This!=NULL) - { - HeapFree(GetProcessHeap(), 0, This); - } - } - - ref = This->dwIntRefCnt; - } - return ref; + DX_WINDBG_trace(); + /* FIXME + This is not right exiame how it should be done + */ + DX_STUB_str("FIXME This is not right exiame how it should be done\n"); + return This->dwIntRefCnt; } HRESULT WINAPI diff --git a/reactos/dll/directx/ddraw/iface_palette.c b/reactos/dll/directx/ddraw/iface_palette.c index a5494566a94..dd8ebbe3faa 100644 --- a/reactos/dll/directx/ddraw/iface_palette.c +++ b/reactos/dll/directx/ddraw/iface_palette.c @@ -14,42 +14,33 @@ ULONG WINAPI DirectDrawPalette_Release( LPDIRECTDRAWPALETTE iface) { LPDDRAWI_DDRAWPALETTE_INT This = (LPDDRAWI_DDRAWPALETTE_INT)iface; - ULONG ref=0; - DX_WINDBG_trace(); - - if (iface!=NULL) - { - ref = InterlockedDecrement( (PLONG) &This->dwIntRefCnt); - - if (ref == 0) - { - /* Add here if we need releae some memory pointer before - * exists - */ - - if (This!=NULL) - { - DxHeapMemFree(This); - } - } - } - return ref; + DX_WINDBG_trace(); + /* FIXME + This is not right exiame how it should be done + */ + DX_STUB_str("FIXME This is not right exiame how it should be done\n"); + return This->dwIntRefCnt; } ULONG WINAPI DirectDrawPalette_AddRef( LPDIRECTDRAWPALETTE iface) { LPDDRAWI_DDRAWPALETTE_INT This = (LPDDRAWI_DDRAWPALETTE_INT)iface; - ULONG ref=0; DX_WINDBG_trace(); - - if (iface!=NULL) - { - ref = InterlockedIncrement( (PLONG) &This->dwIntRefCnt); - } - return ref; + + if (iface!=NULL) + { + This->dwIntRefCnt++; + This->lpLcl->dwLocalRefCnt++; + + if (This->lpLcl->lpGbl != NULL) + { + This->lpLcl->lpGbl->dwRefCnt++; + } + } + return This->dwIntRefCnt; } HRESULT WINAPI diff --git a/reactos/dll/directx/ddraw/iface_videoport.c b/reactos/dll/directx/ddraw/iface_videoport.c index 3ead1687c39..e0d07ab430b 100644 --- a/reactos/dll/directx/ddraw/iface_videoport.c +++ b/reactos/dll/directx/ddraw/iface_videoport.c @@ -25,42 +25,33 @@ ULONG WINAPI Main_DirectDrawVideoPort_AddRef (LPDIRECTDRAWVIDEOPORT iface) { LPDDRAWI_DDVIDEOPORT_INT This = (LPDDRAWI_DDVIDEOPORT_INT)iface; - ULONG ref=0; DX_WINDBG_trace(); - - if (iface!=NULL) - { - ref = InterlockedIncrement( (PLONG) &This->dwIntRefCnt); - } - return ref; + + if (iface!=NULL) + { + This->dwIntRefCnt++; + //This->lpLcl->dwLocalRefCnt++; + + //if (This->lpLcl->lpGbl != NULL) + //{ + // This->lpLcl->lpGbl->dwRefCnt++; + //} + } + return This->dwIntRefCnt; } ULONG WINAPI Main_DirectDrawVideoPort_Release (LPDIRECTDRAWVIDEOPORT iface) { LPDDRAWI_DDVIDEOPORT_INT This = (LPDDRAWI_DDVIDEOPORT_INT)iface; - ULONG ref=0; - DX_WINDBG_trace(); - - if (iface!=NULL) - { - ref = InterlockedDecrement( (PLONG) &This->dwIntRefCnt); - - if (ref == 0) - { - /* Add here if we need releae some memory pointer before - * exists - */ - - if (This!=NULL) - { - DxHeapMemFree(This); - } - } - } - return ref; + DX_WINDBG_trace(); + /* FIXME + This is not right exiame how it should be done + */ + DX_STUB_str("FIXME This is not right exiame how it should be done\n"); + return This->dwIntRefCnt; } HRESULT WINAPI diff --git a/reactos/dll/directx/ddraw/main/surface_main.c b/reactos/dll/directx/ddraw/main/surface_main.c index a5cfa7f8691..a62760899c0 100644 --- a/reactos/dll/directx/ddraw/main/surface_main.c +++ b/reactos/dll/directx/ddraw/main/surface_main.c @@ -22,37 +22,38 @@ HRESULT WINAPI Main_DDrawSurface_Initialize (LPDIRECTDRAWSURFACE7 iface, LPDIRECTDRAW pDD, LPDDSURFACEDESC2 pDDSD2) -{ - return DDERR_ALREADYINITIALIZED; +{ + return DDERR_ALREADYINITIALIZED; } ULONG WINAPI Main_DDrawSurface_AddRef(LPDIRECTDRAWSURFACE7 iface) { - LPDDRAWI_DDRAWSURFACE_INT This = (LPDDRAWI_DDRAWSURFACE_INT)iface; + LPDDRAWI_DDRAWSURFACE_INT This = (LPDDRAWI_DDRAWSURFACE_INT)iface; - DX_WINDBG_trace(); - - if (iface!=NULL) - { - This->dwIntRefCnt++; - This->lpLcl->dwLocalRefCnt++; - - if (This->lpLcl->lpGbl != NULL) - { - This->lpLcl->lpGbl->dwRefCnt++; - } - } + DX_WINDBG_trace(); + + if (iface!=NULL) + { + This->dwIntRefCnt++; + This->lpLcl->dwLocalRefCnt++; + + if (This->lpLcl->lpGbl != NULL) + { + This->lpLcl->lpGbl->dwRefCnt++; + } + } return This->dwIntRefCnt; } + ULONG WINAPI Main_DDrawSurface_Release(LPDIRECTDRAWSURFACE7 iface) { LPDDRAWI_DDRAWSURFACE_INT This = (LPDDRAWI_DDRAWSURFACE_INT)iface; - /* FIXME - This is not right exiame how it should be done + /* FIXME + This is not right exiame how it should be done */ - DX_STUB_str("FIXME This is not right exiame how it should be done\n"); + DX_STUB_str("FIXME This is not right exiame how it should be done\n"); return This->dwIntRefCnt; } diff --git a/reactos/dll/directx/ddraw/rosdraw.h b/reactos/dll/directx/ddraw/rosdraw.h index a35ac53d064..a04db4ae979 100644 --- a/reactos/dll/directx/ddraw/rosdraw.h +++ b/reactos/dll/directx/ddraw/rosdraw.h @@ -650,6 +650,8 @@ DWORD CALLBACK HelDdSurfUpdateOverlay(LPDDHAL_UPDATEOVERLAYDATA lpUpDateOveryLay } \ return DDERR_UNSUPPORTED; + + #define DX_STUB_DD_OK \ { \ static BOOL firstcall = TRUE; \