From 58ed2c3fe035313bfc7feca7fd18abb84fa4fad1 Mon Sep 17 00:00:00 2001 From: reynaldo Date: Sat, 15 Jul 2006 16:03:12 +0000 Subject: marks several read-only string parameters which aren't modified inside the called function as const. Patch by Stefan Huehner, stefan AT huehner-org git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@19109 b3059339-0415-0410-9bf9-f77b7e298cf2 --- Gui/mplayer/mw.c | 2 +- Gui/skin/font.c | 2 +- Gui/skin/font.h | 2 +- Gui/win32/interface.c | 2 +- asxparser.c | 2 +- asxparser.h | 2 +- libass/ass_render.c | 2 +- libmpcodecs/ad_libvorbis.c | 2 +- libmpcodecs/ve_x264.c | 2 +- libmpdemux/demux_ty_osd.c | 2 +- m_property.h | 2 +- m_struct.c | 4 ++-- m_struct.h | 4 ++-- mplayer.c | 6 +++--- mplayer.h | 2 +- subopt-helper.c | 2 +- subopt-helper.h | 2 +- 17 files changed, 21 insertions(+), 21 deletions(-) diff --git a/Gui/mplayer/mw.c b/Gui/mplayer/mw.c index 7c188789da..0d4416ea8a 100644 --- a/Gui/mplayer/mw.c +++ b/Gui/mplayer/mw.c @@ -73,7 +73,7 @@ void mplMainDraw( void ) // 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; diff --git a/Gui/skin/font.c b/Gui/skin/font.c index c1d275dabd..3860079a98 100644 --- a/Gui/skin/font.c +++ b/Gui/skin/font.c @@ -146,7 +146,7 @@ int fntTextHeight( int id,char * str ) return max; } -txSample * fntRender( wItem * item,int px,char * fmt,... ) +txSample * fntRender( wItem * item,int px,const char * fmt,... ) { va_list ap; unsigned char p[512]; diff --git a/Gui/skin/font.h b/Gui/skin/font.h index 0c3fa62998..94289ded6c 100644 --- a/Gui/skin/font.h +++ b/Gui/skin/font.h @@ -32,7 +32,7 @@ extern int fntTextHeight( int id,char * str ); 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 diff --git a/Gui/win32/interface.c b/Gui/win32/interface.c index f7d148f954..d622d6c105 100644 --- a/Gui/win32/interface.c +++ b/Gui/win32/interface.c @@ -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; diff --git a/asxparser.c b/asxparser.c index 229a8252ea..1bd8047c23 100644 --- a/asxparser.c +++ b/asxparser.c @@ -80,7 +80,7 @@ asx_list_free(void* list_ptr,ASX_FreeFunc free_func) { /////// 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 --git a/asxparser.h b/asxparser.h index 9a80d538c5..8d3c87bcfd 100644 --- a/asxparser.h +++ b/asxparser.h @@ -34,7 +34,7 @@ asx_parse_attribs(ASX_Parser_t* parser,char* buffer,char*** _attribs); /////// 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 --git a/libass/ass_render.c b/libass/ass_render.c index 3dbc38359d..7339b02279 100644 --- a/libass/ass_render.c +++ b/libass/ass_render.c @@ -469,7 +469,7 @@ static void compute_string_bbox( text_info_t* info, FT_BBox *abbox ) { /** * \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; diff --git a/libmpcodecs/ad_libvorbis.c b/libmpcodecs/ad_libvorbis.c index 637b4f669f..0b6ef3eac0 100644 --- a/libmpcodecs/ad_libvorbis.c +++ b/libmpcodecs/ad_libvorbis.c @@ -38,7 +38,7 @@ typedef struct ov_struct_st { #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; diff --git a/libmpcodecs/ve_x264.c b/libmpcodecs/ve_x264.c index 16e3c98627..4c0d45d8c7 100644 --- a/libmpcodecs/ve_x264.c +++ b/libmpcodecs/ve_x264.c @@ -208,7 +208,7 @@ m_option_t x264encopts_conf[] = { }; 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++) { diff --git a/libmpdemux/demux_ty_osd.c b/libmpdemux/demux_ty_osd.c index 92b2f107f0..ec8a8340bb 100644 --- a/libmpdemux/demux_ty_osd.c +++ b/libmpdemux/demux_ty_osd.c @@ -475,7 +475,7 @@ static int ty_XDSAddLine = -1; static int ty_XDSDisplayCount = -1; -static void ty_AddXDSToDisplay( char *format, ... ) +static void ty_AddXDSToDisplay( const char *format, ... ) { char line[ 80 ]; int index; diff --git a/m_property.h b/m_property.h index dffdf523a0..e43dc597ad 100644 --- a/m_property.h +++ b/m_property.h @@ -123,7 +123,7 @@ char* m_properties_expand_string(m_option_t* prop_list,char* str); 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 --git a/m_struct.c b/m_struct.c index 3a8d1a38ee..f6b114ec12 100644 --- a/m_struct.c +++ b/m_struct.c @@ -12,7 +12,7 @@ #include "mp_msg.h" m_option_t* -m_struct_get_field(m_struct_t* st,char* f) { +m_struct_get_field(m_struct_t* st,const char* f) { int i; for(i = 0 ; st->fields[i].name ; i++) { @@ -70,7 +70,7 @@ m_struct_set(m_struct_t* st, void* obj, char* field, char* param) { } void -m_struct_reset(m_struct_t* st, void* obj, char* field) { +m_struct_reset(m_struct_t* st, void* obj, const char* field) { m_option_t* f; if(!field) { // Reset all options diff --git a/m_struct.h b/m_struct.h index 35cafc9951..2f7f16dffa 100644 --- a/m_struct.h +++ b/m_struct.h @@ -78,7 +78,7 @@ m_struct_set(m_struct_t* st, void* obj, char* field, char* param); * \param field Name of the field to reset, if NULL all fields are reseted. */ void -m_struct_reset(m_struct_t* st, void* obj, char* field); +m_struct_reset(m_struct_t* st, void* obj, const char* field); /// Create a copy of an existing struct. /** \param st Struct definiton. @@ -101,7 +101,7 @@ m_struct_free(m_struct_t* st, void* obj); * \return The \ref m_option struct describing the field or NULL if not found. */ struct m_option* -m_struct_get_field(m_struct_t* st,char* f); +m_struct_get_field(m_struct_t* st,const char* f); ///@} diff --git a/mplayer.c b/mplayer.c index 4c27c2946d..f3b2a318cf 100644 --- a/mplayer.c +++ b/mplayer.c @@ -519,7 +519,7 @@ static void uninit_player(unsigned int mask){ 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 @@ static void exit_player_with_rc(char* how, int rc){ exit(rc); } -void exit_player(char* how){ +void exit_player(const char* how){ exit_player_with_rc(how, 1); } @@ -2258,7 +2258,7 @@ m_option_t* mp_property_find(const char* name) { 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 --git a/mplayer.h b/mplayer.h index 2f2bc86495..1b1a4629a2 100644 --- a/mplayer.h +++ b/mplayer.h @@ -58,7 +58,7 @@ extern int video_id; 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 diff --git a/subopt-helper.c b/subopt-helper.c index 32cf883b09..b0b425eab7 100644 --- a/subopt-helper.c +++ b/subopt-helper.c @@ -324,7 +324,7 @@ int int_pos( int * i ) /*** 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); diff --git a/subopt-helper.h b/subopt-helper.h index 29e7461b9c..dad3e4d0e5 100644 --- a/subopt-helper.h +++ b/subopt-helper.h @@ -44,7 +44,7 @@ typedef struct strarg_s 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 -- cgit v1.2.3