changeset 19081:273bdef43012

Mark several string parameters that are not modified in the function as const. patch by Stefan Huehner, stefan at huehner org
author diego
date Fri, 14 Jul 2006 16:57:24 +0000
parents 6ff62e005cba
children a2f20562aac3
files Gui/interface.c Gui/interface.h Gui/mplayer/gtk/common.c Gui/mplayer/gtk/common.h Gui/mplayer/gtk/mb.c Gui/mplayer/gtk/mb.h Gui/mplayer/gtk/menu.c Gui/mplayer/gtk/menu.h Gui/mplayer/widgets.c Gui/mplayer/widgets.h
diffstat 10 files changed, 29 insertions(+), 29 deletions(-) [+]
line wrap: on
line diff
--- a/Gui/interface.c	Fri Jul 14 15:12:05 2006 +0000
+++ b/Gui/interface.c	Fri Jul 14 16:57:24 2006 +0000
@@ -54,7 +54,7 @@
 guiInterface_t guiIntfStruct;
 int guiWinID=-1;
 
-char * gstrcat( char ** dest,char * src )
+char * gstrcat( char ** dest,const char * src )
 {
  char * tmp = NULL;
 
@@ -75,21 +75,21 @@
  return tmp;
 }
 
-int gstrcmp( char * a,char * b )
+int gstrcmp( const char * a,const char * b )
 {
  if ( !a && !b ) return 0;
  if ( !a || !b ) return -1;
  return strcmp( a,b );
 }
 
-int gstrncmp( char * a,char * b,int size )
+int gstrncmp( const char * a,const char * b,int size )
 {
  if ( !a && !b ) return 0;
  if ( !a || !b ) return -1;
  return strncmp( a,b,size );
 }
 
-char * gstrdup( char * str )
+char * gstrdup( const char * str )
 {
  if ( !str ) return NULL;
  return strdup( str );
@@ -107,7 +107,7 @@
  free( *p ); *p=NULL;
 }
 
