[MPlayer-cvslog] r33839 - in trunk/gui: cfg.c cfg.h ui/gtk/fileselect.c

ib subversion at mplayerhq.hu
Thu Jul 7 16:47:49 CEST 2011


Author: ib
Date: Thu Jul  7 16:47:48 2011
New Revision: 33839

Log:
Replace numeric constant fsPersistant_MaxPos for fsHistory array size.

Use macro FF_ARRAY_ELEMS() instead.

Additionally, use unsigned index variable
for comparison with array size.

Modified:
   trunk/gui/cfg.c
   trunk/gui/cfg.h
   trunk/gui/ui/gtk/fileselect.c

Modified: trunk/gui/cfg.c
==============================================================================
--- trunk/gui/cfg.c	Thu Jul  7 16:35:31 2011	(r33838)
+++ trunk/gui/cfg.c	Thu Jul  7 16:47:48 2011	(r33839)
@@ -103,7 +103,7 @@ int guiWinID = -1;
 
 char *skinName;
 
-char *fsHistory[fsPersistant_MaxPos];
+char *fsHistory[5];
 
 static const m_option_t gui_opts[] = {
     { "cache",                       &gtkCacheOn,              CONF_TYPE_FLAG,        0,           0,     1,       NULL },

Modified: trunk/gui/cfg.h
==============================================================================
--- trunk/gui/cfg.h	Thu Jul  7 16:35:31 2011	(r33838)
+++ trunk/gui/cfg.h	Thu Jul  7 16:47:48 2011	(r33839)
@@ -87,8 +87,7 @@ extern int guiWinID;
 
 extern char *skinName;
 
-#define fsPersistant_MaxPos 5
-extern char *fsHistory[fsPersistant_MaxPos];
+extern char *fsHistory[5];
 
 int cfg_gui_include(m_option_t *conf, const char *filename);
 int cfg_read(void);

Modified: trunk/gui/ui/gtk/fileselect.c
==============================================================================
--- trunk/gui/ui/gtk/fileselect.c	Thu Jul  7 16:35:31 2011	(r33838)
+++ trunk/gui/ui/gtk/fileselect.c	Thu Jul  7 16:47:48 2011	(r33839)
@@ -37,6 +37,7 @@
 #include "help_mp.h"
 #include "mpcommon.h"
 #include "stream/stream.h"
+#include "libavutil/common.h"
 
 #include "gui/ui/widgets.h"
 #include "fileselect.h"
@@ -332,11 +333,11 @@ void ShowFileSelect( int type,int modal 
 
  if ( fsTopList_items ) g_list_free( fsTopList_items ); fsTopList_items=NULL;
  {
-  int  i, c = 1;
+  unsigned int  i, c = 1;
 
   if ( fsType == fsVideoSelector )
    {
-    for ( i=0;i < fsPersistant_MaxPos;i++ )
+    for ( i=0;i < FF_ARRAY_ELEMS(fsHistory);i++ )
      if ( fsHistory[i] ) { fsTopList_items=g_list_append( fsTopList_items,fsHistory[i] ); c=0; }
    }
   if ( c ) fsTopList_items=g_list_append( fsTopList_items,(gchar *)get_current_dir_name_utf8() );
@@ -362,18 +363,18 @@ void HideFileSelect( void )
 
 static void fs_PersistantHistory( char * subject )
 {
- int i;
+ unsigned int i;
 
  if ( fsType != fsVideoSelector ) return;
 
- for ( i=0;i < fsPersistant_MaxPos;i++ )
+ for ( i=0;i < FF_ARRAY_ELEMS(fsHistory);i++ )
   if ( fsHistory[i] && !strcmp( fsHistory[i],subject ) )
    {
     char * tmp = fsHistory[i]; fsHistory[i]=fsHistory[0]; fsHistory[0]=tmp;
     return;
    }
- nfree( fsHistory[fsPersistant_MaxPos - 1] );
- for ( i=fsPersistant_MaxPos - 1;i;i-- ) fsHistory[i]=fsHistory[i - 1];
+ nfree( fsHistory[FF_ARRAY_ELEMS(fsHistory) - 1] );
+ for ( i=FF_ARRAY_ELEMS(fsHistory) - 1;i;i-- ) fsHistory[i]=fsHistory[i - 1];
  fsHistory[0]=gstrdup( subject );
 }
 //-----------------------------------------------


More information about the MPlayer-cvslog mailing list