[MPlayer-dev-eng] [patch] more const parameters

Stefan Huehner stefan at huehner.org
Sun Jul 9 16:46:33 CEST 2006


Hi,                                                                             
                                                                                
attached paths marks several string parameters as const, when they are          
not modified in the function.

Regards,
Stefan

-------------- next part --------------
diff -u asxparser.c asxparser.c
--- asxparser.c	(working copy)
+++ asxparser.c	(working copy)
@@ -80,7 +80,7 @@
 /////// Attribs utils
 
 char*
-asx_get_attrib(char* attrib,char** attribs) {
+asx_get_attrib(const char* attrib,char** attribs) {
   char** ptr;
 
   if(attrib == NULL || attribs == NULL) return NULL;
diff -u asxparser.h asxparser.h
--- asxparser.h	(working copy)
+++ asxparser.h	(working copy)
@@ -34,7 +34,7 @@
 /////// Attribs utils
 
 char*
-asx_get_attrib(char* attrib,char** attribs);
+asx_get_attrib(const char* attrib,char** attribs);
 
 int
 asx_attrib_to_enum(const char* val,char** valid_vals);
diff -u m_property.h m_property.h
--- m_property.h	(working copy)
+++ m_property.h	(working copy)
@@ -123,7 +123,7 @@
 m_option_t*  mp_property_find(const char* name);
 
 /// Do an action with an MPlayer property.
-int mp_property_do(char* name,int action, void* val);
+int mp_property_do(const char* name,int action, void* val);
 
 /// \defgroup PropertyImplHelper Property implementation helpers
 /// \ingroup Properties
diff -u mplayer.c mplayer.c
--- mplayer.c	(working copy)
+++ mplayer.c	(working copy)
@@ -519,7 +519,7 @@
   current_module=NULL;
 }
 
-static void exit_player_with_rc(char* how, int rc){
+static void exit_player_with_rc(const char* how, int rc){
 
   uninit_player(INITED_ALL);
 #ifdef HAVE_X11
@@ -554,7 +554,7 @@
   exit(rc);
 }
 
-void exit_player(char* how){
+void exit_player(const char* how){
   exit_player_with_rc(how, 1);
 }
 
@@ -2258,7 +2258,7 @@
     return m_option_list_find(mp_properties,name);
 }
 
-int mp_property_do(char* name,int action, void* val) {
+int mp_property_do(const char* name,int action, void* val) {
     m_option_t* p = mp_property_find(name);
     if(!p) return M_PROPERTY_UNAVAILABLE;
     return m_property_do(p,action,val);
diff -u libmpdemux/demux_ty_osd.c libmpdemux/demux_ty_osd.c
--- libmpdemux/demux_ty_osd.c	(working copy)
+++ libmpdemux/demux_ty_osd.c	(working copy)
@@ -475,7 +475,7 @@
 static int ty_XDSDisplayCount = -1;
 
 
-static void ty_AddXDSToDisplay( char *format, ... )
+static void ty_AddXDSToDisplay( const char *format, ... )
 {
    char line[ 80 ];
    int  index;
--- Gui/win32/interface.c	(revision 18975)
+++ Gui/win32/interface.c	(working copy)
@@ -45,7 +45,7 @@
 extern m_obj_settings_t* vo_plugin_args;
 extern vo_functions_t *video_out;
 extern ao_functions_t *audio_out;
-extern void exit_player(char *how);
+extern void exit_player(const char *how);
 extern char *filename;
 extern int abs_seek_pos;
 extern float rel_seek_secs;
--- Gui/skin/font.c	(revision 18975)
+++ Gui/skin/font.c	(working copy)
@@ -146,7 +146,7 @@
  return max;
 }
 
-txSample * fntRender( wItem * item,int px,char * fmt,... )
+txSample * fntRender( wItem * item,int px,const char * fmt,... )
 {
  txSample      * tmp = NULL;
  va_list         ap;
--- Gui/skin/font.h	(revision 18975)
+++ Gui/skin/font.h	(working copy)
@@ -32,7 +32,7 @@
 extern int  fntTextWidth( int id,char * str );
 
 extern int        fntRead( char * path,char * fname );
-extern txSample * fntRender( wItem * item,int px,char * fmt,... );
+extern txSample * fntRender( wItem * item,int px,const char * fmt,... );
 
 #endif
 
--- Gui/mplayer/mw.c	(revision 18975)
+++ Gui/mplayer/mw.c	(working copy)
@@ -76,7 +76,7 @@
 // XFlush( wsDisplay );
 }
 
-extern void exit_player(char* how);
+extern void exit_player(const char* how);
 extern int vcd_track;
 static unsigned last_redraw_time = 0;
 
--- libmpcodecs/ve_x264.c	(revision 18975)
+++ libmpcodecs/ve_x264.c	(working copy)
@@ -208,7 +208,7 @@
 };
 
 static int parse_cqm(const char *str, uint8_t *cqm, int length,
-                     h264_module_t *mod, char *matrix_name) {
+                     h264_module_t *mod, const char *matrix_name) {
     int i;
     if (!str) return 0;
     for (i = 0; i < length; i++) {
--- libmpcodecs/ad_libvorbis.c	(revision 18975)
+++ libmpcodecs/ad_libvorbis.c	(working copy)
@@ -38,7 +38,7 @@
 #endif
 } ov_struct_t;
 
-static int read_vorbis_comment( char* ptr, char* comment, char* format, ... ) {
+static int read_vorbis_comment( char* ptr, const char* comment, const char* format, ... ) {
   va_list va;
   int clen, ret;
 
--- subopt-helper.c	(revision 18975)
+++ subopt-helper.c	(working copy)
@@ -324,7 +324,7 @@
 /*** little helpers */
 
 /** \brief compare the stings just as strcmp does */
-int strargcmp(strarg_t *arg, char *str) {
+int strargcmp(strarg_t *arg, const char *str) {
   int res = strncmp(arg->str, str, arg->len);
   if (!res && arg->len != strlen(str))
     res = arg->len - strlen(str);
--- subopt-helper.h	(revision 18975)
+++ subopt-helper.h	(working copy)
@@ -44,7 +44,7 @@
 int int_non_neg( int * i );
 int int_pos( int * i );
 
-int strargcmp(strarg_t *arg, char *str);
+int strargcmp(strarg_t *arg, const char *str);
 int strargcasecmp(strarg_t *arg, char *str);
 
 #endif
--- mplayer.h	(revision 18975)
+++ mplayer.h	(working copy)
@@ -58,7 +58,7 @@
 extern int dvdsub_id;
 extern int vobsub_id;
 
-extern void exit_player(char* how);
+extern void exit_player(const char* how);
 extern void update_set_of_subtitles(void);
 
 #endif
--- libass/ass_render.c	(revision 18975)
+++ libass/ass_render.c	(working copy)
@@ -469,7 +469,7 @@
 /**
  * \brief Check if starting part of (*p) matches sample. If true, shift p to the first symbol after the matching part.
  */
-static inline int mystrcmp(char** p, char* sample) {
+static inline int mystrcmp(char** p, const char* sample) {
 	int len = strlen(sample);
 	if (strncmp(*p, sample, len) == 0) {
 		(*p) += len;


More information about the MPlayer-dev-eng mailing list