Bruno Jesus : msvfw32: Only update output parameters when the compress operation works.

Alexandre Julliard julliard at wine.codeweavers.com
Tue Oct 20 11:28:29 CDT 2015


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

Author: Bruno Jesus <00cpxxx at gmail.com>
Date:   Tue Oct 20 14:57:02 2015 +0800

msvfw32: Only update output parameters when the compress operation works.

Signed-off-by: Bruno Jesus <00cpxxx at gmail.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/msvfw32/msvideo_main.c | 42 ++++++++++++++++++++++--------------------
 1 file changed, 22 insertions(+), 20 deletions(-)

diff --git a/dlls/msvfw32/msvideo_main.c b/dlls/msvfw32/msvideo_main.c
index 204d53a..1ebfc00 100644
--- a/dlls/msvfw32/msvideo_main.c
+++ b/dlls/msvfw32/msvideo_main.c
@@ -1366,7 +1366,7 @@ LPVOID VFWAPI ICSeqCompressFrame(PCOMPVARS pc, UINT uiFlags, LPVOID lpBits, BOOL
         if (pc->lKey && pc->lKeyCount == (pc->lKey - 1))
         /* No key frames if pc->lKey == 0 */
            pc->lKeyCount = 0;
-	icComp->dwFlags = 0;
+        icComp->dwFlags = 0;
     }
 
     icComp->lpInput = lpBits;
@@ -1375,28 +1375,30 @@ LPVOID VFWAPI ICSeqCompressFrame(PCOMPVARS pc, UINT uiFlags, LPVOID lpBits, BOOL
     icComp->lpPrev = pc->lpBitsPrev;
     ret = ICSendMessage(pc->hic, ICM_COMPRESS, (DWORD_PTR)icComp, sizeof(*icComp));
 
-    if (icComp->dwFlags & AVIIF_KEYFRAME)
-    {
-       pc->lKeyCount = 1;
-       *pfKey = TRUE;
-       TRACE("Key frame\n");
-    }
-    else
-       *pfKey = FALSE;
-
-    *plSize = icComp->lpbiOutput->biSizeImage;
     TRACE(" -- 0x%08x\n", ret);
     if (ret == ICERR_OK)
     {
-       LPVOID oldprev, oldout;
-/* We shift Prev and Out, so we don't have to allocate and release memory */
-       oldprev = pc->lpBitsPrev;
-       oldout = pc->lpBitsOut;
-       pc->lpBitsPrev = oldout;
-       pc->lpBitsOut = oldprev;
-
-       TRACE("returning: %p\n", icComp->lpOutput);
-       return icComp->lpOutput;
+        LPVOID oldprev, oldout;
+
+        if (icComp->dwFlags & AVIIF_KEYFRAME)
+        {
+            pc->lKeyCount = 1;
+            *pfKey = TRUE;
+            TRACE("Key frame\n");
+        }
+        else
+            *pfKey = FALSE;
+
+        *plSize = icComp->lpbiOutput->biSizeImage;
+
+        /* We shift Prev and Out, so we don't have to allocate and release memory */
+        oldprev = pc->lpBitsPrev;
+        oldout = pc->lpBitsOut;
+        pc->lpBitsPrev = oldout;
+        pc->lpBitsOut = oldprev;
+
+        TRACE("returning: %p, compressed frame size %u\n", icComp->lpOutput, *plSize);
+        return icComp->lpOutput;
     }
     return NULL;
 }




More information about the wine-cvs mailing list