Henri Verbeet : d3dx9: Simplify D3DXGetImageInfoFromResourceW().

Alexandre Julliard julliard at winehq.org
Tue Aug 27 14:47:55 CDT 2013


Module: wine
Branch: master
Commit: 4c850f0e7964df9da5c8b557e0c0b4624e0720f3
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=4c850f0e7964df9da5c8b557e0c0b4624e0720f3

Author: Henri Verbeet <hverbeet at codeweavers.com>
Date:   Tue Aug 27 08:45:01 2013 +0200

d3dx9: Simplify D3DXGetImageInfoFromResourceW().

---

 dlls/d3dx9_36/surface.c |   27 +++++++++++----------------
 1 files changed, 11 insertions(+), 16 deletions(-)

diff --git a/dlls/d3dx9_36/surface.c b/dlls/d3dx9_36/surface.c
index efcf09c..4b86f1c 100644
--- a/dlls/d3dx9_36/surface.c
+++ b/dlls/d3dx9_36/surface.c
@@ -966,28 +966,23 @@ HRESULT WINAPI D3DXGetImageInfoFromResourceA(HMODULE module, const char *resourc
     return D3DXGetImageInfoFromFileInMemory(buffer, size, info);
 }
 
-HRESULT WINAPI D3DXGetImageInfoFromResourceW(HMODULE module, LPCWSTR resource, D3DXIMAGE_INFO *info)
+HRESULT WINAPI D3DXGetImageInfoFromResourceW(HMODULE module, const WCHAR *resource, D3DXIMAGE_INFO *info)
 {
     HRSRC resinfo;
+    void *buffer;
+    DWORD size;
 
-    TRACE("(%p, %s, %p)\n", module, debugstr_w(resource), info);
-
-    resinfo = FindResourceW(module, resource, (const WCHAR *)RT_RCDATA);
-    if (!resinfo) /* Try loading the resource as bitmap data (which is in DIB format D3DXIFF_DIB) */
-        resinfo = FindResourceW(module, resource, (const WCHAR *)RT_BITMAP);
+    TRACE("module %p, resource %s, info %p.\n", module, debugstr_w(resource), info);
 
-    if (resinfo)
-    {
-        LPVOID buffer;
-        HRESULT hr;
-        DWORD size;
+    if (!(resinfo = FindResourceW(module, resource, (const WCHAR *)RT_RCDATA))
+            /* Try loading the resource as bitmap data (which is in DIB format D3DXIFF_DIB) */
+            && !(resinfo = FindResourceW(module, resource, (const WCHAR *)RT_BITMAP)))
+        return D3DXERR_INVALIDDATA;
 
-        hr = load_resource_into_memory(module, resinfo, &buffer, &size);
-        if(FAILED(hr)) return D3DXERR_INVALIDDATA;
-        return D3DXGetImageInfoFromFileInMemory(buffer, size, info);
-    }
+    if (FAILED(load_resource_into_memory(module, resinfo, &buffer, &size)))
+        return D3DXERR_INVALIDDATA;
 
-    return D3DXERR_INVALIDDATA;
+    return D3DXGetImageInfoFromFileInMemory(buffer, size, info);
 }
 
 /************************************************************




More information about the wine-cvs mailing list