[MPlayer-dev-eng] [patch] const char* inside structs
Stefan Huehner
stefan at huehner.org
Sat Jul 15 12:44:47 CEST 2006
Hi,
attached patch marks several string inside structs and const when they
hold only read-only information. One getter function was additionally
modified (GetLanguage in Gui/mplayer/gtk/menu.c) to cope which the
change.
Regards,
Stefan
-------------- next part --------------
Index: Gui/wm/wskeys.h
===================================================================
--- Gui/wm/wskeys.h (revision 19100)
+++ Gui/wm/wskeys.h (working copy)
@@ -156,7 +156,7 @@
typedef struct
{
int code;
- char * name;
+ const char * name;
} TwsKeyNames;
extern TwsKeyNames wsKeyNames[ wsKeyNumber ];
Index: Gui/skin/skin.c
===================================================================
--- Gui/skin/skin.c (revision 19100)
+++ Gui/skin/skin.c (working copy)
@@ -586,7 +586,7 @@
typedef struct
{
- char * name;
+ const char * name;
int (*func)( char * in );
} _item;
Index: Gui/app.h
===================================================================
--- Gui/app.h (revision 19100)
+++ Gui/app.h (working copy)
@@ -94,7 +94,7 @@
typedef struct
{
int msg;
- char * name;
+ const char * name;
} evName;
extern int evBoxs;
Index: Gui/mplayer/gtk/menu.c
===================================================================
--- Gui/mplayer/gtk/menu.c (revision 19100)
+++ Gui/mplayer/gtk/menu.c (working copy)
@@ -182,7 +182,7 @@
typedef struct
{
int id;
- char * name;
+ const char * name;
} Languages_t;
#define lng( a,b ) ( (int)(a) * 256 + b )
@@ -369,7 +369,7 @@
{ "","Stereo","","","","5.1" };
#endif
-char * GetLanguage( int language )
+const char * GetLanguage( int language )
{
unsigned int i;
for ( i=0;i<sizeof( Languages ) / sizeof( Languages_t );i++ )
Index: input/input.c
===================================================================
--- input/input.c (revision 19100)
+++ input/input.c (working copy)
@@ -1671,7 +1671,7 @@
static int mp_input_print_cmd_list(m_option_t* cfg) {
mp_cmd_t *cmd;
int i,j;
- char* type;
+ const char* type;
for(i = 0; (cmd = &mp_cmds[i])->name != NULL ; i++) {
printf("%-20.20s",cmd->name);
Index: mplayer.c
===================================================================
--- mplayer.c (revision 19100)
+++ mplayer.c (working copy)
@@ -2290,7 +2290,7 @@
/// List of the commands that can be handled by setting a property.
static struct {
/// property name
- char* name;
+ const char* name;
/// cmd id
int cmd;
/// set/adjust or toggle command
@@ -2300,7 +2300,7 @@
/// osd msg id if it must be shared
int osd_id;
/// osd msg template
- char* osd_msg;
+ const char* osd_msg;
} set_prop_cmd[] = {
// audio
{ "volume", MP_CMD_VOLUME, 0, OSD_VOLUME, -1, MSGTR_Volume },
Index: libmpdemux/demux_ogg.c
===================================================================
--- libmpdemux/demux_ogg.c (revision 19100)
+++ libmpdemux/demux_ogg.c (working copy)
@@ -463,13 +463,13 @@
/// Try to print out comments and also check for LANGUAGE= tag
static void demux_ogg_check_comments(demuxer_t *d, ogg_stream_t *os, int id, vorbis_comment *vc)
{
- char *hdr, *val;
+ const char *hdr, *val;
char **cmt = vc->user_comments;
int index, i;
ogg_demuxer_t *ogg_d = (ogg_demuxer_t *)d->priv;
struct table {
- char *ogg;
- char *mp;
+ const char *ogg;
+ const char *mp;
} table[] = {
{ "ENCODED_USING", "Software" },
{ "ENCODER_URL", "Encoder URL" },
Index: libmpdemux/extension.c
===================================================================
--- libmpdemux/extension.c (revision 19100)
+++ libmpdemux/extension.c (working copy)
@@ -12,7 +12,7 @@
* An autodetection based on the extension is not a good idea, but we don't care ;-)
*/
static struct {
- char *extension;
+ const char *extension;
int demuxer_type;
} extensions_table[] = {
// { "mpeg", DEMUXER_TYPE_MPEG_PS },
Index: libmpdemux/frequencies.h
===================================================================
--- libmpdemux/frequencies.h (revision 19100)
+++ libmpdemux/frequencies.h (working copy)
@@ -94,7 +94,7 @@
};
struct CHANLISTS {
- char *name;
+ const char *name;
const struct CHANLIST *list;
int count;
};
More information about the MPlayer-dev-eng
mailing list