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

Stefan Huehner stefan at huehner.org
Sun Jul 9 16:15:29 CEST 2006


On Sun, Jul 09, 2006 at 12:26:07AM -0400, Reynaldo H. Verdejo Pinochet wrote:
> On Sun, Jul 02, 2006 at 06:12:03PM +0200, Stefan Huehner wrote:
> > Hi,
> > 
> > attached paths marks several string parameters as const, when they are
> > not modified in the function. They are:
> 
> Can you repost this one Stefan? i dont feel like looking over all of the
> offsets :D

Attached is the patch against current svn.

Regards,
Stefan

-------------- next part --------------
Index: codec-cfg.c
===================================================================
--- codec-cfg.c	(revision 18975)
+++ codec-cfg.c	(working copy)
@@ -486,7 +486,7 @@
 static int nr_vcodecs = 0;
 static int nr_acodecs = 0;
 
-int parse_codec_cfg(char *cfgfile)
+int parse_codec_cfg(const char *cfgfile)
 {
 	codecs_t *codec = NULL; // current codec
 	codecs_t **codecsp = NULL;// points to audio_codecs or to video_codecs
Index: codec-cfg.h
===================================================================
--- codec-cfg.h	(revision 18975)
+++ codec-cfg.h	(working copy)
@@ -58,7 +58,7 @@
 	short cpuflags;
 } codecs_t;
 
-int parse_codec_cfg(char *cfgfile);
+int parse_codec_cfg(const char *cfgfile);
 codecs_t* find_video_codec(unsigned int fourcc, unsigned int *fourccmap,
                            codecs_t *start, int force);
 codecs_t* find_audio_codec(unsigned int fourcc, unsigned int *fourccmap,
Index: libmpcodecs/ve.c
===================================================================
--- libmpcodecs/ve.c	(revision 18975)
+++ libmpcodecs/ve.c	(working copy)
@@ -46,7 +46,7 @@
     NULL
 };
 
-vf_instance_t* vf_open_encoder(vf_instance_t* next, char *name, char *args){
+vf_instance_t* vf_open_encoder(vf_instance_t* next, const char *name, char *args){
     char* vf_args[] = { "_oldargs_", args, NULL };
     return vf_open_plugin(encoder_list,next,name,vf_args);
 }
Index: libmpcodecs/vf.c
===================================================================
--- libmpcodecs/vf.c	(revision 18975)
+++ libmpcodecs/vf.c	(working copy)
@@ -436,7 +436,7 @@
   return vf_next_query_format(vf,fmt);
 }
 
