[PATCH 4/5] d3dx9: Simplify D3DXGetImageInfoFromResourceA().
Henri Verbeet
hverbeet at codeweavers.com
Tue Aug 27 01:45:00 CDT 2013
---
dlls/d3dx9_36/surface.c | 27 +++++++++++----------------
1 file changed, 11 insertions(+), 16 deletions(-)
diff --git a/dlls/d3dx9_36/surface.c b/dlls/d3dx9_36/surface.c
index f5c954f..efcf09c 100644
--- a/dlls/d3dx9_36/surface.c
+++ b/dlls/d3dx9_36/surface.c
@@ -947,28 +947,23 @@ HRESULT WINAPI D3DXGetImageInfoFromFileW(LPCWSTR file, D3DXIMAGE_INFO *info)
* if we fail to load resource
*
*/
-HRESULT WINAPI D3DXGetImageInfoFromResourceA(HMODULE module, LPCSTR resource, D3DXIMAGE_INFO *info)
+HRESULT WINAPI D3DXGetImageInfoFromResourceA(HMODULE module, const char *resource, D3DXIMAGE_INFO *info)
{
HRSRC resinfo;
+ void *buffer;
+ DWORD size;
- TRACE("(%p, %s, %p)\n", module, debugstr_a(resource), info);
-
- resinfo = FindResourceA(module, resource, (const char *)RT_RCDATA);
- if (!resinfo) /* Try loading the resource as bitmap data (which is in DIB format D3DXIFF_DIB) */
- resinfo = FindResourceA(module, resource, (const char *)RT_BITMAP);
+ TRACE("module %p, resource %s, info %p.\n", module, debugstr_a(resource), info);
- if (resinfo)
- {
- LPVOID buffer;
- HRESULT hr;
- DWORD size;
+ if (!(resinfo = FindResourceA(module, resource, (const char *)RT_RCDATA))
+ /* Try loading the resource as bitmap data (which is in DIB format D3DXIFF_DIB) */
+ && !(resinfo = FindResourceA(module, resource, (const char *)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);
}
HRESULT WINAPI D3DXGetImageInfoFromResourceW(HMODULE module, LPCWSTR resource, D3DXIMAGE_INFO *info)
--
1.8.1.5
More information about the wine-patches
mailing list