[janitor] GlobalReAlloc usage in avifil32 fixed

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Changelog:
  Fixed usage of GlobaReAlloc in avifil32.


  Michael

--- dlls/avifil32/avifile.c.~1.39.~	2003-10-04 15:00:06.000000000 +0200
+++ dlls/avifil32/avifile.c	2003-10-14 13:40:54.000000000 +0200
@@ -1382,7 +1382,13 @@
       UINT n = This->sInfo.dwFormatChangeCount;
 
       This->nIdxFmtChanges += 16;
-      This->idxFmtChanges = GlobalReAllocPtr(This->idxFmtChanges, This->nIdxFmtChanges * sizeof(AVIINDEXENTRY), GHND);
+      if (This->idxFmtChanges == NULL)
+	This->idxFmtChanges =
+	  GlobalAllocPtr(GHND, This->nIdxFmtChanges * sizeof(AVIINDEXENTRY));
+      else
+	This->idxFmtChanges =
+	  GlobalReAllocPtr(This->idxFmtChanges,
+			   This->nIdxFmtChanges * sizeof(AVIINDEXENTRY), GHND);
       if (This->idxFmtChanges == NULL)
 	return AVIERR_MEMORY;
 
@@ -1413,7 +1419,13 @@
   /* get memory for index */
   if (This->idxFrames == NULL || This->lLastFrame + 1 >= This->nIdxFrames) {
     This->nIdxFrames += 512;
-    This->idxFrames = GlobalReAllocPtr(This->idxFrames, This->nIdxFrames * sizeof(AVIINDEXENTRY), GHND);
+    if (This->idxFrames == NULL)
+      This->idxFrames =
+	GlobalAllocPtr(GHND, This->nIdxFrames * sizeof(AVIINDEXENTRY));
+      else
+	This->idxFrames =
+	  GlobalReAllocPtr(This->idxFrames,
+			   This->nIdxFrames * sizeof(AVIINDEXENTRY), GHND);
     if (This->idxFrames == NULL)
       return AVIERR_MEMORY;
   }
@@ -2016,8 +2028,13 @@
 
     /* check that buffer is big enough -- don't trust dwSuggestedBufferSize */
     if (This->lpBuffer == NULL || size < This->cbBuffer) {
-      This->lpBuffer =
-	(LPDWORD)GlobalReAllocPtr(This->lpBuffer, max(size, This->sInfo.dwSuggestedBufferSize), GMEM_MOVEABLE);
+      DWORD maxSize = max(size, This->sInfo.dwSuggestedBufferSize);
+
+      if (This->lpBuffer == NULL)
+	This->lpBuffer = (LPDWORD)GlobalAllocPtr(GMEM_MOVEABLE, maxSize);
+      else
+	This->lpBuffer =
+	  (LPDWORD)GlobalReAllocPtr(This->lpBuffer, maxSize, GMEM_MOVEABLE);
       if (This->lpBuffer == NULL)
 	return AVIERR_MEMORY;
       This->cbBuffer = max(size, This->sInfo.dwSuggestedBufferSize);
--- dlls/avifil32/acmstream.c.~1.7.~	2003-09-07 23:32:03.000000000 +0200
+++ dlls/avifil32/acmstream.c	2003-10-14 13:42:18.000000000 +0200
@@ -467,8 +467,11 @@
   /* need bigger source buffer? */
   if (This->acmStreamHdr.pbSrc == NULL ||
       This->acmStreamHdr.dwSrcUser < size) {
-    This->acmStreamHdr.pbSrc = GlobalReAllocPtr(This->acmStreamHdr.pbSrc,
-						size, GMEM_MOVEABLE);
+    if (This->acmStreamHdr.pbSrc == NULL)
+      This->acmStreamHdr.pbSrc = GlobalAllocPtr(GMEM_MOVEABLE, size);
+    else
+      This->acmStreamHdr.pbSrc = GlobalReAllocPtr(This->acmStreamHdr.pbSrc,
+						  size, GMEM_MOVEABLE);
     if (This->acmStreamHdr.pbSrc == NULL)
       return AVIERR_MEMORY;
     This->acmStreamHdr.dwSrcUser = size;
@@ -568,8 +571,11 @@
   /* Need bigger destination buffer? */
   if (This->acmStreamHdr.pbDst == NULL ||
       This->acmStreamHdr.dwDstUser < size) {
-    This->acmStreamHdr.pbDst = GlobalReAllocPtr(This->acmStreamHdr.pbDst,
-						size, GMEM_MOVEABLE);
+    if (This->acmStreamHdr.pbDst == NULL)
+      This->acmStreamHdr.pbDst = GlobalAllocPtr(GMEM_MOVEABLE, size);
+    else
+      This->acmStreamHdr.pbDst = GlobalReAllocPtr(This->acmStreamHdr.pbDst,
+						  size, GMEM_MOVEABLE);
     if (This->acmStreamHdr.pbDst == NULL)
       return AVIERR_MEMORY;
     This->acmStreamHdr.dwDstUser = size;



[Index of Archives]     [Gimp for Windows]     [Red Hat]     [Samba]     [Yosemite Camping]     [Graphics Cards]     [Wine Home]

  Powered by Linux