DXGL r345 - Code Review

Jump to navigation Jump to search
Repository:DXGL
Revision:r344‎ | r345 | r346 >
Date:20:50, 10 March 2013
Author:admin
Status:new
Tags:
Comment:
Fix glDirectDraw7::QueryInterface tracing.
Trace glDirectDrawClipper.cpp and fix invalid object return values.
Modified paths:
  • /ddraw/glDirectDraw.cpp (modified) (history)
  • /ddraw/glDirectDrawClipper.cpp (modified) (history)

Diff [purge]

Index: ddraw/glDirectDraw.cpp
@@ -612,7 +612,7 @@
613613
614614 HRESULT WINAPI glDirectDraw7::QueryInterface(REFIID riid, void** ppvObj)
615615 {
616 - TRACE_ENTER(3,this,24,riid,14,ppvObj);
 616+ TRACE_ENTER(3,14,this,24,&riid,14,ppvObj);
617617 if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
618618 if(!ppvObj) TRACE_RET(23,DDERR_INVALIDPARAMS);
619619 if(riid == IID_IUnknown)
Index: ddraw/glDirectDrawClipper.cpp
@@ -21,28 +21,37 @@
2222
2323 glDirectDrawClipper::glDirectDrawClipper()
2424 {
 25+ TRACE_ENTER(1,14,this);
2526 initialized = false;
2627 refcount = 1;
 28+ TRACE_EXIT(-1,0);
2729 }
2830
2931 glDirectDrawClipper::glDirectDrawClipper(DWORD dwFlags, glDirectDraw7 *parent)
3032 {
 33+ TRACE_ENTER(3,14,this,9,dwFlags,14,parent);
3134 initialized = false;
3235 refcount = 1;
3336 Initialize((LPDIRECTDRAW)parent,dwFlags);
 37+ TRACE_EXIT(-1,0);
3438 }
3539 glDirectDrawClipper::~glDirectDrawClipper()
3640 {
 41+ TRACE_ENTER(1,14,this);
3742 if(glDD7) glDD7->DeleteClipper(this);
 43+ TRACE_EXIT(-1,0);
3844 }
3945 HRESULT WINAPI glDirectDrawClipper::QueryInterface(REFIID riid, LPVOID* obp)
4046 {
41 - if(!this) return DDERR_INVALIDPARAMS;
42 - if(!obp) return DDERR_INVALIDPARAMS;
 47+ TRACE_ENTER(3,14,this,24,&riid,14,obp);
 48+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
 49+ if(!obp) TRACE_RET(23,DDERR_INVALIDPARAMS);
4350 if(riid == IID_IUnknown)
4451 {
4552 this->AddRef();
4653 *obp = this;
 54+ TRACE_VAR("*obp",14,*obp);
 55+ TRACE_EXIT(23,DD_OK);
4756 return DD_OK;
4857 }
4958 if(riid == IID_IDirectDrawClipper)
@@ -49,42 +58,55 @@
5059 {
5160 *obp = this;
5261 this->AddRef();
53 - return S_OK;
 62+ TRACE_VAR("*obp",14,*obp);
 63+ TRACE_EXIT(23,DD_OK);
 64+ return DD_OK;
5465 }
 66+ TRACE_EXIT(23,E_NOINTERFACE);
5567 return E_NOINTERFACE;
5668 }
5769 ULONG WINAPI glDirectDrawClipper::AddRef()
5870 {
59 - if(!this) return 0;
 71+ TRACE_ENTER(1,14,this);
 72+ if(!this) TRACE_RET(8,0);
6073 refcount++;
 74+ TRACE_EXIT(8,refcount);
6175 return refcount;
6276 }
6377 ULONG WINAPI glDirectDrawClipper::Release()
6478 {
65 - if(!this) return 0;
 79+ TRACE_ENTER(1,14,this);
 80+ if(!this) TRACE_RET(8,0);
6681 ULONG ret;
6782 refcount--;
6883 ret = refcount;
6984 if(refcount == 0) delete this;
 85+ TRACE_EXIT(8,ret);
7086 return ret;
7187 }
7288 HRESULT WINAPI glDirectDrawClipper::GetClipList(LPRECT lpRect, LPRGNDATA lpClipList, LPDWORD lpdwSize)
7389 {
74 - if(!this) return DDERR_INVALIDPARAMS;
 90+ TRACE_ENTER(4,14,this,26,lpRect,14,lpClipList,14,lpdwSize);
 91+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
7592 FIXME("IDirectDrawClipper::GetClipList: stub");
 93+ TRACE_EXIT(23,DDERR_GENERIC);
7694 ERR(DDERR_GENERIC);
7795 }
7896 HRESULT WINAPI glDirectDrawClipper::GetHWnd(HWND FAR *lphWnd)
7997 {
80 - if(!this) return DDERR_INVALIDPARAMS;
 98+ TRACE_ENTER(2,14,this,14,lphWnd);
 99+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
 100+ if(!hWnd) TRACE_RET(23,DDERR_NOHWND);
81101 *lphWnd = hWnd;
82 - if(!hWnd) return DDERR_INVALIDOBJECT;
 102+ TRACE_VAR("*lphWnd",13,*lphWnd);
 103+ TRACE_EXIT(23,DD_OK);
83104 return DD_OK;
84105 }
85106 HRESULT WINAPI glDirectDrawClipper::Initialize(LPDIRECTDRAW lpDD, DWORD dwFlags)
86107 {
87 - if(!this) return DDERR_INVALIDPARAMS;
88 - if(initialized) return DDERR_ALREADYINITIALIZED;
 108+ TRACE_ENTER(3,14,this,14,lpDD,9,dwFlags);
 109+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
 110+ if(initialized) TRACE_RET(23,DDERR_ALREADYINITIALIZED);
89111 glDD7 = (glDirectDraw7*)lpDD;
90112 if(glDD7) hasparent = true;
91113 else hasparent = false;
@@ -91,23 +113,30 @@
92114 hWnd = NULL;
93115 refcount = 1;
94116 initialized = true;
 117+ TRACE_EXIT(23,DD_OK);
95118 return DD_OK;
96119 }
97120 HRESULT WINAPI glDirectDrawClipper::IsClipListChanged(BOOL FAR *lpbChanged)
98121 {
99 - if(!this) return DDERR_INVALIDPARAMS;
 122+ TRACE_ENTER(2,14,this,14,lpbChanged);
 123+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
100124 FIXME("IDirectDrawClipper::IsClipListChanged: stub");
 125+ TRACE_EXIT(23,DDERR_GENERIC);
101126 ERR(DDERR_GENERIC);
102127 }
103128 HRESULT WINAPI glDirectDrawClipper::SetClipList(LPRGNDATA lpClipList, DWORD dwFlags)
104129 {
105 - if(!this) return DDERR_INVALIDPARAMS;
 130+ TRACE_ENTER(3,14,this,14,lpClipList,9,dwFlags);
 131+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
106132 FIXME("IDirectDrawClipper::SetClipList: stub");
 133+ TRACE_EXIT(23,DDERR_GENERIC);
107134 ERR(DDERR_GENERIC);
108135 }
109136 HRESULT WINAPI glDirectDrawClipper::SetHWnd(DWORD dwFlags, HWND hWnd)
110137 {
111 - if(!this) return DDERR_INVALIDPARAMS;
 138+ TRACE_ENTER(3,14,this,9,dwFlags,13,hWnd);
 139+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
112140 this->hWnd = hWnd;
 141+ TRACE_EXIT(23,DD_OK);
113142 return DD_OK;
114143 }