On 8 March 2014 22:53, Stefan Dösinger stefan@codeweavers.com wrote:
+static inline HRESULT wined3d_private_store_set_private_data(struct wined3d_private_store *store,
const GUID *guid, const void *data, DWORD data_size, DWORD flags)
+{
- struct wined3d_private_data *entry;
- entry = wined3d_private_store_get_private_data(store, guid);
- if (entry)
wined3d_private_store_free_private_data(store, entry);
- entry = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*entry));
- if (!entry)
return E_OUTOFMEMORY;
- entry->tag = *guid;
- entry->flags = flags;
- entry->size = data_size;
- if (flags & WINED3DSPD_IUNKNOWN)
- {
if (data_size != sizeof(IUnknown *))
{
HeapFree(GetProcessHeap(), 0, entry);
return WINED3DERR_INVALIDCALL;
}
entry->content.object = (IUnknown *)data;
IUnknown_AddRef(entry->content.object);
- }
- else
- {
entry->content.data = HeapAlloc(GetProcessHeap(), 0, data_size);
if (!entry->content.data)
{
HeapFree(GetProcessHeap(), 0, entry);
return E_OUTOFMEMORY;
}
memcpy(entry->content.data, data, data_size);
- }
- list_add_tail(&store->content, &entry->entry);
- return WINED3D_OK;
+}
I think this has room for improvement as well.