animate: whitespace changes

Dimitrie O. Paun dpaun at rogers.com
Fri Mar 4 09:43:58 CST 2005


These are only the whitespace changes separated from the
patch that I've sent earlier. In preparation for typesafety
and unicodification, plus some fixes.

ChangeLog
    Fix some formatting for consistency with the rest of the file.


Index: dlls/comctl32/animate.c
===================================================================
RCS file: /var/cvs/wine/dlls/comctl32/animate.c,v
retrieving revision 1.60
diff -u -r1.60 animate.c
--- dlls/comctl32/animate.c	23 Dec 2004 18:24:50 -0000	1.60
+++ dlls/comctl32/animate.c	4 Mar 2005 15:40:31 -0000
@@ -89,7 +89,7 @@
 #define ANIMATE_GetInfoPtr(hWnd) ((ANIMATE_INFO *)GetWindowLongPtrW(hWnd, 0))
 #define ANIMATE_COLOR_NONE  	0xffffffff
 
-static void ANIMATE_Notify(ANIMATE_INFO* infoPtr, UINT notif)
+static void ANIMATE_Notify(ANIMATE_INFO *infoPtr, UINT notif)
 {
     SendMessageA(infoPtr->hwndNotify, WM_COMMAND,
 		 MAKEWPARAM(GetDlgCtrlID(infoPtr->hwndSelf), notif),
@@ -119,7 +119,8 @@
     mminfo.pchBuffer = (LPSTR)lpAvi;
     mminfo.cchBuffer = SizeofResource(hInst, hrsrc);
     infoPtr->hMMio = mmioOpenA(NULL, &mminfo, MMIO_READ);
-    if (!infoPtr->hMMio) {
+    if (!infoPtr->hMMio) 
+    {
 	FreeResource(infoPtr->hRes);
 	return FALSE;
     }
@@ -165,7 +166,8 @@
         CloseHandle( infoPtr->hStopEvent );
         infoPtr->hStopEvent = 0;
     }
-    if (infoPtr->uTimer) {
+    if (infoPtr->uTimer) 
+    {
 	KillTimer(infoPtr->hwndSelf, infoPtr->uTimer);
 	infoPtr->uTimer = 0;
     }
@@ -180,16 +182,19 @@
 
 static void ANIMATE_Free(ANIMATE_INFO *infoPtr)
 {
-    if (infoPtr->hMMio) {
+    if (infoPtr->hMMio) 
+    {
 	ANIMATE_DoStop(infoPtr);
 	mmioClose(infoPtr->hMMio, 0);
-	if (infoPtr->hRes) {
+	if (infoPtr->hRes) 
+	{
  	    FreeResource(infoPtr->hRes);
 	    infoPtr->hRes = 0;
 	}
         HeapFree(GetProcessHeap(), 0, infoPtr->lpIndex);
         infoPtr->lpIndex = NULL;
-	if (infoPtr->hic) {
+	if (infoPtr->hic) 
+	{
 	    fnIC.fnICClose(infoPtr->hic);
 	    infoPtr->hic = 0;
 	}
@@ -217,7 +222,7 @@
     infoPtr->transparentColor = ANIMATE_COLOR_NONE;
 }
 
-static void ANIMATE_TransparentBlt(ANIMATE_INFO* infoPtr, HDC hdcDest, HDC hdcSource)
+static void ANIMATE_TransparentBlt(ANIMATE_INFO *infoPtr, HDC hdcDest, HDC hdcSource)
 {
     HDC hdcMask;
     HBITMAP hbmMask;
@@ -225,31 +230,36 @@
 
     /* create a transparency mask */
     hdcMask = CreateCompatibleDC(hdcDest);
-    hbmMask = CreateBitmap(infoPtr->inbih->biWidth, infoPtr->inbih->biHeight, 1,1,NULL);
+    hbmMask = CreateBitmap(infoPtr->inbih->biWidth, infoPtr->inbih->biHeight, 
+			   1, 1, NULL);
     hbmOld = SelectObject(hdcMask, hbmMask);
 
     SetBkColor(hdcSource,infoPtr->transparentColor);
-    BitBlt(hdcMask,0,0,infoPtr->inbih->biWidth, infoPtr->inbih->biHeight,hdcSource,0,0,SRCCOPY);
+    BitBlt(hdcMask, 0, 0, infoPtr->inbih->biWidth, infoPtr->inbih->biHeight,
+	   hdcSource, 0, 0, SRCCOPY);
 
     /* mask the source bitmap */
     SetBkColor(hdcSource, RGB(0,0,0));
     SetTextColor(hdcSource, RGB(255,255,255));
-    BitBlt(hdcSource, 0, 0, infoPtr->inbih->biWidth, infoPtr->inbih->biHeight, hdcMask, 0, 0, SRCAND);
+    BitBlt(hdcSource, 0, 0, infoPtr->inbih->biWidth, infoPtr->inbih->biHeight,
+	   hdcMask, 0, 0, SRCAND);
 
     /* mask the destination bitmap */
     SetBkColor(hdcDest, RGB(255,255,255));
     SetTextColor(hdcDest, RGB(0,0,0));
-    BitBlt(hdcDest, 0, 0, infoPtr->inbih->biWidth, infoPtr->inbih->biHeight, hdcMask, 0, 0, SRCAND);
+    BitBlt(hdcDest, 0, 0, infoPtr->inbih->biWidth, infoPtr->inbih->biHeight,
+	   hdcMask, 0, 0, SRCAND);
 
     /* combine source and destination */
-    BitBlt(hdcDest,0,0,infoPtr->inbih->biWidth, infoPtr->inbih->biHeight,hdcSource,0,0,SRCPAINT);
+    BitBlt(hdcDest,0,0,infoPtr->inbih->biWidth, infoPtr->inbih->biHeight,
+	   hdcSource, 0, 0, SRCPAINT);
 
     SelectObject(hdcMask, hbmOld);
     DeleteObject(hbmMask);
     DeleteDC(hdcMask);
 }
 
-static LRESULT ANIMATE_PaintFrame(ANIMATE_INFO* infoPtr, HDC hDC)
+static LRESULT ANIMATE_PaintFrame(ANIMATE_INFO *infoPtr, HDC hDC)
 {
     void* pBitmapData = NULL;
     LPBITMAPINFO pBitmapInfo = NULL;
@@ -273,7 +283,8 @@
 
         nWidth = infoPtr->outbih->biWidth;
         nHeight = infoPtr->outbih->biHeight;
-    } else
+    } 
+    else
     {
         pBitmapData = infoPtr->indata;
         pBitmapInfo = (LPBITMAPINFO)infoPtr->inbih;
@@ -325,7 +336,7 @@
         DeleteDC(hdcFinal);
         DeleteObject(infoPtr->hbmPrevFrame);
         infoPtr->hbmPrevFrame = hbmFinal;
-         }
+    }
 
     if (GetWindowLongA(infoPtr->hwndSelf, GWL_STYLE) & ACS_CENTER)
     {
@@ -342,7 +353,7 @@
     return TRUE;
 }
 
-static LRESULT ANIMATE_DrawFrame(ANIMATE_INFO* infoPtr)
+static LRESULT ANIMATE_DrawFrame(ANIMATE_INFO *infoPtr)
 {
     HDC		hDC;
 
@@ -355,23 +366,26 @@
 
     if (infoPtr->hic &&
 	fnIC.fnICDecompress(infoPtr->hic, 0, infoPtr->inbih, infoPtr->indata,
-		     infoPtr->outbih, infoPtr->outdata) != ICERR_OK) {
+		     infoPtr->outbih, infoPtr->outdata) != ICERR_OK) 
+    {
 	LeaveCriticalSection(&infoPtr->cs);
 	WARN("Decompression error\n");
 	return FALSE;
     }
 
-    if ((hDC = GetDC(infoPtr->hwndSelf)) != 0) {
+    if ((hDC = GetDC(infoPtr->hwndSelf)) != 0) 
+    {
 	ANIMATE_PaintFrame(infoPtr, hDC);
 	ReleaseDC(infoPtr->hwndSelf, hDC);
     }
 
-    if (infoPtr->currFrame++ >= infoPtr->nToFrame) {
+    if (infoPtr->currFrame++ >= infoPtr->nToFrame) 
+    {
 	infoPtr->currFrame = infoPtr->nFromFrame;
-	if (infoPtr->nLoop != -1) {
-	    if (--infoPtr->nLoop == 0) {
+	if (infoPtr->nLoop != -1) 
+	{
+	    if (--infoPtr->nLoop == 0) 
 		ANIMATE_DoStop(infoPtr);
-	    }
 	}
     }
     LeaveCriticalSection(&infoPtr->cs);
@@ -408,7 +422,8 @@
     if (!infoPtr->hMMio)
 	return FALSE;
 
-    if (infoPtr->hThread || infoPtr->uTimer) {
+    if (infoPtr->hThread || infoPtr->uTimer) 
+    {
 	TRACE("Already playing\n");
 	return TRUE;
     }
@@ -429,11 +444,14 @@
 
     infoPtr->currFrame = infoPtr->nFromFrame;
 
-    if (GetWindowLongA(hWnd, GWL_STYLE) & ACS_TIMER) {
+    if (GetWindowLongA(hWnd, GWL_STYLE) & ACS_TIMER) 
+    {
 	TRACE("Using a timer\n");
 	/* create a timer to display AVI */
 	infoPtr->uTimer = SetTimer(hWnd, 1, infoPtr->mah.dwMicroSecPerFrame / 1000, NULL);
-    } else {
+    } 
+    else 
+    {
         if(GetWindowLongA(hWnd, GWL_STYLE) & ACS_TRANSPARENT)
         {
             infoPtr->hbrushBG = (HBRUSH)SendMessageA(infoPtr->hwndNotify,
@@ -466,25 +484,29 @@
     DWORD		numFrame;
     DWORD		insize;
 
-    if (mmioDescend(infoPtr->hMMio, &ckMainRIFF, NULL, 0) != 0) {
+    if (mmioDescend(infoPtr->hMMio, &ckMainRIFF, NULL, 0) != 0) 
+    {
 	WARN("Can't find 'RIFF' chunk\n");
 	return FALSE;
     }
 
     if ((ckMainRIFF.ckid != FOURCC_RIFF) ||
-	(ckMainRIFF.fccType != mmioFOURCC('A', 'V', 'I', ' '))) {
+	(ckMainRIFF.fccType != mmioFOURCC('A', 'V', 'I', ' '))) 
+    {
 	WARN("Can't find 'AVI ' chunk\n");
 	return FALSE;
     }
 
     mmckHead.fccType = mmioFOURCC('h', 'd', 'r', 'l');
-    if (mmioDescend(infoPtr->hMMio, &mmckHead, &ckMainRIFF, MMIO_FINDLIST) != 0) {
+    if (mmioDescend(infoPtr->hMMio, &mmckHead, &ckMainRIFF, MMIO_FINDLIST) != 0)
+    {
 	WARN("Can't find 'hdrl' list\n");
 	return FALSE;
     }
 
     mmckInfo.ckid = mmioFOURCC('a', 'v', 'i', 'h');
-    if (mmioDescend(infoPtr->hMMio, &mmckInfo, &mmckHead, MMIO_FINDCHUNK) != 0) {
+    if (mmioDescend(infoPtr->hMMio, &mmckInfo, &mmckHead, MMIO_FINDCHUNK) != 0) 
+    {
 	WARN("Can't find 'avih' chunk\n");
 	return FALSE;
     }
@@ -505,13 +527,15 @@
     mmioAscend(infoPtr->hMMio, &mmckInfo, 0);
 
     mmckList.fccType = mmioFOURCC('s', 't', 'r', 'l');
-    if (mmioDescend(infoPtr->hMMio, &mmckList, &mmckHead, MMIO_FINDLIST) != 0) {
+    if (mmioDescend(infoPtr->hMMio, &mmckList, &mmckHead, MMIO_FINDLIST) != 0) 
+    {
 	WARN("Can't find 'strl' list\n");
 	return FALSE;
     }
 
     mmckInfo.ckid = mmioFOURCC('s', 't', 'r', 'h');
-    if (mmioDescend(infoPtr->hMMio, &mmckInfo, &mmckList, MMIO_FINDCHUNK) != 0) {
+    if (mmioDescend(infoPtr->hMMio, &mmckInfo, &mmckList, MMIO_FINDCHUNK) != 0) 
+    {
 	WARN("Can't find 'strh' chunk\n");
 	return FALSE;
     }
@@ -543,13 +567,15 @@
     mmioAscend(infoPtr->hMMio, &mmckInfo, 0);
 
     mmckInfo.ckid = mmioFOURCC('s', 't', 'r', 'f');
-    if (mmioDescend(infoPtr->hMMio, &mmckInfo, &mmckList, MMIO_FINDCHUNK) != 0) {
+    if (mmioDescend(infoPtr->hMMio, &mmckInfo, &mmckList, MMIO_FINDCHUNK) != 0) 
+    {
 	WARN("Can't find 'strh' chunk\n");
 	return FALSE;
     }
 
     infoPtr->inbih = HeapAlloc(GetProcessHeap(), 0, mmckInfo.cksize);
-    if (!infoPtr->inbih) {
+    if (!infoPtr->inbih) 
+    {
 	WARN("Can't alloc input BIH\n");
 	return FALSE;
     }
@@ -588,7 +614,8 @@
     /* no need to read optional JUNK chunk */
 
     mmckList.fccType = mmioFOURCC('m', 'o', 'v', 'i');
-    if (mmioDescend(infoPtr->hMMio, &mmckList, &ckMainRIFF, MMIO_FINDLIST) != 0) {
+    if (mmioDescend(infoPtr->hMMio, &mmckList, &ckMainRIFF, MMIO_FINDLIST) != 0)
+    {
 	WARN("Can't find 'movi' list\n");
 	return FALSE;
     }
@@ -597,31 +624,36 @@
 
     infoPtr->lpIndex = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY,
 				 infoPtr->mah.dwTotalFrames * sizeof(DWORD));
-    if (!infoPtr->lpIndex) {
+    if (!infoPtr->lpIndex) 
+    {
 	WARN("Can't alloc index array\n");
 	return FALSE;
     }
 
     numFrame = insize = 0;
     while (mmioDescend(infoPtr->hMMio, &mmckInfo, &mmckList, 0) == 0 &&
-	   numFrame < infoPtr->mah.dwTotalFrames) {
+	   numFrame < infoPtr->mah.dwTotalFrames) 
+    {
 	infoPtr->lpIndex[numFrame] = mmckInfo.dwDataOffset;
 	if (insize < mmckInfo.cksize)
 	    insize = mmckInfo.cksize;
 	numFrame++;
 	mmioAscend(infoPtr->hMMio, &mmckInfo, 0);
     }
-    if (numFrame != infoPtr->mah.dwTotalFrames) {
+    if (numFrame != infoPtr->mah.dwTotalFrames) 
+    {
 	WARN("Found %ld frames (/%ld)\n", numFrame, infoPtr->mah.dwTotalFrames);
 	return FALSE;
     }
-    if (insize > infoPtr->ash.dwSuggestedBufferSize) {
+    if (insize > infoPtr->ash.dwSuggestedBufferSize) 
+    {
 	WARN("insize=%ld suggestedSize=%ld\n", insize, infoPtr->ash.dwSuggestedBufferSize);
 	infoPtr->ash.dwSuggestedBufferSize = insize;
     }
 
     infoPtr->indata = HeapAlloc(GetProcessHeap(), 0, infoPtr->ash.dwSuggestedBufferSize);
-    if (!infoPtr->indata) {
+    if (!infoPtr->indata) 
+    {
 	WARN("Can't alloc input buffer\n");
 	return FALSE;
     }
@@ -645,7 +677,8 @@
 
     /* try to get a decompressor for that type */
     infoPtr->hic = fnIC.fnICOpen(ICTYPE_VIDEO, infoPtr->ash.fccHandler, ICMODE_DECOMPRESS);
-    if (!infoPtr->hic) {
+    if (!infoPtr->hic) 
+    {
 	WARN("Can't load codec for the file\n");
 	return FALSE;
     }
@@ -654,25 +687,29 @@
 			    (DWORD)infoPtr->inbih, 0L);
 
     infoPtr->outbih = HeapAlloc(GetProcessHeap(), 0, outSize);
-    if (!infoPtr->outbih) {
+    if (!infoPtr->outbih)
+    {
 	WARN("Can't alloc output BIH\n");
 	return FALSE;
     }
 
     if (fnIC.fnICSendMessage(infoPtr->hic, ICM_DECOMPRESS_GET_FORMAT,
-		      (DWORD)infoPtr->inbih, (DWORD)infoPtr->outbih) != outSize) {
+		      (DWORD)infoPtr->inbih, (DWORD)infoPtr->outbih) != outSize)
+    {
 	WARN("Can't get output BIH\n");
 	return FALSE;
     }
 
     infoPtr->outdata = HeapAlloc(GetProcessHeap(), 0, infoPtr->outbih->biSizeImage);
-    if (!infoPtr->outdata) {
+    if (!infoPtr->outdata)
+    {
 	WARN("Can't alloc output buffer\n");
 	return FALSE;
     }
 
     if (fnIC.fnICSendMessage(infoPtr->hic, ICM_DECOMPRESS_BEGIN,
-		      (DWORD)infoPtr->inbih, (DWORD)infoPtr->outbih) != ICERR_OK) {
+		      (DWORD)infoPtr->inbih, (DWORD)infoPtr->outbih) != ICERR_OK)
+    {
 	WARN("Can't begin decompression\n");
 	return FALSE;
     }
@@ -688,7 +725,8 @@
     ANIMATE_Free(infoPtr);
     infoPtr->hwndSelf = hWnd;
 
-    if (!lParam) {
+    if (!lParam)
+    {
 	TRACE("Closing avi!\n");
         /* installer of thebat! v1.62 requires FALSE here */
 	return (infoPtr->hMMio != 0);
@@ -697,44 +735,54 @@
     if (!hInstance)
        hInstance = (HINSTANCE)GetWindowLongPtrW(hWnd, GWLP_HINSTANCE);
 
-    if (HIWORD(lParam)) {
+    if (HIWORD(lParam))
+    {
 	TRACE("(\"%s\");\n", (LPSTR)lParam);
 
-	if (!ANIMATE_LoadResA(infoPtr, hInstance, (LPSTR)lParam)) {
+	if (!ANIMATE_LoadResA(infoPtr, hInstance, (LPSTR)lParam))
+	{
 	    TRACE("No AVI resource found!\n");
-	    if (!ANIMATE_LoadFileA(infoPtr, (LPSTR)lParam)) {
+	    if (!ANIMATE_LoadFileA(infoPtr, (LPSTR)lParam))
+	    {
 		WARN("No AVI file found!\n");
 		return FALSE;
 	    }
 	}
-    } else {
+    } 
+    else
+    {
 	TRACE("(%u);\n", (WORD)LOWORD(lParam));
 
 	if (!ANIMATE_LoadResA(infoPtr, hInstance,
-			      MAKEINTRESOURCEA((INT)lParam))) {
+			      MAKEINTRESOURCEA((INT)lParam)))
+	{
 	    WARN("No AVI resource found!\n");
 	    return FALSE;
 	}
     }
 
-    if (!ANIMATE_GetAviInfo(infoPtr)) {
+    if (!ANIMATE_GetAviInfo(infoPtr))
+    {
 	WARN("Can't get AVI information\n");
 	ANIMATE_Free(infoPtr);
 	return FALSE;
     }
 
-    if (!ANIMATE_GetAviCodec(infoPtr)) {
+    if (!ANIMATE_GetAviCodec(infoPtr))
+    {
 	WARN("Can't get AVI Codec\n");
 	ANIMATE_Free(infoPtr);
 	return FALSE;
     }
 
-    if (!GetWindowLongA(hWnd, GWL_STYLE) & ACS_CENTER) {
+    if (!GetWindowLongA(hWnd, GWL_STYLE) & ACS_CENTER)
+    {
 	SetWindowPos(hWnd, 0, 0, 0, infoPtr->mah.dwWidth, infoPtr->mah.dwHeight,
 		     SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOZORDER);
     }
 
-    if (GetWindowLongA(hWnd, GWL_STYLE) & ACS_AUTOPLAY) {
+    if (GetWindowLongA(hWnd, GWL_STYLE) & ACS_AUTOPLAY)
+    {
 	return ANIMATE_Play(hWnd, -1, (LPARAM)MAKELONG(0, infoPtr->mah.dwTotalFrames-1));
     }
 
@@ -779,7 +827,8 @@
 
     /* allocate memory for info structure */
     infoPtr = (ANIMATE_INFO *)Alloc(sizeof(ANIMATE_INFO));
-    if (!infoPtr) {
+    if (!infoPtr)
+    {
 	ERR("could not allocate info memory!\n");
 	return 0;
     }
@@ -835,7 +884,8 @@
 
 static LRESULT WINAPI ANIMATE_Size(HWND hWnd, WPARAM wParam, LPARAM lParam)
 {
-    if (GetWindowLongA(hWnd, GWL_STYLE) & ACS_CENTER) {
+    if (GetWindowLongA(hWnd, GWL_STYLE) & ACS_CENTER)
+    {
 	InvalidateRect(hWnd, NULL, TRUE);
     }
     return TRUE;
@@ -879,7 +929,7 @@
     case WM_TIMER:
     	if (GetWindowLongA(hWnd, GWL_STYLE) & ACS_TRANSPARENT)
         {
-            ANIMATE_INFO* infoPtr = ANIMATE_GetInfoPtr(hWnd);
+            ANIMATE_INFO *infoPtr = ANIMATE_GetInfoPtr(hWnd);
             infoPtr->hbrushBG = (HBRUSH)SendMessageA(infoPtr->hwndNotify,
 						     WM_CTLCOLORSTATIC,
 						     wParam, (LPARAM)hWnd);
@@ -888,7 +938,7 @@
 
     case WM_PAINT:
         {
-            ANIMATE_INFO* infoPtr = ANIMATE_GetInfoPtr(hWnd);
+            ANIMATE_INFO *infoPtr = ANIMATE_GetInfoPtr(hWnd);
 
             /* the animation isn't playing, or has not decompressed
              * (and displayed) the first frame yet, don't paint

-- 
Dimi.



More information about the wine-patches mailing list