[MPlayer-cvslog] r34540 - trunk/gui/win32/gui.c

ib subversion at mplayerhq.hu
Tue Jan 10 14:28:15 CET 2012


Author: ib
Date: Tue Jan 10 14:28:15 2012
New Revision: 34540

Log:
Reduce number and avoid conditional definition of searchpath variables.

Modified:
   trunk/gui/win32/gui.c

Modified: trunk/gui/win32/gui.c
==============================================================================
--- trunk/gui/win32/gui.c	Tue Jan 10 13:04:50 2012	(r34539)
+++ trunk/gui/win32/gui.c	Tue Jan 10 14:28:15 2012	(r34540)
@@ -847,10 +847,6 @@ static LRESULT CALLBACK EventProc(HWND h
             POINT point;
             char device[MAX_PATH];
             char searchpath[MAX_PATH];
-            char searchpath2[MAX_PATH];
-#ifdef CONFIG_CDDA
-            char searchpath3[MAX_PATH];
-#endif
             int len, pos = 0, cdromdrive = 0;
             UINT errmode;
             point.x = GET_X_LPARAM(lParam);
@@ -866,23 +862,20 @@ static LRESULT CALLBACK EventProc(HWND h
                 {
                     char volname[MAX_PATH];
                     char menuitem[MAX_PATH];
-                    int flags = MF_STRING;
+                    int flags = MF_STRING, enable = 0;
                     mp_msg(MSGT_GPLAYER, MSGL_V, "[GUI] checking %s for CD/VCD/SVCD/DVDs\n", device + pos);
                     sprintf(searchpath, "%sVIDEO_TS", device + pos);
-                    sprintf(searchpath2, "%sMpegav", device + pos);
-#ifdef CONFIG_CDDA
-                    sprintf(searchpath3, "%sTrack01.cda", device + pos);
-#endif
                     if(GetFileAttributes(searchpath) != INVALID_FILE_ATTRIBUTES)
-                        flags |= MF_ENABLED;
-                    else if(GetFileAttributes(searchpath2) != INVALID_FILE_ATTRIBUTES)
-                        flags |= MF_ENABLED;
+                        enable = 1;
+                    sprintf(searchpath, "%sMpegav", device + pos);
+                    if(GetFileAttributes(searchpath) != INVALID_FILE_ATTRIBUTES)
+                        enable = 1;
 #ifdef CONFIG_CDDA
-                    else if(GetFileAttributes(searchpath3) != INVALID_FILE_ATTRIBUTES)
-                        flags |= MF_ENABLED;
+                    sprintf(searchpath, "%sTrack01.cda", device + pos);
+                    if(GetFileAttributes(searchpath) != INVALID_FILE_ATTRIBUTES)
+                        enable = 1;
 #endif
-                    else
-                        flags |= MF_GRAYED;
+                    flags |= (enable ? MF_ENABLED : MF_GRAYED);
                     volname[0] = 0;
                     strcpy(menuitem, device + pos);
                     menuitem[strlen(menuitem) - 1]=0;


More information about the MPlayer-cvslog mailing list