quartz: Avoid side-effects in asserts.

Thomas Faber thomas.faber at reactos.org
Sun Jul 27 09:11:27 CDT 2014


From 8536402fc5d86ebbfd17dc9957bd0c8c3bc41f8c Mon Sep 17 00:00:00 2001
From: Thomas Faber <thomas.faber at reactos.org>
Date: Sat, 26 Jul 2014 22:04:29 +0200
Subject: quartz: Avoid side-effects in asserts.

---
 dlls/quartz/avisplit.c | 22 +++++++++++++++++-----
 dlls/quartz/parser.c   |  7 +++++--
 2 files changed, 22 insertions(+), 7 deletions(-)

diff --git a/dlls/quartz/avisplit.c b/dlls/quartz/avisplit.c
index d74c8ab..1f57045 100644
--- a/dlls/quartz/avisplit.c
+++ b/dlls/quartz/avisplit.c
@@ -151,6 +151,7 @@ static HRESULT AVISplitter_next_request(AVISplitterImpl *This, DWORD streamnumbe
     PullPin *pin = This->Parser.pInputPin;
     IMediaSample *sample = NULL;
     HRESULT hr;
+    ULONG ref;
 
     TRACE("(%p, %u)->()\n", This, streamnumber);
 
@@ -264,7 +265,10 @@ static HRESULT AVISplitter_next_request(AVISplitterImpl *This, DWORD streamnumbe
             hr = IAsyncReader_Request(pin->pReader, sample, streamnumber);
 
             if (FAILED(hr))
-                assert(IMediaSample_Release(sample) == 0);
+            {
+                ref = IMediaSample_Release(sample);
+                assert(ref == 0);
+            }
         }
         else
         {
@@ -278,7 +282,8 @@ static HRESULT AVISplitter_next_request(AVISplitterImpl *This, DWORD streamnumbe
         if (sample)
         {
             ERR("There should be no sample!\n");
-            assert(IMediaSample_Release(sample) == 0);
+            ref = IMediaSample_Release(sample);
+            assert(ref == 0);
         }
     }
     TRACE("--> %08x\n", hr);
@@ -510,8 +515,8 @@ static HRESULT AVISplitter_first_request(LPVOID iface)
 static HRESULT AVISplitter_done_process(LPVOID iface)
 {
     AVISplitterImpl *This = iface;
-
     DWORD x;
+    ULONG ref;
 
     for (x = 0; x < This->Parser.cStreams; ++x)
     {
@@ -525,7 +530,10 @@ static HRESULT AVISplitter_done_process(LPVOID iface)
         stream->thread = NULL;
 
         if (stream->sample)
-            assert(IMediaSample_Release(stream->sample) == 0);
+        {
+            ref = IMediaSample_Release(stream->sample);
+            assert(ref == 0);
+        }
         stream->sample = NULL;
 
         ResetEvent(stream->packet_queued);
@@ -1219,6 +1227,7 @@ static HRESULT AVISplitter_Flush(LPVOID iface)
 {
     AVISplitterImpl *This = iface;
     DWORD x;
+    ULONG ref;
 
     TRACE("(%p)->()\n", This);
 
@@ -1227,7 +1236,10 @@ static HRESULT AVISplitter_Flush(LPVOID iface)
         StreamData *stream = This->streams + x;
 
         if (stream->sample)
-            assert(IMediaSample_Release(stream->sample) == 0);
+        {
+            ref = IMediaSample_Release(stream->sample);
+            assert(ref == 0);
+        }
         stream->sample = NULL;
 
         ResetEvent(stream->packet_queued);
diff --git a/dlls/quartz/parser.c b/dlls/quartz/parser.c
index b57bae4..cd8d93d 100644
--- a/dlls/quartz/parser.c
+++ b/dlls/quartz/parser.c
@@ -170,6 +170,7 @@ void Parser_Destroy(ParserImpl *This)
 {
     IPin *connected = NULL;
     ULONG pinref;
+    HRESULT hr;
 
     assert(!This->filter.refCount);
     PullPin_WaitForStateChange(This->pInputPin, INFINITE);
@@ -178,9 +179,11 @@ void Parser_Destroy(ParserImpl *This)
     IPin_ConnectedTo(&This->pInputPin->pin.IPin_iface, &connected);
     if (connected)
     {
-        assert(IPin_Disconnect(connected) == S_OK);
+        hr = IPin_Disconnect(connected);
+        assert(hr == S_OK);
         IPin_Release(connected);
-        assert(IPin_Disconnect(&This->pInputPin->pin.IPin_iface) == S_OK);
+        hr = IPin_Disconnect(&This->pInputPin->pin.IPin_iface);
+        assert(hr == S_OK);
     }
     pinref = IPin_Release(&This->pInputPin->pin.IPin_iface);
     if (pinref)
-- 
1.9.0.msysgit.0



More information about the wine-patches mailing list