[MPlayer-cvslog] r33899 - trunk/libvo/vo_directx.c

reimar subversion at mplayerhq.hu
Sun Jul 24 21:02:38 CEST 2011


Author: reimar
Date: Sun Jul 24 21:02:38 2011
New Revision: 33899

Log:
Make NULL checks simpler/more consistent.

Modified:
   trunk/libvo/vo_directx.c

Modified: trunk/libvo/vo_directx.c
==============================================================================
--- trunk/libvo/vo_directx.c	Sun Jul 24 20:21:15 2011	(r33898)
+++ trunk/libvo/vo_directx.c	Sun Jul 24 21:02:38 2011	(r33899)
@@ -308,25 +308,24 @@ static uint32_t Directx_CreateBackpuffer
 
 static void uninit(void)
 {
-    if (g_cc != NULL) {
+    if (g_cc)
         g_cc->lpVtbl->Release(g_cc);
-    }
     g_cc = NULL;
-    if (g_lpddclipper != NULL)
+    if (g_lpddclipper)
         g_lpddclipper->lpVtbl->Release(g_lpddclipper);
     g_lpddclipper = NULL;
     mp_msg(MSGT_VO, MSGL_DBG3, "<vo_directx><INFO>clipper released\n");
-    if (g_lpddsBack != NULL)
+    if (g_lpddsBack)
         g_lpddsBack->lpVtbl->Release(g_lpddsBack);
     g_lpddsBack = NULL;
     mp_msg(MSGT_VO, MSGL_DBG3, "<vo_directx><INFO>back surface released\n");
     if (vo_doublebuffering && !nooverlay) {
-        if (g_lpddsOverlay != NULL)
+        if (g_lpddsOverlay)
             g_lpddsOverlay->lpVtbl->Release(g_lpddsOverlay);
         g_lpddsOverlay = NULL;
         mp_msg(MSGT_VO, MSGL_DBG3, "<vo_directx><INFO>overlay surface released\n");
     }
-    if (g_lpddsPrimary != NULL)
+    if (g_lpddsPrimary)
         g_lpddsPrimary->lpVtbl->Release(g_lpddsPrimary);
     g_lpddsPrimary = NULL;
     mp_msg(MSGT_VO, MSGL_DBG3, "<vo_directx><INFO>primary released\n");
@@ -334,7 +333,7 @@ static void uninit(void)
         DeleteObject(colorbrush);
     colorbrush = NULL;
     mp_msg(MSGT_VO, MSGL_DBG3, "<vo_directx><INFO>GDI resources deleted\n");
-    if (g_lpdd != NULL) {
+    if (g_lpdd) {
         if (vidmode)
             g_lpdd->lpVtbl->RestoreDisplayMode(g_lpdd);
         g_lpdd->lpVtbl->Release(g_lpdd);
@@ -382,7 +381,7 @@ static uint32_t Directx_InitDirectDraw(v
 
     //load direct draw DLL: based on videolans code
     hddraw_dll = LoadLibrary("DDRAW.DLL");
-    if (hddraw_dll == NULL) {
+    if (!hddraw_dll) {
         mp_msg(MSGT_VO, MSGL_FATAL, "<vo_directx><FATAL ERROR>failed loading ddraw.dll\n");
         return 1;
     }
@@ -405,7 +404,7 @@ static uint32_t Directx_InitDirectDraw(v
     }
 
     OurDirectDrawCreateEx = (void *)GetProcAddress(hddraw_dll, "DirectDrawCreateEx");
-    if (OurDirectDrawCreateEx == NULL) {
+    if (!OurDirectDrawCreateEx) {
         FreeLibrary(hddraw_dll);
         hddraw_dll = NULL;
         mp_msg(MSGT_VO, MSGL_FATAL, "<vo_directx><FATAL ERROR>failed geting proc address: DirectDrawCreateEx\n");
@@ -702,7 +701,7 @@ static uint32_t Directx_CheckOverlayPixe
             formatcount++;
         } else
             mp_msg(MSGT_VO, MSGL_V, "<vo_directx><FORMAT OVERLAY>%i %s not supported\n", i, g_ddpf[i].img_format_name);
-        if (g_lpddsOverlay != NULL) {
+        if (g_lpddsOverlay) {
             g_lpddsOverlay->lpVtbl->Release(g_lpddsOverlay);
             g_lpddsOverlay = NULL;
         }
@@ -988,20 +987,20 @@ static int config(uint32_t width, uint32
         nooverlay = 0;
 
     /*release all directx objects*/
-    if (g_cc != NULL)
+    if (g_cc)
         g_cc->lpVtbl->Release(g_cc);
     g_cc = NULL;
     if (g_lpddclipper)
         g_lpddclipper->lpVtbl->Release(g_lpddclipper);
     g_lpddclipper = NULL;
-    if (g_lpddsBack != NULL)
+    if (g_lpddsBack)
         g_lpddsBack->lpVtbl->Release(g_lpddsBack);
     g_lpddsBack = NULL;
     if (vo_doublebuffering)
-        if (g_lpddsOverlay != NULL)
+        if (g_lpddsOverlay)
             g_lpddsOverlay->lpVtbl->Release(g_lpddsOverlay);
     g_lpddsOverlay = NULL;
-    if (g_lpddsPrimary != NULL)
+    if (g_lpddsPrimary)
         g_lpddsPrimary->lpVtbl->Release(g_lpddsPrimary);
     g_lpddsPrimary = NULL;
     mp_msg(MSGT_VO, MSGL_DBG3, "<vo_directx><INFO>overlay surfaces released\n");


More information about the MPlayer-cvslog mailing list