[PATCH 2/2] ddraw: Cleanup ddraw7_GetAvailableVidMem().

Józef Kucia jkucia at codeweavers.com
Mon Jan 2 03:44:39 CST 2017


Signed-off-by: Józef Kucia <jkucia at codeweavers.com>
---

This can be deferred or dropped entirely.

---
 dlls/ddraw/ddraw.c | 17 +++++++----------
 1 file changed, 7 insertions(+), 10 deletions(-)

diff --git a/dlls/ddraw/ddraw.c b/dlls/ddraw/ddraw.c
index 6afa6dd..6d88e4a 100644
--- a/dlls/ddraw/ddraw.c
+++ b/dlls/ddraw/ddraw.c
@@ -1883,7 +1883,7 @@ static HRESULT WINAPI ddraw1_GetVerticalBlankStatus(IDirectDraw *iface, BOOL *st
  * Returns the total and free video memory
  *
  * Params:
- *  Caps: Specifies the memory type asked for
+ *  caps: Specifies the memory type asked for
  *  total: Pointer to a DWORD to be filled with the total memory
  *  free: Pointer to a DWORD to be filled with the free memory
  *
@@ -1892,7 +1892,7 @@ static HRESULT WINAPI ddraw1_GetVerticalBlankStatus(IDirectDraw *iface, BOOL *st
  *  DDERR_INVALIDPARAMS if free and total are NULL
  *
  *****************************************************************************/
-static HRESULT WINAPI ddraw7_GetAvailableVidMem(IDirectDraw7 *iface, DDSCAPS2 *Caps, DWORD *total,
+static HRESULT WINAPI ddraw7_GetAvailableVidMem(IDirectDraw7 *iface, DDSCAPS2 *caps, DWORD *total,
         DWORD *free)
 {
     unsigned int framebuffer_size, total_vidmem, free_vidmem;
@@ -1900,12 +1900,15 @@ static HRESULT WINAPI ddraw7_GetAvailableVidMem(IDirectDraw7 *iface, DDSCAPS2 *C
     struct wined3d_display_mode mode;
     HRESULT hr = DD_OK;
 
-    TRACE("iface %p, caps %p, total %p, free %p.\n", iface, Caps, total, free);
+    TRACE("iface %p, caps %p, total %p, free %p.\n", iface, caps, total, free);
+
+    if (!total && !free)
+        return DDERR_INVALIDPARAMS;
 
     if (TRACE_ON(ddraw))
     {
         TRACE("Asked for memory with description: ");
-        DDRAW_dump_DDSCAPS2(Caps);
+        DDRAW_dump_DDSCAPS2(caps);
     }
     wined3d_mutex_lock();
 
@@ -1914,12 +1917,6 @@ static HRESULT WINAPI ddraw7_GetAvailableVidMem(IDirectDraw7 *iface, DDSCAPS2 *C
      * resources, but that's not important
      */
 
-    if( (!total) && (!free) )
-    {
-        wined3d_mutex_unlock();
-        return DDERR_INVALIDPARAMS;
-    }
-
     /* Some applications (e.g. 3DMark 2000) assume that the reported amount of
      * video memory doesn't include the memory used by the default framebuffer.
      */
-- 
2.7.3




More information about the wine-patches mailing list