Michael Stefaniuc : d3d10: Avoid casts from COM object to interface.

Alexandre Julliard julliard at winehq.org
Fri Sep 6 16:05:42 CDT 2019


Module: wine
Branch: master
Commit: cfd1f614bc4d8ea1bc7496a4f09c2a8bf8ae33be
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=cfd1f614bc4d8ea1bc7496a4f09c2a8bf8ae33be

Author: Michael Stefaniuc <mstefani at winehq.org>
Date:   Wed Sep  4 22:59:57 2019 +0200

d3d10: Avoid casts from COM object to interface.

Signed-off-by: Michael Stefaniuc <mstefani at winehq.org>
Signed-off-by: Henri Verbeet <hverbeet at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/d3d10/effect.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/dlls/d3d10/effect.c b/dlls/d3d10/effect.c
index 2390eee..4398334 100644
--- a/dlls/d3d10/effect.c
+++ b/dlls/d3d10/effect.c
@@ -2716,14 +2716,14 @@ static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_GetCon
     if (index >= This->local_buffer_count)
     {
         WARN("Invalid index specified\n");
-        return (ID3D10EffectConstantBuffer *)&null_local_buffer;
+        return (ID3D10EffectConstantBuffer *)&null_local_buffer.ID3D10EffectVariable_iface;
     }
 
     l = &This->local_buffers[index];
 
     TRACE("Returning buffer %p, %s.\n", l, debugstr_a(l->name));
 
-    return (ID3D10EffectConstantBuffer *)l;
+    return (ID3D10EffectConstantBuffer *)&l->ID3D10EffectVariable_iface;
 }
 
 static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_GetConstantBufferByName(ID3D10Effect *iface,
@@ -2741,13 +2741,13 @@ static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_GetCon
         if (l->name && !strcmp(l->name, name))
         {
             TRACE("Returning buffer %p.\n", l);
-            return (ID3D10EffectConstantBuffer *)l;
+            return (ID3D10EffectConstantBuffer *)&l->ID3D10EffectVariable_iface;
         }
     }
 
     WARN("Invalid name specified\n");
 
-    return (ID3D10EffectConstantBuffer *)&null_local_buffer;
+    return (ID3D10EffectConstantBuffer *)&null_local_buffer.ID3D10EffectVariable_iface;
 }
 
 static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_GetVariableByIndex(ID3D10Effect *iface, UINT index)
@@ -3529,7 +3529,7 @@ static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_variab
 
     TRACE("iface %p\n", iface);
 
-    return (ID3D10EffectConstantBuffer *)This->buffer;
+    return (ID3D10EffectConstantBuffer *)&This->buffer->ID3D10EffectVariable_iface;
 }
 
 static struct ID3D10EffectScalarVariable * STDMETHODCALLTYPE d3d10_effect_variable_AsScalar(




More information about the wine-cvs mailing list