-void gset( char ** str,char * what )
+void gset( char ** str, const char * what )
 {
  if ( *str ) { if ( !strstr( *str,what ) ) { gstrcat( str,"," ); gstrcat( str,what ); }}
    else gstrcat( str,what );
@@ -116,7 +116,7 @@
 /**
  * \brief this actually creates a new list containing only one element...
  */
-void gaddlist( char *** list,char * entry )
+void gaddlist( char *** list,const char * entry )
 {
  int i;
 
@@ -135,7 +135,7 @@
  * \brief this replaces a string starting with search by replace.
  * If not found, replace is appended.
  */
-void greplace(char ***list, char *search, char *replace)
+void greplace(char ***list, const char *search, const char *replace)
 {
  int i = 0;
  int len = (search) ? strlen(search) : 0;
--- a/Gui/interface.h	Fri Jul 14 15:12:05 2006 +0000
+++ b/Gui/interface.h	Fri Jul 14 16:57:24 2006 +0000
@@ -208,10 +208,10 @@
 extern void * gtkSet( int cmd,float param, void * vparam );
 
 extern char * gconvert_uri_to_filename( char * str );
-extern char * gstrdup( char * str );
-extern int    gstrcmp( char * a,char * b );
+extern char * gstrdup( const char * str );
+extern int    gstrcmp( const char * a,const char * b );
 extern void   gfree( void ** p );
-extern void   gaddlist( char *** list,char * entry );
+extern void   gaddlist( char *** list,const char * entry );
 extern char * gstrchr( char * str,int c );
 
 #define guiSetFilename( s,n ) { gfree( (void **)&s ); s=gstrdup( n ); }
--- a/Gui/mplayer/gtk/common.c	Fri Jul 14 15:12:05 2006 +0000
+++ b/Gui/mplayer/gtk/common.c	Fri Jul 14 16:57:24 2006 +0000
@@ -23,7 +23,7 @@
  return frame;
 }
 
-GtkWidget * AddFrame( char * title,int type,GtkWidget * parent,int add )
+GtkWidget * AddFrame( const char * title,int type,GtkWidget * parent,int add )
 {
  GtkWidget * frame = NULL;
  frame=gtk_frame_new( title );
@@ -36,7 +36,7 @@
  return frame;
 }
 
-GtkWidget * AddLabel( char * title,GtkWidget * parent )
+GtkWidget * AddLabel( const char * title,GtkWidget * parent )
 {
  GtkWidget * label;
  label=gtk_label_new( title );
@@ -76,7 +76,7 @@
  return hbox;
 }
 
-GtkWidget * AddCheckButton( char * title, GtkWidget * parent )
+GtkWidget * AddCheckButton( const char * title, GtkWidget * parent )
 {
  GtkWidget * CB;
  CB=gtk_check_button_new_with_label( title );
@@ -86,7 +86,7 @@
  return CB;
 }
 
-GtkWidget * AddRadioButton( char * title,GSList ** group,GtkWidget * parent )
+GtkWidget * AddRadioButton( const char * title,GSList ** group,GtkWidget * parent )
 {
  GtkWidget * RB;
  RB=gtk_radio_button_new_with_label( *group,title );
@@ -97,7 +97,7 @@
  return RB;
 }
 
-GtkWidget * AddButton( char * title,GtkWidget * parent )
+GtkWidget * AddButton( const char * title,GtkWidget * parent )
 {
  GtkWidget * B;
  B=gtk_button_new_with_label( title );
--- a/Gui/mplayer/gtk/common.h	Fri Jul 14 15:12:05 2006 +0000
+++ b/Gui/mplayer/gtk/common.h	Fri Jul 14 16:57:24 2006 +0000
@@ -6,13 +6,13 @@
 #include <gtk/gtk.h>
 
 extern GtkWidget * AddDialogFrame( GtkWidget * parent );
-extern GtkWidget * AddFrame( char * title,int type,GtkWidget * parent,int add );
-extern GtkWidget * AddLabel( char * title,GtkWidget * parent );
+extern GtkWidget * AddFrame( const char * title,int type,GtkWidget * parent,int add );
+extern GtkWidget * AddLabel( const char * title,GtkWidget * parent );
 extern GtkWidget * AddVBox( GtkWidget * parent,int type );
 extern GtkWidget * AddHBox( GtkWidget * parent,int type );
-extern GtkWidget * AddCheckButton( char * title, GtkWidget * parent );
-extern GtkWidget * AddRadioButton( char * title,GSList ** group,GtkWidget * parent );
-extern GtkWidget * AddButton( char * title,GtkWidget * parent );
+extern GtkWidget * AddCheckButton( const char * title, GtkWidget * parent );
+extern GtkWidget * AddRadioButton( const char * title,GSList ** group,GtkWidget * parent );
+extern GtkWidget * AddButton( const char * title,GtkWidget * parent );
 extern GtkWidget * AddHSeparator( GtkWidget * parent );
 extern GtkWidget * AddHButtonBox( GtkWidget * parent );
 extern GtkWidget * AddHScaler( GtkAdjustment * adj,GtkWidget * parent,int digit );
--- a/Gui/mplayer/gtk/mb.c	Fri Jul 14 15:12:05 2006 +0000
+++ b/Gui/mplayer/gtk/mb.c	Fri Jul 14 16:57:24 2006 +0000
@@ -13,7 +13,7 @@
 GtkWidget * gtkMessageBoxText;
 GtkWidget * MessageBox = NULL;
 
-void ShowMessageBox( char * msg )
+void ShowMessageBox( const char * msg )
 {
  if ( MessageBox ) { gtk_widget_hide( MessageBox ); gtk_widget_destroy( MessageBox ); }
  MessageBox=create_MessageBox( 0 );
--- a/Gui/mplayer/gtk/mb.h	Fri Jul 14 15:12:05 2006 +0000
+++ b/Gui/mplayer/gtk/mb.h	Fri Jul 14 16:57:24 2006 +0000
@@ -8,6 +8,6 @@
 extern GtkWidget * MessageBox;
 
 extern GtkWidget * create_MessageBox( int type );
-extern void ShowMessageBox( char * msg );
+extern void ShowMessageBox( const char * msg );
 
 #endif
--- a/Gui/mplayer/gtk/menu.c	Fri Jul 14 15:12:05 2006 +0000
+++ b/Gui/mplayer/gtk/menu.c	Fri Jul 14 16:57:24 2006 +0000
@@ -70,7 +70,7 @@
  mplEventHandling( Item & 0x0000ffff,Item >> 16 );
 }
 
-GtkWidget * AddMenuCheckItem(GtkWidget *window1, const char * immagine_xpm, GtkWidget* Menu,char* label, gboolean state, int Number)
+static GtkWidget * AddMenuCheckItem(GtkWidget *window1, const char * immagine_xpm, GtkWidget* Menu,const char* label, gboolean state, int Number)
 {
  GtkWidget * Label = NULL;
  GtkWidget * Pixmap = NULL;
@@ -103,7 +103,7 @@
    
  return Item;
 }
-GtkWidget * AddMenuItem( GtkWidget *window1, const char * immagine_xpm,  GtkWidget * SubMenu,char * label,int Number )
+GtkWidget * AddMenuItem( GtkWidget *window1, const char * immagine_xpm,  GtkWidget * SubMenu,const char * label,int Number )
 {
  GtkWidget * Label = NULL;
  GtkWidget * Pixmap = NULL;
@@ -136,7 +136,7 @@
 }
 
 
-GtkWidget * AddSubMenu( GtkWidget *window1, const char * immagine_xpm, GtkWidget * Menu,char * label )
+GtkWidget * AddSubMenu( GtkWidget *window1, const char * immagine_xpm, GtkWidget * Menu,const char * label )
 {
  GtkWidget * Label = NULL;
  GtkWidget * Pixmap = NULL;
--- a/Gui/mplayer/gtk/menu.h	Fri Jul 14 15:12:05 2006 +0000
+++ b/Gui/mplayer/gtk/menu.h	Fri Jul 14 16:57:24 2006 +0000
@@ -5,8 +5,8 @@
 
 extern GtkWidget * DVDSubMenu;
 
-extern GtkWidget * AddMenuItem( GtkWidget *window1, const char * immagine_xpm,  GtkWidget * SubMenu,char * label,int Number );
-extern GtkWidget * AddSubMenu( GtkWidget *window1, const char * immagine_xpm, GtkWidget * Menu,char * label );
+extern GtkWidget * AddMenuItem( GtkWidget *window1, const char * immagine_xpm,  GtkWidget * SubMenu,const char * label,int Number );
+extern GtkWidget * AddSubMenu( GtkWidget *window1, const char * immagine_xpm, GtkWidget * Menu,const char * label );
 extern GtkWidget * AddSeparator( GtkWidget * Menu );
 extern GtkWidget * create_PopUpMenu( void );
 
--- a/Gui/mplayer/widgets.c	Fri Jul 14 15:12:05 2006 +0000
+++ b/Gui/mplayer/widgets.c	Fri Jul 14 16:57:24 2006 +0000
@@ -112,7 +112,7 @@
 
 // --- funcs
 
-void gtkMessageBox( int type,gchar * str )
+void gtkMessageBox( int type,const gchar * str )
 {
  if ( !gtkInited ) return;
  ShowMessageBox( str );
--- a/Gui/mplayer/widgets.h	Fri Jul 14 15:12:05 2006 +0000
+++ b/Gui/mplayer/widgets.h	Fri Jul 14 16:57:24 2006 +0000
@@ -54,7 +54,7 @@
 extern void gtkEventHandling( void );
 
 extern void gtkShow( int type,char * param );
-extern void gtkMessageBox( int type,gchar * str );
+extern void gtkMessageBox( int type,const gchar * str );
 extern void gtkSetLayer( GtkWidget * wdg );
 extern void gtkActive( GtkWidget * wdg );