From: <fla...@gm...> - 2007-04-14 15:54:32
|
# HG changeset patch # User Diego 'Flameeyes' Pettenò <fla...@gm...> # Date 1176565959 -7200 # Node ID 7a7b529e6d03c2cdcc7d68d40c7f8ddcdc4a384b # Parent 46ea7bac579dee679f045032e2dc4670bfd66716 Mark string arrays as arrays of constant pointers, and do the same for memcpy structures. When array of constant pointers are used for register enum configurations, this creates more warnings because of pointer mismatches; I'd consider casting them, but not yet. In the memcpy_method array, mark the parts that are constant at build time as const so to try reducing the overhead. diff -r 7a7b529e6d03c2cdcc7d68d40c7f8ddcdc4a384b -r 46ea7bac579dee679f045032e2dc4670bfd66716 src/input/input_dvd.c --- a/src/input/input_dvd.c Sat Apr 14 17:52:39 2007 +0200 +++ b/src/input/input_dvd.c Sat Apr 14 17:33:05 2007 +0200 @@ -158,7 +158,7 @@ # define lseek64 lseek #endif -static const char *dvdnav_menu_table[] = { +static const char *const dvdnav_menu_table[] = { NULL, NULL, "Title", @@ -1791,7 +1791,7 @@ static void *init_class (xine_t *xine, v { /* we have found libdvdcss, enable the specific config options */ char *raw_device; - static const char *decrypt_modes[] = { "key", "disc", "title", NULL }; + static const char *const decrypt_modes[] = { "key", "disc", "title", NULL }; int mode; raw_device = config->register_filename(config, "media.dvd.raw_device", diff -r 7a7b529e6d03c2cdcc7d68d40c7f8ddcdc4a384b -r 46ea7bac579dee679f045032e2dc4670bfd66716 src/input/input_mms.c --- a/src/input/input_mms.c Sat Apr 14 17:52:39 2007 +0200 +++ b/src/input/input_mms.c Sat Apr 14 17:33:05 2007 +0200 @@ -59,15 +59,15 @@ static const uint32_t mms_bandwidths[]={ static const uint32_t mms_bandwidths[]={14400,19200,28800,33600,34430,57600, 115200,262200,393216,524300,1544000,10485800}; -static const char * mms_bandwidth_strs[]={"14.4 Kbps (Modem)", "19.2 Kbps (Modem)", - "28.8 Kbps (Modem)", "33.6 Kbps (Modem)", - "34.4 Kbps (Modem)", "57.6 Kbps (Modem)", - "115.2 Kbps (ISDN)", "262.2 Kbps (Cable/DSL)", - "393.2 Kbps (Cable/DSL)","524.3 Kbps (Cable/DSL)", - "1.5 Mbps (T1)", "10.5 Mbps (LAN)", NULL}; +static const char *const mms_bandwidth_strs[]={"14.4 Kbps (Modem)", "19.2 Kbps (Modem)", + "28.8 Kbps (Modem)", "33.6 Kbps (Modem)", + "34.4 Kbps (Modem)", "57.6 Kbps (Modem)", + "115.2 Kbps (ISDN)", "262.2 Kbps (Cable/DSL)", + "393.2 Kbps (Cable/DSL)","524.3 Kbps (Cable/DSL)", + "1.5 Mbps (T1)", "10.5 Mbps (LAN)", NULL}; /* connection methods */ -static const char *mms_protocol_strs[]={"auto", "TCP", "HTTP", NULL}; +static const char *const mms_protocol_strs[]={"auto", "TCP", "HTTP", NULL}; typedef struct { input_plugin_t input_plugin; diff -r 7a7b529e6d03c2cdcc7d68d40c7f8ddcdc4a384b -r 46ea7bac579dee679f045032e2dc4670bfd66716 src/input/vcd/xineplug_inp_vcd.c --- a/src/input/vcd/xineplug_inp_vcd.c Sat Apr 14 17:52:39 2007 +0200 +++ b/src/input/vcd/xineplug_inp_vcd.c Sat Apr 14 17:33:05 2007 +0200 @@ -1807,13 +1807,13 @@ vcd_init (xine_t *xine, void *data) /*Note: these labels have to be listed in the same order as the enumeration vcdplayer_autoplay_t in vcdplayer.h. */ - static const char *autoplay_modes[] = + static const char *const autoplay_modes[] = { "MPEG track", "entry", "segment", "playback-control item", NULL }; /*Note: these labels have to be listed in the same order as the enumeration vcdplayer_slider_length_t in vcdplayer.h. */ - static const char *length_reporting_modes[] = + static const char *const length_reporting_modes[] = { "auto", "track", "entry", NULL }; my_vcd.player.default_autoplay = diff -r 7a7b529e6d03c2cdcc7d68d40c7f8ddcdc4a384b -r 46ea7bac579dee679f045032e2dc4670bfd66716 src/libsputext/xine_sputext_decoder.c --- a/src/libsputext/xine_sputext_decoder.c Sat Apr 14 17:52:39 2007 +0200 +++ b/src/libsputext/xine_sputext_decoder.c Sat Apr 14 17:33:05 2007 +0200 @@ -925,7 +925,7 @@ static void update_src_encoding(void *cl static void *init_spu_decoder_plugin (xine_t *xine, void *data) { - static const char *subtitle_size_strings[] = { + static const char *const subtitle_size_strings[] = { "tiny", "small", "normal", "large", "very large", "huge", NULL }; sputext_class_t *this ; diff -r 7a7b529e6d03c2cdcc7d68d40c7f8ddcdc4a384b -r 46ea7bac579dee679f045032e2dc4670bfd66716 src/video_out/deinterlace.h --- a/src/video_out/deinterlace.h Sat Apr 14 17:52:39 2007 +0200 +++ b/src/video_out/deinterlace.h Sat Apr 14 17:33:05 2007 +0200 @@ -41,7 +41,7 @@ void deinterlace_yuv( uint8_t *pdst, uin #define DEINTERLACE_ONEFIELDXV 5 #define DEINTERLACE_LINEARBLEND 6 -static const char *deinterlace_methods[] = { +static const char *const deinterlace_methods[] = { "none", "bob", "weave", diff -r 7a7b529e6d03c2cdcc7d68d40c7f8ddcdc4a384b -r 46ea7bac579dee679f045032e2dc4670bfd66716 src/video_out/video_out_directfb.c --- a/src/video_out/video_out_directfb.c Sat Apr 14 17:52:39 2007 +0200 +++ b/src/video_out/video_out_directfb.c Sat Apr 14 17:33:05 2007 +0200 @@ -1333,8 +1333,8 @@ static void update_config_cb (void *data static void init_config (directfb_driver_t *this) { config_values_t *config = this->xine->config; - static const char *buffermode_enum[] = {"single", "double", "triple", 0}; - static const char *fieldparity_enum[] = {"none", "top", "bottom", 0}; + static const char *const buffermode_enum[] = {"single", "double", "triple", 0}; + static const char *const fieldparity_enum[] = {"none", "top", "bottom", 0}; this->buffermode = config->register_enum (config, "video.device.directfb_buffermode", this->buffermode, (char**)buffermode_enum, diff -r 7a7b529e6d03c2cdcc7d68d40c7f8ddcdc4a384b -r 46ea7bac579dee679f045032e2dc4670bfd66716 src/xine-engine/xine.c --- a/src/xine-engine/xine.c Sat Apr 14 17:52:39 2007 +0200 +++ b/src/xine-engine/xine.c Sat Apr 14 17:33:05 2007 +0200 @@ -1539,8 +1539,8 @@ static void config_save_cb (void *this_g } void xine_init (xine_t *this) { - static const char *demux_strategies[] = {"default", "reverse", "content", - "extension", NULL}; + static const char *const demux_strategies[] = {"default", "reverse", "content", + "extension", NULL}; /* First of all, initialise libxdg-basedir as it's used by plugins. */ this->basedir_handle = xdgAllocHandle(); diff -r 7a7b529e6d03c2cdcc7d68d40c7f8ddcdc4a384b -r 46ea7bac579dee679f045032e2dc4670bfd66716 src/xine-utils/memcpy.c --- a/src/xine-utils/memcpy.c Sat Apr 14 17:52:39 2007 +0200 +++ b/src/xine-utils/memcpy.c Sat Apr 14 17:33:05 2007 +0200 @@ -383,8 +383,8 @@ static void *linux_kernel_memcpy(void *t #endif /* ARCH_X86 */ static struct { - char *name; - void *(* function)(void *to, const void *from, size_t len); + char *const name; + void *(*const function)(void *to, const void *from, size_t len); uint64_t time; /* This type could be used for non-MSC build too! */ @@ -461,7 +461,7 @@ void xine_probe_fast_memcpy(xine_t *xine char *buf1, *buf2; int i, j, best; int config_flags = -1; - static const char *memcpy_methods[] = { + static const char *const memcpy_methods[] = { "probe", "libc", #if (defined(ARCH_X86) || defined(ARCH_X86_64)) && !defined(_MSC_VER) "kernel", "mmx", "mmxext", "sse", |