From d427579f79d6b22ce8b65bac27651be03621d23f Mon Sep 17 00:00:00 2001 From: reynaldo Date: Sun, 16 Jul 2006 01:20:30 +0000 Subject: [PATCH] marks several read-only string parameters and function return-values which can only be used read-only as const. Patch by Stefan Huehner, stefan _AT huener-org git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@19113 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libaf/af_format.h | 6 +++--- libaf/format.c | 6 +++--- libmpcodecs/img_format.c | 2 +- libmpcodecs/img_format.h | 2 +- libmpdemux/asfheader.c | 2 +- libmpdemux/librtsp/rtsp.c | 2 +- libmpdemux/librtsp/rtsp.h | 2 +- libmpdemux/network.c | 2 +- libmpdemux/tvi_v4l2.c | 2 +- libvo/video_out.h | 2 +- 10 files changed, 14 insertions(+), 14 deletions(-) diff --git a/libaf/af_format.h b/libaf/af_format.h index ab495dc634..dffd87e85e 100644 --- a/libaf/af_format.h +++ b/libaf/af_format.h @@ -84,11 +84,11 @@ #define AF_FORMAT_FLOAT_NE AF_FORMAT_FLOAT_LE #endif -extern int af_str2fmt(char *str); -extern int af_str2fmt_short(char *str); +extern int af_str2fmt(const char *str); +extern int af_str2fmt_short(const char *str); extern int af_fmt2bits(int format); extern int af_bits2fmt(int bits); extern char* af_fmt2str(int format, char* str, int size); -extern char* af_fmt2str_short(int format); +extern const char* af_fmt2str_short(int format); #endif /* __af_format_h__ */ diff --git a/libaf/format.c b/libaf/format.c index 53078d39b7..84b81b5da8 100644 --- a/libaf/format.c +++ b/libaf/format.c @@ -19,7 +19,7 @@ #include "help_mp.h" // Convert from string to format -int af_str2fmt(char* str) +int af_str2fmt(const char* str) { int format=0; // Scan for endianess @@ -178,7 +178,7 @@ static struct { { NULL, 0 } }; -char *af_fmt2str_short(int format) +const char *af_fmt2str_short(int format) { int i; @@ -189,7 +189,7 @@ char *af_fmt2str_short(int format) return "??"; } -int af_str2fmt_short(char* str) +int af_str2fmt_short(const char* str) { int i; diff --git a/libmpcodecs/img_format.c b/libmpcodecs/img_format.c index 6076b713d0..3b81c1f67e 100644 --- a/libmpcodecs/img_format.c +++ b/libmpcodecs/img_format.c @@ -1,7 +1,7 @@ #include "config.h" #include "img_format.h" -char *vo_format_name(int format) +const char *vo_format_name(int format) { switch(format) { diff --git a/libmpcodecs/img_format.h b/libmpcodecs/img_format.h index 6d4374b501..d40aa0259e 100644 --- a/libmpcodecs/img_format.h +++ b/libmpcodecs/img_format.h @@ -114,6 +114,6 @@ typedef struct { int timestamp; // pts, 90000 Hz counter based } vo_mpegpes_t; -char *vo_format_name(int format); +const char *vo_format_name(int format); #endif diff --git a/libmpdemux/asfheader.c b/libmpdemux/asfheader.c index 3981cf9a78..db78c55412 100644 --- a/libmpdemux/asfheader.c +++ b/libmpdemux/asfheader.c @@ -77,7 +77,7 @@ void print_asf_string(const char* name, char* string, int length) { mp_msg(MSGT_HEADER,MSGL_V,"%s%s\n", name, string); } -static char* asf_chunk_type(unsigned char* guid) { +static const char* asf_chunk_type(unsigned char* guid) { static char tmp[60]; char *p; int i; diff --git a/libmpdemux/librtsp/rtsp.c b/libmpdemux/librtsp/rtsp.c index a009652399..16a77f77d5 100644 --- a/libmpdemux/librtsp/rtsp.c +++ b/libmpdemux/librtsp/rtsp.c @@ -705,7 +705,7 @@ char *rtsp_get_mrl(rtsp_t *s) { } -char *rtsp_get_param(rtsp_t *s, char *p) { +char *rtsp_get_param(rtsp_t *s, const char *p) { int len; char *param; if (!s->param) diff --git a/libmpdemux/librtsp/rtsp.h b/libmpdemux/librtsp/rtsp.h index 624c116bcb..eefdd79d51 100644 --- a/libmpdemux/librtsp/rtsp.h +++ b/libmpdemux/librtsp/rtsp.h @@ -72,7 +72,7 @@ void rtsp_set_session(rtsp_t *s, const char *id); char *rtsp_get_session(rtsp_t *s); char *rtsp_get_mrl(rtsp_t *s); -char *rtsp_get_param(rtsp_t *s, char *param); +char *rtsp_get_param(rtsp_t *s, const char *param); /*int rtsp_peek_header (rtsp_t *this, char *data); */ diff --git a/libmpdemux/network.c b/libmpdemux/network.c index 1dc6a6e9d5..d9e18f7e94 100644 --- a/libmpdemux/network.c +++ b/libmpdemux/network.c @@ -117,7 +117,7 @@ streaming_ctrl_free( streaming_ctrl_t *streaming_ctrl ) { // Converts an address family constant to a string -char *af2String(int af) { +const char *af2String(int af) { switch (af) { case AF_INET: return "AF_INET"; diff --git a/libmpdemux/tvi_v4l2.c b/libmpdemux/tvi_v4l2.c index 928610eab0..049d34e37c 100644 --- a/libmpdemux/tvi_v4l2.c +++ b/libmpdemux/tvi_v4l2.c @@ -213,7 +213,7 @@ static int fcc_vl2mp(int fcc) ** Translate a video4linux2 fourcc aka pixel format ** to a human readable string. */ -static char *pixfmt2name(int pixfmt) +static const char *pixfmt2name(int pixfmt) { static char unknown[24]; diff --git a/libvo/video_out.h b/libvo/video_out.h index 369aa32fc8..b7b214f642 100644 --- a/libvo/video_out.h +++ b/libvo/video_out.h @@ -166,7 +166,7 @@ typedef struct vo_functions_s } vo_functions_t; -char *vo_format_name(int format); +const char *vo_format_name(int format); int vo_init(void); vo_functions_t* init_best_video_out(char** vo_list);