[MPlayer-cvslog] r35615 - in trunk/gui: cfg.c cfg.h ui/gtk/fileselect.c ui/main.c win32/dialogs.c win32/gui.c win32/gui.h win32/interface.c

ib subversion at mplayerhq.hu
Thu Dec 6 00:28:15 CET 2012


Author: ib
Date: Thu Dec  6 00:28:14 2012
New Revision: 35615

Log:
Avoid using local variables named filename.

This is the name of a global MPlayer variable.
Avoiding it avoids confusion.

Modified:
   trunk/gui/cfg.c
   trunk/gui/cfg.h
   trunk/gui/ui/gtk/fileselect.c
   trunk/gui/ui/main.c
   trunk/gui/win32/dialogs.c
   trunk/gui/win32/gui.c
   trunk/gui/win32/gui.h
   trunk/gui/win32/interface.c

Modified: trunk/gui/cfg.c
==============================================================================
--- trunk/gui/cfg.c	Thu Dec  6 00:12:53 2012	(r35614)
+++ trunk/gui/cfg.c	Thu Dec  6 00:28:14 2012	(r35615)
@@ -233,11 +233,11 @@ static const m_option_t gui_opts[] = {
     { NULL,                          NULL,                     0,                     0,           0,     0,          NULL }
 };
 
-int cfg_gui_include(m_option_t *conf, const char *filename)
+int cfg_gui_include(m_option_t *conf, const char *file)
 {
     (void)conf;
 
-    return m_config_parse_config_file(gui_conf, filename, 0);
+    return m_config_parse_config_file(gui_conf, file, 0);
 }
 
 void cfg_read(void)

Modified: trunk/gui/cfg.h
==============================================================================
--- trunk/gui/cfg.h	Thu Dec  6 00:12:53 2012	(r35614)
+++ trunk/gui/cfg.h	Thu Dec  6 00:28:14 2012	(r35615)
@@ -89,7 +89,7 @@ extern char *skinName;
 
 extern char *fsHistory[5];
 
-int cfg_gui_include(m_option_t *conf, const char *filename);
+int cfg_gui_include(m_option_t *conf, const char *file);
 void cfg_read(void);
 void cfg_write(void);
 

