changeset 34452:c3e63d8b6cf3

Reduce number and avoid conditional definition of searchpath variables.
author ib
date Tue, 10 Jan 2012 13:28:15 +0000
parents 19277315b8c6
children ad3519665533
files gui/win32/gui.c
diffstat 1 files changed, 9 insertions(+), 16 deletions(-) [+]
line wrap: on
line diff
--- a/gui/win32/gui.c	Tue Jan 10 12:04:50 2012 +0000
+++ b/gui/win32/gui.c	Tue Jan 10 13:28:15 2012 +0000
@@ -847,10 +847,6 @@
             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 @@
                 {
                     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)
+                        enable = 1;
+                    sprintf(searchpath, "%sMpegav", device + pos);
                     if(GetFileAttributes(searchpath) != INVALID_FILE_ATTRIBUTES)
-                        flags |= MF_ENABLED;
-                    else if(GetFileAttributes(searchpath2) != INVALID_FILE_ATTRIBUTES)
-                        flags |= MF_ENABLED;
+                        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;