[MPlayer-dev-eng] [patch] added const for strings
Stefan Huehner
stefan at huehner.org
Wed Jun 21 20:00:03 CEST 2006
Hi,
attached patch adds const to string-constants in:
mp3lib/sr1.c
libvo/font_load.c
postproc/swscale.c
and adds the const modifier to read-only string parameters of functions
in:
libvo/vo_caca.c
libvo/vo_aa.c
Regards,
Stefan
-------------- next part --------------
Index: mp3lib/sr1.c
===================================================================
--- mp3lib/sr1.c (revision 18777)
+++ mp3lib/sr1.c (working copy)
@@ -531,8 +531,8 @@
// Prints last frame header in ascii.
void MP3_PrintHeader(void){
- static char *modes[4] = { "Stereo", "Joint-Stereo", "Dual-Channel", "Single-Channel" };
- static char *layers[4] = { "???" , "I", "II", "III" };
+ static const char *modes[4] = { "Stereo", "Joint-Stereo", "Dual-Channel", "Single-Channel" };
+ static const char *layers[4] = { "???" , "I", "II", "III" };
mp_msg(MSGT_DECAUDIO,MSGL_V,"\rMPEG %s, Layer %s, %ld Hz %d kbit %s, BPF: %ld\n",
fr.mpeg25 ? "2.5" : (fr.lsf ? "2.0" : "1.0"),
Index: libvo/font_load.c
===================================================================
--- libvo/font_load.c (revision 18777)
+++ libvo/font_load.c (working copy)
@@ -161,7 +161,7 @@
} else
if(strcmp(section,"[files]")==0){
- char *default_dir=MPLAYER_DATADIR "/font";
+ const char *default_dir=MPLAYER_DATADIR "/font";
if(pdb==2 && strcmp(p[0],"alpha")==0){
char *cp;
if (!(cp=malloc(strlen(desc->fpath)+strlen(p[1])+2))) goto fail_out;
Index: libvo/vo_caca.c
===================================================================
--- libvo/vo_caca.c (revision 18777)
+++ libvo/vo_caca.c (working copy)
@@ -67,7 +67,7 @@
static int osdx = 0, osdy = 0;
static int posbary = 2;
-static void osdmessage(int duration, char *fmt, ...)
+static void osdmessage(int duration, const char *fmt, ...)
{
/*
* for outputting a centered string at the bottom
@@ -87,7 +87,7 @@
posbar[0] = '\0';
}
-static void osdpercent(int duration, int min, int max, int val, char *desc, char *unit)
+static void osdpercent(int duration, int min, int max, int val, const char *desc, const char *unit)
{
/*
* prints a bar for setting values
Index: libvo/vo_aa.c
===================================================================
--- libvo/vo_aa.c (revision 18777)
+++ libvo/vo_aa.c (working copy)
@@ -137,7 +137,7 @@
}
void
-osdmessage(int duration, int deko, char *fmt, ...)
+osdmessage(int duration, int deko, const char *fmt, ...)
{
/*
* for outputting a centered string at the bottom
@@ -164,7 +164,7 @@
}
void
-osdpercent(int duration, int deko, int min, int max, int val, char * desc, char * unit)
+osdpercent(int duration, int deko, int min, int max, int val, const char * desc, const char * unit)
{
/*
* prints a bar for setting values
Index: postproc/swscale.c
===================================================================
--- postproc/swscale.c (revision 18777)
+++ postproc/swscale.c (working copy)
@@ -2167,9 +2167,9 @@
if(flags&SWS_PRINT_INFO)
{
#ifdef DITHER1XBPP
- char *dither= " dithered";
+ const char *dither= " dithered";
#else
- char *dither= "";
+ const char *dither= "";
#endif
if(flags&SWS_FAST_BILINEAR)
MSG_INFO("\nSwScaler: FAST_BILINEAR scaler, ");
More information about the MPlayer-dev-eng
mailing list