Modified: trunk/gui/ui/gtk/fileselect.c
==============================================================================
--- trunk/gui/ui/gtk/fileselect.c	Thu Dec  6 00:12:53 2012	(r35614)
+++ trunk/gui/ui/gtk/fileselect.c	Thu Dec  6 00:28:14 2012	(r35615)
@@ -172,13 +172,13 @@ static char * get_current_dir_name_utf8(
 static void clist_append_fname(GtkWidget * list, char *fname,
                                GdkPixmap *pixmap, GdkPixmap *mask) {
   gint pos;
-  gchar *filename, *str[2];
-  filename = g_filename_to_utf8(fname, -1, NULL, NULL, NULL);
+  gchar *filename_utf8, *str[2];
+  filename_utf8 = g_filename_to_utf8(fname, -1, NULL, NULL, NULL);
   str[0] = NULL;
-  str[1] = filename ? filename : fname;
+  str[1] = filename_utf8 ? filename_utf8 : fname;
   pos = gtk_clist_append(GTK_CLIST(list), str);
   gtk_clist_set_pixmap(GTK_CLIST(list), pos, 0, pixmap, mask);
-  g_free(filename);
+  g_free(filename_utf8);
 }
 
 static void CheckDir( GtkWidget * list )

Modified: trunk/gui/ui/main.c
==============================================================================
--- trunk/gui/ui/main.c	Thu Dec  6 00:12:53 2012	(r35614)
+++ trunk/gui/ui/main.c	Thu Dec  6 00:28:14 2012	(r35615)
@@ -591,7 +591,7 @@ void uiDandDHandler(int num,char** files
   int f = 0;
 
   char* subtitles = NULL;
-  char* filename = NULL;
+  char* file = NULL;
   char* s;
 
   if (num <= 0)
@@ -627,8 +627,8 @@ void uiDandDHandler(int num,char** files
       }
 
       /* clear playlist */
-      if (filename == NULL) {
-	filename = files[f];
+      if (file == NULL) {
+	file = files[f];
 	listMgr(PLAYLIST_DELETE,0);
       }
 
@@ -654,8 +654,8 @@ void uiDandDHandler(int num,char** files
     free( str );
   }
 
-  if (filename) {
-    uiSetFile( NULL,filename,STREAMTYPE_FILE );
+  if (file) {
+    uiSetFile( NULL,file,STREAMTYPE_FILE );
     if ( guiInfo.Playing == GUI_PLAY ) uiEventHandling( evStop,0 );
     uiEventHandling( evPlay,0 );
   }

Modified: trunk/gui/win32/dialogs.c
==============================================================================
--- trunk/gui/win32/dialogs.c	Thu Dec  6 00:12:53 2012	(r35614)
+++ trunk/gui/win32/dialogs.c	Thu Dec  6 00:28:14 2012	(r35615)
@@ -90,7 +90,7 @@ int display_openfilewindow(gui_t *gui, i
     OPENFILENAME fileopen;
     int result = 0;
     char filelist[MAXFILE];
-    char filename[MAX_PATH];
+    char file[MAX_PATH];
     char directory[MAX_PATH];
     char *filespec = NULL;
     char *filepart = NULL;
@@ -127,24 +127,24 @@ int display_openfilewindow(gui_t *gui, i
         do
         {
             filespec = &fileopen.lpstrFile[fileopen.nFileOffset];
-            strcpy(filename, directory);
+            strcpy(file, directory);
 
             if (*filespec)
             {
-                strcat(filename, "/");
-                strcat(filename, filespec);
+                strcat(file, "/");
+                strcat(file, filespec);
             }
 
-            if (GetFileAttributes(filename) & FILE_ATTRIBUTE_DIRECTORY)
-                mp_msg(MSGT_GPLAYER, MSGL_V, "[GUI] %s is a directory, skipping...\n", filename);
+            if (GetFileAttributes(file) & FILE_ATTRIBUTE_DIRECTORY)
+                mp_msg(MSGT_GPLAYER, MSGL_V, "[GUI] %s is a directory, skipping...\n", file);
             else
             {
-                if (GetFullPathName(filename, MAX_PATH, filename, &filepart))
+                if (GetFullPathName(file, MAX_PATH, file, &filepart))
                 {
-                    uiSetFile(NULL, filename, STREAMTYPE_FILE);
-                    if(!parse_filename(filename, playtree, mconfig, 0))
-                        gui->playlist->add_track(gui->playlist, filename, NULL, filepart, 0);
-                    mp_msg(MSGT_GPLAYER, MSGL_V, "[GUI] Adding file: %s - path %s\n", filespec, filename);
+                    uiSetFile(NULL, file, STREAMTYPE_FILE);
+                    if(!parse_filename(file, playtree, mconfig, 0))
+                        gui->playlist->add_track(gui->playlist, file, NULL, filepart, 0);
+                    mp_msg(MSGT_GPLAYER, MSGL_V, "[GUI] Adding file: %s - path %s\n", filespec, file);
                     result++;
                 }
             }

Modified: trunk/gui/win32/gui.c
==============================================================================
--- trunk/gui/win32/gui.c	Thu Dec  6 00:12:53 2012	(r35614)
+++ trunk/gui/win32/gui.c	Thu Dec  6 00:28:14 2012	(r35615)
@@ -166,21 +166,21 @@ static void console_toggle(gui_t *gui)
     }
 }
 
-void capitalize(char *filename)
+void capitalize(char *fname)
 {
     unsigned int i;
     BOOL cap = TRUE;
-    for (i=0; i < strlen(filename); i++)
+    for (i=0; i < strlen(fname); i++)
     {
         if (cap)
         {
             cap = FALSE;
-            filename[i] = toupper(filename[i]);
+            fname[i] = toupper(fname[i]);
         }
-        else if (filename[i] == ' ')
+        else if (fname[i] == ' ')
             cap = TRUE;
         else
-            filename[i] = tolower(filename[i]);
+            fname[i] = tolower(fname[i]);
     }
 }
 static void display_about_box(HWND hWnd)
@@ -1040,7 +1040,7 @@ static LRESULT CALLBACK EventProc(HWND h
             {
                 char device[MAX_PATH];
                 char searchpath[MAX_PATH];
-                char filename[MAX_PATH];
+                char file[MAX_PATH];
                 int len, pos = 0, cdromdrive = 0;
                 len = GetLogicalDriveStrings(MAX_PATH, device);
                 while(pos < len)
@@ -1074,8 +1074,8 @@ static LRESULT CALLBACK EventProc(HWND h
                                     gui->playlist->clear_playlist(gui->playlist);
                                     do
                                     {
-                                        sprintf(filename, "%smpegav/%s", device + pos, finddata.cFileName);
-                                        gui->playlist->add_track(gui->playlist, filename, NULL, NULL, 0);
+                                        sprintf(file, "%smpegav/%s", device + pos, finddata.cFileName);
+                                        gui->playlist->add_track(gui->playlist, file, NULL, NULL, 0);
                                     }
                                     while(FindNextFile(searchhndl, &finddata));
                                     FindClose(searchhndl);

Modified: trunk/gui/win32/gui.h
==============================================================================
--- trunk/gui/win32/gui.h	Thu Dec  6 00:12:53 2012	(r35614)
+++ trunk/gui/win32/gui.h	Thu Dec  6 00:28:14 2012	(r35615)
@@ -102,7 +102,7 @@ int destroy_window(gui_t *gui);
 int create_window(gui_t *gui, char *skindir);
 int create_videowindow(gui_t *gui);
 int parse_filename(char *file, play_tree_t *playtree, m_config_t *mconfig, int clear);
-void capitalize(char *filename);
+void capitalize(char *fname);
 LPSTR acp(LPCSTR utf8);
 
 void renderinfobox(skin_t *skin, window_priv_t *priv);

Modified: trunk/gui/win32/interface.c
==============================================================================
--- trunk/gui/win32/interface.c	Thu Dec  6 00:12:53 2012	(r35614)
+++ trunk/gui/win32/interface.c	Thu Dec  6 00:28:14 2012	(r35615)
@@ -95,16 +95,16 @@ mixer_t *mixer = NULL;
  *
  * @return pointer to the converted file path
  */
-static char *unix_name (char *filename)
+static char *unix_name (char *win_filename)
 {
     static char *unix_filename;
     LPSTR (*CDECL wine_get_unix_file_name_ptr)(LPCWSTR);
     int wchar_conv;
 
-    if (*filename && (filename[1] == ':'))
+    if (*win_filename && (win_filename[1] == ':'))
     {
         wine_get_unix_file_name_ptr = (void *) GetProcAddress(GetModuleHandleA("KERNEL32"), "wine_get_unix_file_name");
-        wchar_conv = MultiByteToWideChar(CP_UNIXCP, 0, filename, -1, NULL, 0);
+        wchar_conv = MultiByteToWideChar(CP_UNIXCP, 0, win_filename, -1, NULL, 0);
 
         if (wine_get_unix_file_name_ptr && wchar_conv)
         {
@@ -112,16 +112,16 @@ static char *unix_name (char *filename)
             char *unix_name;
 
             ntpath = HeapAlloc(GetProcessHeap(), 0, sizeof(*ntpath) * (wchar_conv + 1));
-            MultiByteToWideChar(CP_UNIXCP, 0, filename, -1, ntpath, wchar_conv);
+            MultiByteToWideChar(CP_UNIXCP, 0, win_filename, -1, ntpath, wchar_conv);
             unix_name = wine_get_unix_file_name_ptr(ntpath);
             setdup(&unix_filename, unix_name);
-            filename = unix_filename;
+            win_filename = unix_filename;
             HeapFree(GetProcessHeap(), 0, unix_name);
             HeapFree(GetProcessHeap(), 0, ntpath);
         }
     }
 
-    return filename;
+    return win_filename;
 }
 
 /**
@@ -818,8 +818,8 @@ int gui(int what, void *data)
 /* This function adds/inserts one file into the gui playlist */
 static int import_file_into_gui(char *pathname, int insert)
 {
-    char filename[MAX_PATH];
-    char *filepart = filename;
+    char file[MAX_PATH];
+    char *filepart = file;
 
     if (strstr(pathname, "://"))
     {
@@ -827,16 +827,16 @@ static int import_file_into_gui(char *pa
         mygui->playlist->add_track(mygui->playlist, pathname, NULL, NULL, 0);
         return 1;
     }
-    if (GetFullPathName(pathname, MAX_PATH, filename, &filepart))
+    if (GetFullPathName(pathname, MAX_PATH, file, &filepart))
     {
-        if (!(GetFileAttributes(filename) & FILE_ATTRIBUTE_DIRECTORY))
+        if (!(GetFileAttributes(file) & FILE_ATTRIBUTE_DIRECTORY))
         {
-            mp_msg(MSGT_GPLAYER, MSGL_V, "[GUI] Adding filename: %s - fullpath: %s\n", filepart, filename);
-            mygui->playlist->add_track(mygui->playlist, filename, NULL, filepart, 0);
+            mp_msg(MSGT_GPLAYER, MSGL_V, "[GUI] Adding filename: %s - fullpath: %s\n", filepart, file);
+            mygui->playlist->add_track(mygui->playlist, file, NULL, filepart, 0);
             return 1;
         }
         else
-            mp_msg(MSGT_GPLAYER, MSGL_V, "[GUI] Cannot add %s\n", filename);
+            mp_msg(MSGT_GPLAYER, MSGL_V, "[GUI] Cannot add %s\n", file);
     }
 
     return 0;


More information about the MPlayer-cvslog mailing list