DXGL r160 - Code Review

Jump to navigation Jump to search
Repository:DXGL
Revision:r159‎ | r160 | r161 >
Date:17:53, 4 June 2012
Author:admin
Status:new
Tags:
Comment:
Add IUnknownIID to all QueryInterface functions for COM compliance.
Modified paths:
  • /ddraw/glDirect3D.cpp (modified) (history)
  • /ddraw/glDirect3DDevice.cpp (modified) (history)
  • /ddraw/glDirect3DLight.cpp (modified) (history)
  • /ddraw/glDirectDraw.cpp (modified) (history)
  • /ddraw/glDirectDrawClipper.cpp (modified) (history)
  • /ddraw/glDirectDrawPalette.cpp (modified) (history)
  • /ddraw/glDirectDrawSurface.cpp (modified) (history)

Diff [purge]

Index: ddraw/glDirect3D.cpp
@@ -147,6 +147,12 @@
148148 {
149149 if(!this) return DDERR_INVALIDPARAMS;
150150 if(!ppvObj) return DDERR_INVALIDPARAMS;
 151+ if(riid == IID_IUnknown)
 152+ {
 153+ this->AddRef();
 154+ *ppvObj = this;
 155+ return D3D_OK;
 156+ }
151157 FIXME("glDirect3D7::QueryInterface: stub");
152158 return E_NOINTERFACE;
153159 }
Index: ddraw/glDirect3DDevice.cpp
@@ -263,6 +263,12 @@
264264 {
265265 if(!this) return DDERR_INVALIDPARAMS;
266266 if(!ppvObj) return DDERR_INVALIDPARAMS;
 267+ if(riid == IID_IUnknown)
 268+ {
 269+ this->AddRef();
 270+ *ppvObj = this;
 271+ return D3D_OK;
 272+ }
267273 ERR(E_NOINTERFACE);
268274 }
269275
Index: ddraw/glDirect3DLight.cpp
@@ -66,6 +66,12 @@
6767 {
6868 if(!this) return DDERR_INVALIDPARAMS;
6969 if(!ppvObj) return DDERR_INVALIDPARAMS;
 70+ if(riid == IID_IUnknown)
 71+ {
 72+ this->AddRef();
 73+ *ppvObj = this;
 74+ return D3D_OK;
 75+ }
7076 return E_NOINTERFACE;
7177 }
7278
Index: ddraw/glDirectDraw.cpp
@@ -602,6 +602,12 @@
603603 {
604604 if(!this) return DDERR_INVALIDPARAMS;
605605 if(!ppvObj) return DDERR_INVALIDPARAMS;
 606+ if(riid == IID_IUnknown)
 607+ {
 608+ this->AddRef();
 609+ *ppvObj = this;
 610+ return DD_OK;
 611+ }
606612 if(riid == IID_IDirectDraw)
607613 {
608614 // Create an IDirectDraw1 interface
@@ -1426,6 +1432,12 @@
14271433 HRESULT WINAPI glDirectDraw1::QueryInterface(REFIID riid, void** ppvObj)
14281434 {
14291435 if(!this) return DDERR_INVALIDPARAMS;
 1436+ if(riid == IID_IUnknown)
 1437+ {
 1438+ this->AddRef();
 1439+ *ppvObj = this;
 1440+ return DD_OK;
 1441+ }
14301442 return glDD7->QueryInterface(riid,ppvObj);
14311443 }
14321444 ULONG WINAPI glDirectDraw1::AddRef()
@@ -1568,6 +1580,12 @@
15691581 HRESULT WINAPI glDirectDraw2::QueryInterface(REFIID riid, void** ppvObj)
15701582 {
15711583 if(!this) return DDERR_INVALIDPARAMS;
 1584+ if(riid == IID_IUnknown)
 1585+ {
 1586+ this->AddRef();
 1587+ *ppvObj = this;
 1588+ return DD_OK;
 1589+ }
15721590 return glDD7->QueryInterface(riid,ppvObj);
15731591 }
15741592 ULONG WINAPI glDirectDraw2::AddRef()
@@ -1720,6 +1738,12 @@
17211739 HRESULT WINAPI glDirectDraw4::QueryInterface(REFIID riid, void** ppvObj)
17221740 {
17231741 if(!this) return DDERR_INVALIDPARAMS;
 1742+ if(riid == IID_IUnknown)
 1743+ {
 1744+ this->AddRef();
 1745+ *ppvObj = this;
 1746+ return DD_OK;
 1747+ }
17241748 return glDD7->QueryInterface(riid,ppvObj);
17251749 }
17261750 ULONG WINAPI glDirectDraw4::AddRef()
Index: ddraw/glDirectDrawClipper.cpp
@@ -1,5 +1,5 @@
22 // DXGL
3 -// Copyright (C) 2011 William Feely
 3+// Copyright (C) 2011-2012 William Feely
44
55 // This library is free software; you can redistribute it and/or
66 // modify it under the terms of the GNU Lesser General Public
@@ -39,6 +39,12 @@
4040 {
4141 if(!this) return DDERR_INVALIDPARAMS;
4242 if(!obp) return DDERR_INVALIDPARAMS;
 43+ if(riid == IID_IUnknown)
 44+ {
 45+ this->AddRef();
 46+ *obp = this;
 47+ return DD_OK;
 48+ }
4349 if(riid == IID_IDirectDrawClipper)
4450 {
4551 *obp = this;
Index: ddraw/glDirectDrawPalette.cpp
@@ -1,5 +1,5 @@
22 // DXGL
3 -// Copyright (C) 2011 William Feely
 3+// Copyright (C) 2011-2012 William Feely
44
55 // This library is free software; you can redistribute it and/or
66 // modify it under the terms of the GNU Lesser General Public
@@ -117,6 +117,12 @@
118118 {
119119 if(!this) return DDERR_INVALIDPARAMS;
120120 if(!ppvObj) return DDERR_INVALIDPARAMS;
 121+ if(riid == IID_IUnknown)
 122+ {
 123+ this->AddRef();
 124+ *ppvObj = this;
 125+ return DD_OK;
 126+ }
121127 ERR(E_NOINTERFACE);
122128 }
123129
Index: ddraw/glDirectDrawSurface.cpp
@@ -444,6 +444,12 @@
445445 {
446446 if(!this) return DDERR_INVALIDPARAMS;
447447 if(!ppvObj) return DDERR_INVALIDPARAMS;
 448+ if(riid == IID_IUnknown)
 449+ {
 450+ this->AddRef();
 451+ *ppvObj = this;
 452+ return DD_OK;
 453+ }
448454 if(riid == IID_IDirectDrawSurface7)
449455 {
450456 this->AddRef();
@@ -1247,6 +1253,12 @@
12481254 HRESULT WINAPI glDirectDrawSurface1::QueryInterface(REFIID riid, void** ppvObj)
12491255 {
12501256 if(!this) return DDERR_INVALIDPARAMS;
 1257+ if(riid == IID_IUnknown)
 1258+ {
 1259+ this->AddRef();
 1260+ *ppvObj = this;
 1261+ return DD_OK;
 1262+ }
12511263 return glDDS7->QueryInterface(riid,ppvObj);
12521264 }
12531265 ULONG WINAPI glDirectDrawSurface1::AddRef()
@@ -1467,6 +1479,12 @@
14681480 HRESULT WINAPI glDirectDrawSurface2::QueryInterface(REFIID riid, void** ppvObj)
14691481 {
14701482 if(!this) return DDERR_INVALIDPARAMS;
 1483+ if(riid == IID_IUnknown)
 1484+ {
 1485+ this->AddRef();
 1486+ *ppvObj = this;
 1487+ return DD_OK;
 1488+ }
14711489 return glDDS7->QueryInterface(riid,ppvObj);
14721490 }
14731491 ULONG WINAPI glDirectDrawSurface2::AddRef()
@@ -1701,6 +1719,12 @@
17021720 HRESULT WINAPI glDirectDrawSurface3::QueryInterface(REFIID riid, void** ppvObj)
17031721 {
17041722 if(!this) return DDERR_INVALIDPARAMS;
 1723+ if(riid == IID_IUnknown)
 1724+ {
 1725+ this->AddRef();
 1726+ *ppvObj = this;
 1727+ return DD_OK;
 1728+ }
17051729 return glDDS7->QueryInterface(riid,ppvObj);
17061730 }
17071731 ULONG WINAPI glDirectDrawSurface3::AddRef()
@@ -1940,6 +1964,12 @@
19411965 HRESULT WINAPI glDirectDrawSurface4::QueryInterface(REFIID riid, void** ppvObj)
19421966 {
19431967 if(!this) return DDERR_INVALIDPARAMS;
 1968+ if(riid == IID_IUnknown)
 1969+ {
 1970+ this->AddRef();
 1971+ *ppvObj = this;
 1972+ return DD_OK;
 1973+ }
19441974 return glDDS7->QueryInterface(riid,ppvObj);
19451975 }
19461976 ULONG WINAPI glDirectDrawSurface4::AddRef()