Michael Stefaniuc : avifil32: Avoid casts of IAVIEditStream to the COM object.

Alexandre Julliard julliard at winehq.org
Fri Jul 15 09:07:06 CDT 2016


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

Author: Michael Stefaniuc <mstefani at redhat.de>
Date:   Thu Jul 14 10:21:03 2016 +0200

avifil32: Avoid casts of IAVIEditStream to the COM object.

Signed-off-by: Michael Stefaniuc <mstefani at redhat.de>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/avifil32/editstream.c | 21 ++++++++++-----------
 1 file changed, 10 insertions(+), 11 deletions(-)

diff --git a/dlls/avifil32/editstream.c b/dlls/avifil32/editstream.c
index a6c534e..815283b 100644
--- a/dlls/avifil32/editstream.c
+++ b/dlls/avifil32/editstream.c
@@ -70,7 +70,7 @@ struct _IAVIEditStreamImpl {
   LPBITMAPINFOHEADER   lpFrame;    /* frame of pCurStream */
 };
 
-static IAVIEditStream *AVIFILE_CreateEditStream(IAVIStream *stream);
+static IAVIEditStreamImpl *AVIFILE_CreateEditStream(IAVIStream *stream);
 
 static inline IAVIEditStreamImpl *impl_from_IAVIEditStream(IAVIEditStream *iface)
 {
@@ -400,7 +400,7 @@ static HRESULT WINAPI IAVIEditStream_fnCopy(IAVIEditStream*iface,LONG*plStart,
     *(LPDWORD)plLength = This->sInfo.dwStart + This->sInfo.dwLength -
       *(LPDWORD)plStart;
 
-  pEdit = (IAVIEditStreamImpl*)AVIFILE_CreateEditStream(NULL);
+  pEdit = AVIFILE_CreateEditStream(NULL);
   if (pEdit == NULL)
     return AVIERR_MEMORY;
 
@@ -616,7 +616,7 @@ static HRESULT WINAPI IAVIEditStream_fnClone(IAVIEditStream*iface,
     return AVIERR_BADPARAM;
   *ppResult = NULL;
 
-  pEdit = (IAVIEditStreamImpl*)AVIFILE_CreateEditStream(NULL);
+  pEdit = AVIFILE_CreateEditStream(NULL);
   if (pEdit == NULL)
     return AVIERR_MEMORY;
   if (This->nStreams > pEdit->nTableSize) {
@@ -1007,7 +1007,7 @@ static const struct IAVIStreamVtbl ieditstast = {
   IEditAVIStream_fnSetInfo
 };
 
-static IAVIEditStream *AVIFILE_CreateEditStream(IAVIStream *pstream)
+static IAVIEditStreamImpl *AVIFILE_CreateEditStream(IAVIStream *pstream)
 {
   IAVIEditStreamImpl *pedit = NULL;
 
@@ -1021,7 +1021,7 @@ static IAVIEditStream *AVIFILE_CreateEditStream(IAVIStream *pstream)
 
   IAVIStream_Create(&pedit->IAVIStream_iface, (LPARAM)pstream, 0);
 
-  return (PAVIEDITSTREAM)pedit;
+  return pedit;
 }
 
 /***********************************************************************
@@ -1030,6 +1030,7 @@ static IAVIEditStream *AVIFILE_CreateEditStream(IAVIStream *pstream)
 HRESULT WINAPI CreateEditableStream(IAVIStream **editable, IAVIStream *src)
 {
     IAVIEditStream *edit = NULL;
+    IAVIEditStreamImpl *editobj;
     HRESULT hr;
 
     TRACE("(%p,%p)\n", editable, src);
@@ -1049,12 +1050,10 @@ HRESULT WINAPI CreateEditableStream(IAVIStream **editable, IAVIStream *src)
     }
 
     /* Need own implementation of IAVIEditStream */
-    edit = AVIFILE_CreateEditStream(src);
-    if (!edit)
+    editobj = AVIFILE_CreateEditStream(src);
+    if (!editobj)
         return AVIERR_MEMORY;
+    *editable = &editobj->IAVIStream_iface;
 
-    hr = IAVIEditStream_QueryInterface(edit, &IID_IAVIStream, (void**)editable);
-    IAVIEditStream_Release(edit);
-
-    return hr;
+    return S_OK;
 }




More information about the wine-cvs mailing list