[PATCH 12/17] Clean QueryInterface() method, turn impl. calls to interface calls

Nikolay Sivov nsivov at codeweavers.com
Sun Aug 21 03:27:53 CDT 2011


---
 dlls/oleaut32/olefont.c |   50 ++++++++++++++++++++++++++++------------------
 1 files changed, 30 insertions(+), 20 deletions(-)

diff --git a/dlls/oleaut32/olefont.c b/dlls/oleaut32/olefont.c
index 019132f..c986f0e 100644
--- a/dlls/oleaut32/olefont.c
+++ b/dlls/oleaut32/olefont.c
@@ -476,32 +476,42 @@ static HRESULT WINAPI OLEFontImpl_QueryInterface(
 
   *ppvObject = 0;
 
-  if (IsEqualGUID(&IID_IUnknown, riid))
-    *ppvObject = this;
-  if (IsEqualGUID(&IID_IFont, riid))
+  if (IsEqualGUID(&IID_IUnknown, riid) ||
+      IsEqualGUID(&IID_IFont, riid))
+  {
     *ppvObject = this;
-  if (IsEqualGUID(&IID_IDispatch, riid))
-    *ppvObject = &this->IDispatch_iface;
-  if (IsEqualGUID(&IID_IFontDisp, riid))
+  }
+  else if (IsEqualGUID(&IID_IDispatch, riid) ||
+           IsEqualGUID(&IID_IFontDisp, riid))
+  {
     *ppvObject = &this->IDispatch_iface;
-  if (IsEqualIID(&IID_IPersist, riid) || IsEqualGUID(&IID_IPersistStream, riid))
+  }
+  else if (IsEqualGUID(&IID_IPersist, riid) ||
+           IsEqualGUID(&IID_IPersistStream, riid))
+  {
     *ppvObject = &this->IPersistStream_iface;
-  if (IsEqualGUID(&IID_IConnectionPointContainer, riid))
+  }
+  else if (IsEqualGUID(&IID_IConnectionPointContainer, riid))
+  {
     *ppvObject = &this->IConnectionPointContainer_iface;
-  if (IsEqualGUID(&IID_IPersistPropertyBag, riid))
+  }
+  else if (IsEqualGUID(&IID_IPersistPropertyBag, riid))
+  {
     *ppvObject = &this->IPersistPropertyBag_iface;
-  if (IsEqualGUID(&IID_IPersistStreamInit, riid))
+  }
+  else if (IsEqualGUID(&IID_IPersistStreamInit, riid))
+  {
     *ppvObject = &this->IPersistStreamInit_iface;
+  }
 
-  /*
-   * Check that we obtained an interface.
-   */
-  if ((*ppvObject)==0)
+  if (!*ppvObject)
   {
-    FIXME("() : asking for unsupported interface %s\n",debugstr_guid(riid));
+    FIXME("() : asking for unsupported interface %s\n", debugstr_guid(riid));
     return E_NOINTERFACE;
   }
-  OLEFontImpl_AddRef(&this->IFont_iface);
+
+  IFont_AddRef(iface);
+
   return S_OK;
 }
 
@@ -1124,7 +1134,7 @@ static HRESULT      WINAPI OLEFontImpl_QueryTextMetrics(
   HFONT hOldFont, hNewFont;
 
   hdcRef = GetDC(0);
-  OLEFontImpl_get_hFont(iface, &hNewFont);
+  IFont_get_hFont(iface, &hNewFont);
   hOldFont = SelectObject(hdcRef, hNewFont);
   GetTextMetricsW(hdcRef, ptm);
   SelectObject(hdcRef, hOldFont);
@@ -1304,7 +1314,7 @@ static HRESULT WINAPI OLEFontImpl_GetIDsOfNames(
 
   if (cNames == 0) return E_INVALIDARG;
 
-  hres = OLEFontImpl_GetTypeInfo(iface, 0, lcid, &pTInfo);
+  hres = IDispatch_GetTypeInfo(iface, 0, lcid, &pTInfo);
   if (FAILED(hres))
   {
     ERR("GetTypeInfo failed.\n");
@@ -1484,7 +1494,7 @@ static HRESULT WINAPI OLEFontImpl_Invoke(
   case DISPID_FONT_SIZE:
     if (wFlags & DISPATCH_PROPERTYGET) {
       V_VT(pVarResult) = VT_CY;
-      return OLEFontImpl_get_Size(&this->IFont_iface, &V_CY(pVarResult));
+      return IFont_get_Size(&this->IFont_iface, &V_CY(pVarResult));
     } else {
       VARIANTARG vararg;
 
@@ -1502,7 +1512,7 @@ static HRESULT WINAPI OLEFontImpl_Invoke(
   case DISPID_FONT_WEIGHT:
     if (wFlags & DISPATCH_PROPERTYGET) {
       V_VT(pVarResult) = VT_I2;
-      return OLEFontImpl_get_Weight(&this->IFont_iface, &V_I2(pVarResult));
+      return IFont_get_Weight(&this->IFont_iface, &V_I2(pVarResult));
     } else {
       VARIANTARG vararg;
 
-- 
1.5.6.5



--------------090804020304080609010603--



More information about the wine-patches mailing list