=?UTF-8?Q?Andr=C3=A9=20Hentschel=20?=: avifil32: Simplify comparing two unsigned ints (PVS-Studio).

Alexandre Julliard julliard at wine.codeweavers.com
Wed Nov 12 09:33:53 CST 2014


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

Author: André Hentschel <nerv at dawncrow.de>
Date:   Tue Nov 11 21:20:46 2014 +0100

avifil32: Simplify comparing two unsigned ints (PVS-Studio).

---

 dlls/avifil32/avifile.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/dlls/avifil32/avifile.c b/dlls/avifil32/avifile.c
index 6295c7b..5b65fd0 100644
--- a/dlls/avifil32/avifile.c
+++ b/dlls/avifil32/avifile.c
@@ -465,13 +465,12 @@ static HRESULT WINAPI IAVIFile_fnDeleteStream(IAVIFile *iface, DWORD fccType, LO
       This->ppStreams[nStream] != NULL) {
     /* ... so delete it now */
     HeapFree(GetProcessHeap(), 0, This->ppStreams[nStream]);
-
-    if (This->fInfo.dwStreams - nStream > 0)
-      memcpy(This->ppStreams + nStream, This->ppStreams + nStream + 1,
-	     (This->fInfo.dwStreams - nStream) * sizeof(IAVIStreamImpl*));
+    This->fInfo.dwStreams--;
+    if (nStream < This->fInfo.dwStreams)
+      memmove(&This->ppStreams[nStream], &This->ppStreams[nStream + 1],
+             (This->fInfo.dwStreams - nStream) * sizeof(This->ppStreams[0]));
 
     This->ppStreams[This->fInfo.dwStreams] = NULL;
-    This->fInfo.dwStreams--;
     This->fDirty = TRUE;
 
     /* This->fInfo will be updated further when asked for */




More information about the wine-cvs mailing list