On 24.10.2012 16:33, Dmitry Timoshkov wrote:
Christian Costa <[email protected]> wrote:
+static HRESULT WINAPI ID3DXFileImpl_QueryInterface(ID3DXFile *iface,
REFIID riid, void **ret_iface)
+{
+ TRACE("(%p)->(%s, %p)\n", iface, debugstr_guid(riid), ret_iface);
+
+ if (IsEqualGUID(riid, &IID_IUnknown) ||
+ IsEqualGUID(riid, &IID_ID3DXFile))
+ {
+ iface->lpVtbl->AddRef(iface);
Isn't there an appropriate xxx_AddRef() macro?
No.
Is there a reason why?
Yes, they are not in the headers which are supplied by the SDK (at least
not in the one I checked). I guess you have to ask ms why they didn't
add it. So I think we shouldn't add that in our headers.
+ if (!object)
+ {
+ ERR("Out of memory\n");
+ return E_OUTOFMEMORY;
+ }
The ERR() is useless here, just return E_OUTOFMEMORY in such situations.
It's done this way in many places in wine.
Then that other places need to be fixed as well. Printing an ERR() on memory
allocation errors is not helpful.
In which cases do you use ERR? I thought it is used, when there are
system errors. And I think ERR is fine for out of memory, because the
system is not able to hand out the needed memory. Just do a git grep.
There are ~400 usages for ERR and out of memory... What's your
suggestion how to do that with the "Out of memory"?
Cheers
Rico