wine/dlls/d3d9 query.c

Alexandre Julliard julliard at wine.codeweavers.com
Tue Nov 8 06:46:22 CST 2005


ChangeSet ID:	21160
CVSROOT:	/opt/cvs-commit
Module name:	wine
Changes by:	julliard at winehq.org	2005/11/08 06:46:21

Modified files:
	dlls/d3d9      : query.c 

Log message:
	Oliver Stieber <oliver_stieber at yahoo.co.uk>
	Allow NULL ppQuery to be passed to CreateQuery.

Patch: http://cvs.winehq.org/patch.py?id=21160

Old revision  New revision  Changes     Path
 1.11          1.12          +29 -26     wine/dlls/d3d9/query.c

Index: wine/dlls/d3d9/query.c
diff -u -p wine/dlls/d3d9/query.c:1.11 wine/dlls/d3d9/query.c:1.12
--- wine/dlls/d3d9/query.c:1.11	8 Nov 2005 12:46:21 -0000
+++ wine/dlls/d3d9/query.c	8 Nov 2005 12:46:21 -0000
@@ -119,32 +119,35 @@ const IDirect3DQuery9Vtbl Direct3DQuery9
 
 /* IDirect3DDevice9 IDirect3DQuery9 Methods follow: */
 HRESULT WINAPI IDirect3DDevice9Impl_CreateQuery(LPDIRECT3DDEVICE9 iface, D3DQUERYTYPE Type, IDirect3DQuery9** ppQuery) {
-  IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
-  IDirect3DQuery9Impl *object = NULL;
-  HRESULT hr = D3D_OK;
-
-  TRACE("(%p) Relay\n", This);
-
-  /* Allocate the storage for the device */
-  object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirect3DQuery9Impl));
-  if (NULL == object) {
-    FIXME("Allocation of memory failed\n");
-    *ppQuery = NULL;
-    return D3DERR_OUTOFVIDEOMEMORY;
-  }
-  
-  object->lpVtbl = &Direct3DQuery9_Vtbl;
-  object->ref = 1;
-  hr = IWineD3DDevice_CreateQuery(This->WineD3DDevice, Type, &(object->wineD3DQuery), (IUnknown*)object);
-  
-  if (FAILED(hr)) {
-    /* free up object */ 
-    FIXME("(%p) call to IWineD3DDevice_CreateQuery failed\n", This);
-    HeapFree(GetProcessHeap(), 0, object);
-    *ppQuery = NULL;
-  } else {
-    *ppQuery = (LPDIRECT3DQUERY9) object;
-  }
-    TRACE("(%p) : returning %p \n", This, *ppQuery);
-  return hr;
+    IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
+    IDirect3DQuery9Impl *object = NULL;
+    HRESULT hr = D3D_OK;
+
+    TRACE("(%p) Relay\n", This);
+
+    if (!ppQuery)
+        return IWineD3DDevice_CreateQuery(This->WineD3DDevice, Type, NULL, NULL);
+
+    /* Allocate the storage for the device */
+    object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirect3DQuery9Impl));
+    if (NULL == object) {
+        FIXME("Allocation of memory failed\n");
+        *ppQuery = NULL;
+        return D3DERR_OUTOFVIDEOMEMORY;
+    }
+
+    object->lpVtbl = &Direct3DQuery9_Vtbl;
+    object->ref = 1;
+    hr = IWineD3DDevice_CreateQuery(This->WineD3DDevice, Type, &object->wineD3DQuery, (IUnknown *)object);
+
+    if (FAILED(hr)) {
+        /* free up object */
+        FIXME("(%p) call to IWineD3DDevice_CreateQuery failed\n", This);
+        HeapFree(GetProcessHeap(), 0, object);
+        *ppQuery = NULL;
+    } else {
+        *ppQuery = (LPDIRECT3DQUERY9) object;
+    }
+    TRACE("(%p) : returning %lx\n", This, hr);
+    return hr;
 }



More information about the wine-cvs mailing list