On Wed, Jun 21, 2006 at 08:00:03PM +0200, Stefan Huehner wrote:
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
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";
Things like this should be: static const char default_dir[] = MPLAYER_DATADIR "/font"; It saves the wasted space for storing a pointer to a constant address. Yes I'm being pedantic but your patch is pedantic. So if you want pedantry, do it right. :) Rich