-vf_instance_t* vf_open_plugin(vf_info_t** filter_list, vf_instance_t* next, char *name, char **args){
+vf_instance_t* vf_open_plugin(vf_info_t** filter_list, vf_instance_t* next, const char *name, char **args){
     vf_instance_t* vf;
     int i;
     for(i=0;;i++){
@@ -475,7 +475,7 @@
     return NULL;
 }
 
-vf_instance_t* vf_open_filter(vf_instance_t* next, char *name, char **args){
+vf_instance_t* vf_open_filter(vf_instance_t* next, const char *name, char **args){
   if(args && strcmp(args[0],"_oldargs_")) {
     int i,l = 0;
     for(i = 0 ; args && args[2*i] ; i++)
Index: libmpcodecs/vf.h
===================================================================
--- libmpcodecs/vf.h	(revision 18975)
+++ libmpcodecs/vf.h	(working copy)
@@ -89,10 +89,10 @@
 void vf_mpi_clear(mp_image_t* mpi,int x0,int y0,int w,int h);
 mp_image_t* vf_get_image(vf_instance_t* vf, unsigned int outfmt, int mp_imgtype, int mp_imgflag, int w, int h);
 
-vf_instance_t* vf_open_plugin(vf_info_t** filter_list, vf_instance_t* next, char *name, char **args);
-vf_instance_t* vf_open_filter(vf_instance_t* next, char *name, char **args);
+vf_instance_t* vf_open_plugin(vf_info_t** filter_list, vf_instance_t* next, const char *name, char **args);
+vf_instance_t* vf_open_filter(vf_instance_t* next, const char *name, char **args);
 vf_instance_t* vf_add_before_vo(vf_instance_t **vf, char *name, char **args);
-vf_instance_t* vf_open_encoder(vf_instance_t* next, char *name, char *args);
+vf_instance_t* vf_open_encoder(vf_instance_t* next, const char *name, char *args);
 
 unsigned int vf_match_csp(vf_instance_t** vfp,unsigned int* list,unsigned int preferred);
 void vf_clone_mpi_attributes(mp_image_t* dst, mp_image_t* src);
Index: libvo/font_load.c
===================================================================
--- libvo/font_load.c	(revision 18975)
+++ libvo/font_load.c	(working copy)
@@ -49,7 +49,7 @@
 
 extern int sub_unicode;
 
-font_desc_t* read_font_desc(char* fname,float factor,int verbose){
+font_desc_t* read_font_desc(const char* fname,float factor,int verbose){
 unsigned char sor[1024];
 unsigned char sor2[1024];
 font_desc_t *desc;
Index: libvo/font_load.h
===================================================================
--- libvo/font_load.h	(revision 18975)
+++ libvo/font_load.h	(working copy)
@@ -80,7 +80,7 @@
 int init_freetype(void);
 int done_freetype(void);
 
-font_desc_t* read_font_desc_ft(char* fname,int movie_width, int movie_height);
+font_desc_t* read_font_desc_ft(const char* fname,int movie_width, int movie_height);
 void free_font_desc(font_desc_t *desc);
 
 void render_one_glyph(font_desc_t *desc, int c);
@@ -96,6 +96,6 @@
 #endif
 
 raw_file* load_raw(char *name,int verbose);
-font_desc_t* read_font_desc(char* fname,float factor,int verbose);
+font_desc_t* read_font_desc(const char* fname,float factor,int verbose);
 
 #endif /* ! __MPLAYER_FONT_LOAD_H */
Index: libvo/font_load_ft.c
===================================================================
--- libvo/font_load_ft.c	(revision 18975)
+++ libvo/font_load_ft.c	(working copy)
@@ -905,7 +905,7 @@
     free(desc);
 }
 
-static int load_sub_face(char *name, FT_Face *face)
+static int load_sub_face(const char *name, FT_Face *face)
 {
     int err = -1;
     
@@ -952,7 +952,7 @@
     return f266ToInt(kern.x);
 }
 
-font_desc_t* read_font_desc_ft(char *fname, int movie_width, int movie_height)
+font_desc_t* read_font_desc_ft(const char *fname, int movie_width, int movie_height)
 {
     font_desc_t *desc;
 
Index: mencoder.c
===================================================================
--- mencoder.c	(revision 18975)
+++ mencoder.c	(working copy)
@@ -299,7 +299,7 @@
 
 #include "libao2/audio_out.h"
 /* FIXME */
-static void mencoder_exit(int level, char *how)
+static void mencoder_exit(int level, const char *how)
 {
     if (how)
 	mp_msg(MSGT_MENCODER, MSGL_INFO, MSGTR_ExitingHow, how);
Index: subreader.c
===================================================================
--- subreader.c	(revision 18975)
+++ subreader.c	(working copy)
@@ -1832,7 +1832,7 @@
     }
 }
 
-char** sub_filenames(char* path, char *fname)
+char** sub_filenames(const char* path, char *fname)
 {
     char *f_dir, *f_fname, *f_fname_noext, *f_fname_trim, *tmp, *tmp_sub_id;
     char *tmp_fname_noext, *tmp_fname_trim, *tmp_fname_ext, *tmpresult;
Index: subreader.h
===================================================================
--- subreader.h	(revision 18975)
+++ subreader.h	(working copy)
@@ -76,7 +76,7 @@
 void* guess_buffer_cp(unsigned char* buffer, int buflen, char *preferred_language, char *fallback);
 void* guess_cp(struct stream_st *st, char *preferred_language, char *fallback);
 #endif
-char ** sub_filenames(char *path, char *fname);
+char ** sub_filenames(const char *path, char *fname);
 void list_sub_file(sub_data* subd);
 void dump_srt(sub_data* subd, float fps);
 void dump_mpsub(sub_data* subd, float fps);


More information about the MPlayer-dev-eng mailing list