[vlc-devel] [PATCH] Declared many static variables const
Justus Piater
Justus-bulk at Piater.name
Sun Aug 3 10:42:29 CEST 2008
From: Justus Piater <Justus-dev at Piater.name>
---
include/vlc_bits.h | 2 +-
include/vlc_codecs.h | 4 ++--
include/vlc_config_cat.h | 2 +-
include/vlc_gcrypt.h | 2 +-
modules/access/v4l2/v4l2.c | 4 ++--
modules/audio_filter/format.c | 2 +-
modules/audio_filter/resampler/bandlimited.c | 12 ++++++------
modules/audio_filter/resampler/bandlimited.h | 4 ++--
modules/audio_output/file.c | 4 ++--
modules/codec/araw.c | 4 ++--
modules/codec/avcodec/audio.c | 2 +-
modules/codec/avcodec/avutil.h | 2 +-
modules/codec/avcodec/fourcc.h | 2 +-
modules/codec/flac.c | 4 ++--
modules/codec/quicktime.c | 2 +-
modules/codec/realaudio.c | 2 +-
modules/codec/speex.c | 2 +-
modules/codec/telx.c | 4 ++--
modules/codec/vorbis.c | 2 +-
modules/control/dbus.h | 6 +++---
modules/control/http/macros.h | 2 +-
modules/demux/asademux.c | 2 +-
modules/demux/asf/libasf.c | 2 +-
modules/demux/avi/libavi.c | 4 ++--
modules/demux/mkv.cpp | 2 +-
modules/demux/mp4/drms.c | 14 +++++++-------
modules/demux/playlist/dvb.c | 2 +-
modules/demux/rawvid.c | 4 ++--
modules/demux/subtitle.c | 2 +-
.../gui/qt4/components/playlist/playlist_model.hpp | 8 ++++----
modules/gui/qt4/dialogs/help.hpp | 4 ++--
modules/gui/qt4/qt4.hpp | 8 ++++----
modules/misc/freetype.c | 2 +-
modules/misc/lua/demux.c | 4 ++--
modules/misc/lua/intf.c | 4 ++--
modules/misc/lua/meta.c | 2 +-
modules/misc/win32text.c | 2 +-
modules/mux/mp4.c | 2 +-
modules/stream_out/transcode.c | 2 +-
modules/video_chroma/i420_rgb8.c | 16 ++++++++--------
modules/video_filter/atmo/atmo.cpp | 8 ++++----
.../dynamicoverlay/dynamicoverlay_commands.c | 2 +-
modules/video_output/sdl.c | 2 +-
modules/video_output/x11/xvmc.c | 2 +-
modules/visualization/visual/visual.c | 2 +-
src/extras/getopt1.c | 2 +-
src/misc/image.c | 2 +-
src/misc/mtime.c | 2 +-
src/network/httpd.c | 2 +-
49 files changed, 90 insertions(+), 90 deletions(-)
diff --git a/include/vlc_bits.h b/include/vlc_bits.h
index 1a6bab6..23f952c 100644
--- a/include/vlc_bits.h
+++ b/include/vlc_bits.h
@@ -50,7 +50,7 @@ static inline int bs_eof( bs_t *s )
}
static inline uint32_t bs_read( bs_t *s, int i_count )
{
- static uint32_t i_mask[33] =
+ static const uint32_t i_mask[33] =
{ 0x00,
0x01, 0x03, 0x07, 0x0f,
0x1f, 0x3f, 0x7f, 0xff,
diff --git a/include/vlc_codecs.h b/include/vlc_codecs.h
index d217470..ad9f94b 100644
--- a/include/vlc_codecs.h
+++ b/include/vlc_codecs.h
@@ -286,7 +286,7 @@ static const GUID VLC_KSDATAFORMAT_SUBTYPE_UNKNOWN = {0x00000000, 0x0000, 0x0000
#define WAVE_SPEAKER_TOP_BACK_RIGHT 0x20000
#define WAVE_SPEAKER_RESERVED 0x80000000
-static struct
+static const struct
{
uint16_t i_tag;
vlc_fourcc_t i_fourcc;
@@ -354,7 +354,7 @@ static inline void fourcc_to_wf_tag( vlc_fourcc_t fcc, uint16_t *pi_tag )
* to determine the actual format. Microsoft has stopped giving out wFormatTag
* assignments in lieu of letting 3rd parties generate their own GUIDs
*/
-static struct
+static const struct
{
GUID guid_tag;
vlc_fourcc_t i_fourcc;
diff --git a/include/vlc_config_cat.h b/include/vlc_config_cat.h
index e21c29e..c259afc 100644
--- a/include/vlc_config_cat.h
+++ b/include/vlc_config_cat.h
@@ -241,7 +241,7 @@ static inline const char * GetCapabilityHelp( char *psz_capability, int i_type)
return " ";
}
-static struct config_category_t categories_array[] =
+static const struct config_category_t categories_array[] =
{
/* Interface */
{ CAT_INTERFACE, INTF_TITLE, INTF_HELP },
diff --git a/include/vlc_gcrypt.h b/include/vlc_gcrypt.h
index 87fe46d..3a2e631 100644
--- a/include/vlc_gcrypt.h
+++ b/include/vlc_gcrypt.h
@@ -66,7 +66,7 @@ static int gcry_vlc_mutex_unlock( void **lock )
return VLC_SUCCESS;
}
-static struct gcry_thread_cbs gcry_threads_vlc =
+static const struct gcry_thread_cbs gcry_threads_vlc =
{
GCRY_THREAD_OPTION_USER,
NULL,
diff --git a/modules/access/v4l2/v4l2.c b/modules/access/v4l2/v4l2.c
index ebff113..0f82bc2 100644
--- a/modules/access/v4l2/v4l2.c
+++ b/modules/access/v4l2/v4l2.c
@@ -435,7 +435,7 @@ static int AccessControlResetCallback( vlc_object_t *p_this,
const char *psz_var, vlc_value_t oldval,
vlc_value_t newval, void *p_data );
-static struct
+static const struct
{
unsigned int i_v4l2;
int i_fourcc;
@@ -480,7 +480,7 @@ static const __u32 p_chroma_fallbacks[] =
{ V4L2_PIX_FMT_YUV420, V4L2_PIX_FMT_YVU420, V4L2_PIX_FMT_YUV422P,
V4L2_PIX_FMT_YUYV, V4L2_PIX_FMT_UYVY, V4L2_PIX_FMT_MJPEG };
-static struct
+static const struct
{
const char *psz_name;
unsigned int i_cid;
diff --git a/modules/audio_filter/format.c b/modules/audio_filter/format.c
index 78c8b02..2af8f0d 100644
--- a/modules/audio_filter/format.c
+++ b/modules/audio_filter/format.c
@@ -117,7 +117,7 @@ static block_t *S8toU8( filter_t *, block_t * );
static block_t *Swap16( filter_t *, block_t * );
static block_t *Swap24( filter_t *, block_t * );
-static struct
+static const struct
{
vlc_fourcc_t i_src;
vlc_fourcc_t i_dst;
diff --git a/modules/audio_filter/resampler/bandlimited.c b/modules/audio_filter/resampler/bandlimited.c
index a9c1bed..b758739 100644
--- a/modules/audio_filter/resampler/bandlimited.c
+++ b/modules/audio_filter/resampler/bandlimited.c
@@ -51,12 +51,12 @@ static void Close ( vlc_object_t * );
static void DoWork ( aout_instance_t *, aout_filter_t *, aout_buffer_t *,
aout_buffer_t * );
-static void FilterFloatUP( float Imp[], float ImpD[], uint16_t Nwing,
+static void FilterFloatUP( const float Imp[], const float ImpD[], uint16_t Nwing,
float *f_in, float *f_out, uint32_t ui_remainder,
uint32_t ui_output_rate, int16_t Inc,
int i_nb_channels );
-static void FilterFloatUD( float Imp[], float ImpD[], uint16_t Nwing,
+static void FilterFloatUD( const float Imp[], const float ImpD[], uint16_t Nwing,
float *f_in, float *f_out, uint32_t ui_remainder,
uint32_t ui_output_rate, uint32_t ui_input_rate,
int16_t Inc, int i_nb_channels );
@@ -449,11 +449,11 @@ static void DoWork( aout_instance_t * p_aout, aout_filter_t * p_filter,
}
-void FilterFloatUP( float Imp[], float ImpD[], uint16_t Nwing, float *p_in,
+void FilterFloatUP( const float Imp[], const float ImpD[], uint16_t Nwing, float *p_in,
float *p_out, uint32_t ui_remainder,
uint32_t ui_output_rate, int16_t Inc, int i_nb_channels )
{
- float *Hp, *Hdp, *End;
+ const float *Hp, *Hdp, *End;
float t, temp;
uint32_t ui_linear_remainder;
int i;
@@ -492,12 +492,12 @@ void FilterFloatUP( float Imp[], float ImpD[], uint16_t Nwing, float *p_in,
}
}
-void FilterFloatUD( float Imp[], float ImpD[], uint16_t Nwing, float *p_in,
+void FilterFloatUD( const float Imp[], const float ImpD[], uint16_t Nwing, float *p_in,
float *p_out, uint32_t ui_remainder,
uint32_t ui_output_rate, uint32_t ui_input_rate,
int16_t Inc, int i_nb_channels )
{
- float *Hp, *Hdp, *End;
+ const float *Hp, *Hdp, *End;
float t, temp;
uint32_t ui_linear_remainder;
int i, ui_counter = 0;
diff --git a/modules/audio_filter/resampler/bandlimited.h b/modules/audio_filter/resampler/bandlimited.h
index 3124558..5ef1827 100644
--- a/modules/audio_filter/resampler/bandlimited.h
+++ b/modules/audio_filter/resampler/bandlimited.h
@@ -46,7 +46,7 @@
#define SMALL_FILTER_NMULT ((int16_t)13)
#define SMALL_FILTER_SCALE 13128 /* Unity-gain scale factor */
#define SMALL_FILTER_NWING 1536 /* Filter table length */
-static float SMALL_FILTER_FLOAT_IMP[] /* Impulse response */ = {
+static const float SMALL_FILTER_FLOAT_IMP[] /* Impulse response */ = {
0.900000,
0.899980,
0.899920,
@@ -1585,7 +1585,7 @@ static float SMALL_FILTER_FLOAT_IMP[] /* Impulse response */ = {
-0.000046
};
-static float SMALL_FILTER_FLOAT_IMPD[] /* Impulse response */ = {
+static const float SMALL_FILTER_FLOAT_IMPD[] /* Impulse response */ = {
-0.000020,
-0.000060,
-0.000100,
diff --git a/modules/audio_output/file.c b/modules/audio_output/file.c
index 07da0fe..b6046d2 100644
--- a/modules/audio_output/file.c
+++ b/modules/audio_output/file.c
@@ -56,7 +56,7 @@ struct aout_sys_t
};
#define CHANNELS_MAX 6
-static int pi_channels_maps[CHANNELS_MAX+1] =
+static const int pi_channels_maps[CHANNELS_MAX+1] =
{
0,
AOUT_CHAN_CENTER,
@@ -138,7 +138,7 @@ static int Open( vlc_object_t * p_this )
{
aout_instance_t * p_aout = (aout_instance_t *)p_this;
char * psz_name, * psz_format;
- const char ** ppsz_compare = format_list;
+ const char * const * ppsz_compare = format_list;
vlc_value_t val;
int i_channels, i = 0;
diff --git a/modules/codec/araw.c b/modules/codec/araw.c
index e75e2d4..36d826b 100644
--- a/modules/codec/araw.c
+++ b/modules/codec/araw.c
@@ -508,7 +508,7 @@ struct encoder_sys_t
int i_s16tolog; /* used with int16_t to m/alaw */
};
-static int8_t alaw_encode[2049] =
+static const int8_t alaw_encode[2049] =
{
0xD5, 0xD4, 0xD7, 0xD6, 0xD1, 0xD0, 0xD3, 0xD2, 0xDD, 0xDC, 0xDF, 0xDE,
0xD9, 0xD8, 0xDB, 0xDA, 0xC5, 0xC4, 0xC7, 0xC6, 0xC1, 0xC0, 0xC3, 0xC2,
@@ -683,7 +683,7 @@ static int8_t alaw_encode[2049] =
0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0x2A
}; /* alaw_encode */
-static int8_t ulaw_encode[8193] =
+static const int8_t ulaw_encode[8193] =
{
0xFF, 0xFE, 0xFE, 0xFD, 0xFD, 0xFC, 0xFC, 0xFB, 0xFB, 0xFA, 0xFA, 0xF9,
0xF9, 0xF8, 0xF8, 0xF7, 0xF7, 0xF6, 0xF6, 0xF5, 0xF5, 0xF4, 0xF4, 0xF3,
diff --git a/modules/codec/avcodec/audio.c b/modules/codec/avcodec/audio.c
index 7ea107b..55a71d3 100644
--- a/modules/codec/avcodec/audio.c
+++ b/modules/codec/avcodec/audio.c
@@ -45,7 +45,7 @@
#include "avcodec.h"
-static unsigned int pi_channels_maps[7] =
+static const unsigned int pi_channels_maps[7] =
{
0,
AOUT_CHAN_CENTER, AOUT_CHAN_LEFT | AOUT_CHAN_RIGHT,
diff --git a/modules/codec/avcodec/avutil.h b/modules/codec/avcodec/avutil.h
index d7e5548..4ce1370 100644
--- a/modules/codec/avcodec/avutil.h
+++ b/modules/codec/avcodec/avutil.h
@@ -30,7 +30,7 @@ void LibavutilCallback( void *p_opaque, int i_level,
{
int i_vlc_level;
AVCodecContext *p_avctx = (AVCodecContext *)p_opaque;
- AVClass *p_avc;
+ const AVClass *p_avc;
vlc_object_t *p_this;
char *psz_new_format;
const char *psz_item_name;
diff --git a/modules/codec/avcodec/fourcc.h b/modules/codec/avcodec/fourcc.h
index 8597e0c..4a8b2bd 100644
--- a/modules/codec/avcodec/fourcc.h
+++ b/modules/codec/avcodec/fourcc.h
@@ -25,7 +25,7 @@
/*****************************************************************************
* Codec fourcc -> ffmpeg_id mapping
*****************************************************************************/
-static struct
+static const struct
{
vlc_fourcc_t i_fourcc;
int i_codec;
diff --git a/modules/codec/flac.c b/modules/codec/flac.c
index 0f9620a..f346c71 100644
--- a/modules/codec/flac.c
+++ b/modules/codec/flac.c
@@ -107,7 +107,7 @@ enum {
STATE_SEND_DATA
};
-static int pi_channels_maps[7] =
+static const int pi_channels_maps[7] =
{
0,
AOUT_CHAN_CENTER,
@@ -1121,7 +1121,7 @@ static uint64_t read_utf8( const uint8_t *p_buf, int *pi_read )
}
/* CRC-8, poly = x^8 + x^2 + x^1 + x^0, init = 0 */
-static uint8_t const flac_crc8_table[256] = {
+static const uint8_t flac_crc8_table[256] = {
0x00, 0x07, 0x0E, 0x09, 0x1C, 0x1B, 0x12, 0x15,
0x38, 0x3F, 0x36, 0x31, 0x24, 0x23, 0x2A, 0x2D,
0x70, 0x77, 0x7E, 0x79, 0x6C, 0x6B, 0x62, 0x65,
diff --git a/modules/codec/quicktime.c b/modules/codec/quicktime.c
index 1487920..f716b13 100644
--- a/modules/codec/quicktime.c
+++ b/modules/codec/quicktime.c
@@ -203,7 +203,7 @@ struct decoder_sys_t
int i_out;
};
-static int pi_channels_maps[6] =
+static const int pi_channels_maps[6] =
{
0,
AOUT_CHAN_CENTER,
diff --git a/modules/codec/realaudio.c b/modules/codec/realaudio.c
index 1eb45e0..c496908 100644
--- a/modules/codec/realaudio.c
+++ b/modules/codec/realaudio.c
@@ -155,7 +155,7 @@ typedef struct __attribute__((__packed__)) {
void *__builtin_new(unsigned long size) {return malloc(size);}
void __builtin_delete(void *p) {free(p);}
-static int pi_channels_maps[7] =
+static const int pi_channels_maps[7] =
{
0,
AOUT_CHAN_CENTER,
diff --git a/modules/codec/speex.c b/modules/codec/speex.c
index d30b688..a5ccbbe 100644
--- a/modules/codec/speex.c
+++ b/modules/codec/speex.c
@@ -72,7 +72,7 @@ struct decoder_sys_t
};
-static int pi_channels_maps[6] =
+static const int pi_channels_maps[6] =
{
0,
AOUT_CHAN_CENTER, AOUT_CHAN_LEFT | AOUT_CHAN_RIGHT,
diff --git a/modules/codec/telx.c b/modules/codec/telx.c
index e361760..338a6a3 100644
--- a/modules/codec/telx.c
+++ b/modules/codec/telx.c
@@ -99,7 +99,7 @@ struct decoder_sys_t
mtime_t prev_pts;
int i_page[9];
bool b_erase[9];
- uint16_t * pi_active_national_set[9];
+ const uint16_t * pi_active_national_set[9];
int i_wanted_page, i_wanted_magazine;
bool b_ignore_sub_flag;
};
@@ -119,7 +119,7 @@ struct decoder_sys_t
* 0x08 0x09 0x0a 0x0b 0x0c 0x0d (apparently a control character) 0x0e 0x0f
*/
-static uint16_t ppi_national_subsets[][20] =
+static const uint16_t ppi_national_subsets[][20] =
{
{ 0x00a3, 0x0024, 0x0040, 0x00ab, 0x00bd, 0x00bb, 0x005e, 0x0023,
0x002d, 0x00bc, 0x00a6, 0x00be, 0x00f7 }, /* english ,000 */
diff --git a/modules/codec/vorbis.c b/modules/codec/vorbis.c
index 77e0a22..9bcf02b 100644
--- a/modules/codec/vorbis.c
+++ b/modules/codec/vorbis.c
@@ -95,7 +95,7 @@ struct decoder_sys_t
int pi_chan_table[AOUT_CHAN_MAX];
};
-static int pi_channels_maps[9] =
+static const int pi_channels_maps[9] =
{
0,
AOUT_CHAN_CENTER,
diff --git a/modules/control/dbus.h b/modules/control/dbus.h
index 40dfde1..b1093bd 100644
--- a/modules/control/dbus.h
+++ b/modules/control/dbus.h
@@ -214,17 +214,17 @@ DBUS_METHOD( handle_root );
DBUS_METHOD( handle_player );
DBUS_METHOD( handle_tracklist );
-static DBusObjectPathVTable vlc_dbus_root_vtable = {
+static const DBusObjectPathVTable vlc_dbus_root_vtable = {
NULL, handle_root, /* handler function */
NULL, NULL, NULL, NULL
};
-static DBusObjectPathVTable vlc_dbus_player_vtable = {
+static const DBusObjectPathVTable vlc_dbus_player_vtable = {
NULL, handle_player, /* handler function */
NULL, NULL, NULL, NULL
};
-static DBusObjectPathVTable vlc_dbus_tracklist_vtable = {
+static const DBusObjectPathVTable vlc_dbus_tracklist_vtable = {
NULL, handle_tracklist, /* handler function */
NULL, NULL, NULL, NULL
};
diff --git a/modules/control/http/macros.h b/modules/control/http/macros.h
index 4cddf7c..cf54260 100644
--- a/modules/control/http/macros.h
+++ b/modules/control/http/macros.h
@@ -74,7 +74,7 @@ enum macroType
};
/* Static mapping of macros type to macro strings */
-static struct
+static const struct
{
const char *psz_name;
int i_type;
diff --git a/modules/demux/asademux.c b/modules/demux/asademux.c
index 81dbd88..276d77c 100644
--- a/modules/demux/asademux.c
+++ b/modules/demux/asademux.c
@@ -97,7 +97,7 @@ static int asai_child (iargs);
#undef iargs
/** vm functions. KEEP IN SYNC WITH imports.h! */
-static asa_import_func importfuncs[] = {
+static const asa_import_func importfuncs[] = {
asai_commit,
asai_discard,
asai_break,
diff --git a/modules/demux/asf/libasf.c b/modules/demux/asf/libasf.c
index aea9580..6c75aa7 100644
--- a/modules/demux/asf/libasf.c
+++ b/modules/demux/asf/libasf.c
@@ -1264,7 +1264,7 @@ static void ASF_FreeObject_XXX( asf_object_t *p_obj)
/* */
-static struct
+static const struct
{
const guid_t *p_id;
int i_type;
diff --git a/modules/demux/avi/libavi.c b/modules/demux/avi/libavi.c
index a0b7cc2..add6078 100644
--- a/modules/demux/avi/libavi.c
+++ b/modules/demux/avi/libavi.c
@@ -575,7 +575,7 @@ static void AVI_ChunkFree_indx( avi_chunk_t *p_chk )
-static struct
+static const struct
{
vlc_fourcc_t i_fourcc;
const char *psz_type;
@@ -654,7 +654,7 @@ static void AVI_ChunkFree_nothing( avi_chunk_t *p_chk )
VLC_UNUSED( p_chk );
}
-static struct
+static const struct
{
vlc_fourcc_t i_fourcc;
int (*AVI_ChunkRead_function)( stream_t *s, avi_chunk_t *p_chk );
diff --git a/modules/demux/mkv.cpp b/modules/demux/mkv.cpp
index fbb9759..04c6f1a 100644
--- a/modules/demux/mkv.cpp
+++ b/modules/demux/mkv.cpp
@@ -2478,7 +2478,7 @@ bool matroska_segment_c::Select( mtime_t i_start_time )
!strncmp( tracks[i_track]->psz_codec, "A_AAC/MPEG4/", strlen( "A_AAC/MPEG4/" ) ) )
{
int i_profile, i_srate, sbr = 0;
- static unsigned int i_sample_rates[] =
+ static const unsigned int i_sample_rates[] =
{
96000, 88200, 64000, 48000, 44100, 32000, 24000, 22050,
16000, 12000, 11025, 8000, 7350, 0, 0, 0
diff --git a/modules/demux/mp4/drms.c b/modules/demux/mp4/drms.c
index dba1944..8d7c5ec 100644
--- a/modules/demux/mp4/drms.c
+++ b/modules/demux/mp4/drms.c
@@ -360,7 +360,7 @@ int drms_init( void *_p_drms, uint32_t i_type,
if( p_drms->i_user == 0 && p_drms->i_key == 0 )
{
- static char const p_secret[] = "tr1-th3n.y00_by3";
+ static const char p_secret[] = "tr1-th3n.y00_by3";
memcpy( p_drms->p_key, p_secret, 16 );
REVERSE( p_drms->p_key, 4 );
}
@@ -703,7 +703,7 @@ static void InitShuffle( struct shuffle_s *p_shuffle, uint32_t *p_sys_key,
uint32_t i_version )
{
char p_secret1[] = "Tv!*";
- static char const p_secret2[] = "____v8rhvsaAvOKM____FfUH%798=[;."
+ static const char p_secret2[] = "____v8rhvsaAvOKM____FfUH%798=[;."
"____f8677680a634____ba87fnOIf)(*";
unsigned int i;
@@ -753,7 +753,7 @@ static void DoShuffle( struct shuffle_s *p_shuffle,
static uint32_t i_secret = 0;
- static uint32_t p_secret3[] =
+ static const uint32_t p_secret3[] =
{
0xAAAAAAAA, 0x01757700, 0x00554580, 0x01724500, 0x00424580,
0x01427700, 0x00000080, 0xC1D59D01, 0x80144981, 0x815C8901,
@@ -1506,8 +1506,8 @@ static void TinyShuffle8( uint32_t * p_bordel )
*****************************************************************************/
static int GetSystemKey( uint32_t *p_sys_key, bool b_ipod )
{
- static char const p_secret5[ 8 ] = "YuaFlafu";
- static char const p_secret6[ 8 ] = "zPif98ga";
+ static const char p_secret5[ 8 ] = "YuaFlafu";
+ static const char p_secret6[ 8 ] = "zPif98ga";
struct md5_s md5;
int64_t i_ipod_id;
uint32_t p_system_hash[ 4 ];
@@ -1629,7 +1629,7 @@ static int ReadUserKey( void *_p_drms, uint32_t *p_user_key )
*****************************************************************************/
static int GetUserKey( void *_p_drms, uint32_t *p_user_key )
{
- static char const p_secret7[] = "mUfnpognadfgf873";
+ static const char p_secret7[] = "mUfnpognadfgf873";
struct drms_s *p_drms = (struct drms_s *)_p_drms;
struct aes_s aes;
struct shuffle_s shuffle;
@@ -1885,7 +1885,7 @@ static int HashSystemInfo( uint32_t *p_system_hash )
DWORD i_serial;
LPBYTE p_reg_buf;
- static LPCTSTR p_reg_keys[ 3 ][ 2 ] =
+ static const LPCTSTR p_reg_keys[ 3 ][ 2 ] =
{
{
_T("HARDWARE\\DESCRIPTION\\System"),
diff --git a/modules/demux/playlist/dvb.c b/modules/demux/playlist/dvb.c
index 8145fd3..5bb50cf 100644
--- a/modules/demux/playlist/dvb.c
+++ b/modules/demux/playlist/dvb.c
@@ -135,7 +135,7 @@ static int Demux( demux_t *p_demux )
return 0; /* Needed for correct operation of go back */
}
-static struct
+static const struct
{
const char *psz_name;
const char *psz_option;
diff --git a/modules/demux/rawvid.c b/modules/demux/rawvid.c
index 21bdb4f..542f20a 100644
--- a/modules/demux/rawvid.c
+++ b/modules/demux/rawvid.c
@@ -109,7 +109,7 @@ struct preset_t
const char *psz_chroma;
};
-static struct preset_t p_presets[] =
+static const struct preset_t p_presets[] =
{
{ "sqcif", 128, 96, 29.97, "4:3", "YV12" },
{ "qcif", 176, 144, 29.97, "4:3", "YV12" },
@@ -133,7 +133,7 @@ static int Open( vlc_object_t * p_this )
uint32_t i_chroma;
char *psz_aspect_ratio;
unsigned int i_aspect = 0;
- struct preset_t *p_preset = NULL;
+ const struct preset_t *p_preset = NULL;
const uint8_t *p_peek;
bool b_valid = false;
bool b_y4m = false;
diff --git a/modules/demux/subtitle.c b/modules/demux/subtitle.c
index f7b9ae3..975e6de 100644
--- a/modules/demux/subtitle.c
+++ b/modules/demux/subtitle.c
@@ -170,7 +170,7 @@ static int ParseRealText ( demux_t *, subtitle_t *, int );
static int ParseDKS ( demux_t *, subtitle_t *, int );
static int ParseSubViewer1 ( demux_t *, subtitle_t *, int );
-static struct
+static const struct
{
const char *psz_type_name;
int i_type;
diff --git a/modules/gui/qt4/components/playlist/playlist_model.hpp b/modules/gui/qt4/components/playlist/playlist_model.hpp
index f6e4da8..0341023 100644
--- a/modules/gui/qt4/components/playlist/playlist_model.hpp
+++ b/modules/gui/qt4/components/playlist/playlist_model.hpp
@@ -50,10 +50,10 @@ class PLItem;
#define DEPTH_PL -1
#define DEPTH_SEL 1
-static int ItemUpdate_Type = QEvent::User + PLEventType + 2;
-static int ItemDelete_Type = QEvent::User + PLEventType + 3;
-static int ItemAppend_Type = QEvent::User + PLEventType + 4;
-static int PLUpdate_Type = QEvent::User + PLEventType + 5;
+static const int ItemUpdate_Type = QEvent::User + PLEventType + 2;
+static const int ItemDelete_Type = QEvent::User + PLEventType + 3;
+static const int ItemAppend_Type = QEvent::User + PLEventType + 4;
+static const int PLUpdate_Type = QEvent::User + PLEventType + 5;
class PLEvent : public QEvent
{
diff --git a/modules/gui/qt4/dialogs/help.hpp b/modules/gui/qt4/dialogs/help.hpp
index 10857a0..cc6963d 100644
--- a/modules/gui/qt4/dialogs/help.hpp
+++ b/modules/gui/qt4/dialogs/help.hpp
@@ -85,8 +85,8 @@ public slots:
#ifdef UPDATE_CHECK
-static int UDOkEvent = QEvent::User + DialogEventType + 21;
-static int UDErrorEvent = QEvent::User + DialogEventType + 22;
+static const int UDOkEvent = QEvent::User + DialogEventType + 21;
+static const int UDErrorEvent = QEvent::User + DialogEventType + 22;
class UpdateDialog : public QVLCFrame
{
diff --git a/modules/gui/qt4/qt4.hpp b/modules/gui/qt4/qt4.hpp
index 7b0236c..0d16bc3 100644
--- a/modules/gui/qt4/qt4.hpp
+++ b/modules/gui/qt4/qt4.hpp
@@ -117,10 +117,10 @@ enum {
PLEventType = 200
};
-static int DialogEvent_Type = QEvent::User + DialogEventType + 1;
-//static int PLUndockEvent_Type = QEvent::User + DialogEventType + 2;
-//static int PLDockEvent_Type = QEvent::User + DialogEventType + 3;
-static int SetVideoOnTopEvent_Type = QEvent::User + DialogEventType + 4;
+static const int DialogEvent_Type = QEvent::User + DialogEventType + 1;
+//static const int PLUndockEvent_Type = QEvent::User + DialogEventType + 2;
+//static const int PLDockEvent_Type = QEvent::User + DialogEventType + 3;
+static const int SetVideoOnTopEvent_Type = QEvent::User + DialogEventType + 4;
class DialogEvent : public QEvent
{
diff --git a/modules/misc/freetype.c b/modules/misc/freetype.c
index 4e1906f..7b7de54 100644
--- a/modules/misc/freetype.c
+++ b/modules/misc/freetype.c
@@ -644,7 +644,7 @@ static int LoadFontsFromAttachments( filter_t *p_filter )
static int Render( filter_t *p_filter, subpicture_region_t *p_region,
line_desc_t *p_line, int i_width, int i_height )
{
- static uint8_t pi_gamma[16] =
+ static const uint8_t pi_gamma[16] =
{0x00, 0x52, 0x84, 0x96, 0xb8, 0xca, 0xdc, 0xee, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
diff --git a/modules/misc/lua/demux.c b/modules/misc/lua/demux.c
index 8561aec..8928ee7 100644
--- a/modules/misc/lua/demux.c
+++ b/modules/misc/lua/demux.c
@@ -98,14 +98,14 @@ static int vlclua_demux_readline( lua_State *L )
*
*****************************************************************************/
/* Functions to register */
-static luaL_Reg p_reg[] =
+static const luaL_Reg p_reg[] =
{
{ "peek", vlclua_demux_peek },
{ NULL, NULL }
};
/* Functions to register for parse() function call only */
-static luaL_Reg p_reg_parse[] =
+static const luaL_Reg p_reg_parse[] =
{
{ "read", vlclua_demux_read },
{ "readline", vlclua_demux_readline },
diff --git a/modules/misc/lua/intf.c b/modules/misc/lua/intf.c
index f86acdf..2c4eb88 100644
--- a/modules/misc/lua/intf.c
+++ b/modules/misc/lua/intf.c
@@ -97,7 +97,7 @@ static inline void luaL_register_submodule( lua_State *L, const char *psz_name,
lua_setfield( L, -2, psz_name );
}
-static struct
+static const struct
{
const char *psz_shortcut;
const char *psz_name;
@@ -145,7 +145,7 @@ static char *GetModuleName( intf_thread_t *p_intf )
return config_GetPsz( p_intf, "lua-intf" );
}
-static luaL_Reg p_reg[] = { { NULL, NULL } };
+static const luaL_Reg p_reg[] = { { NULL, NULL } };
int Open_LuaIntf( vlc_object_t *p_this )
{
diff --git a/modules/misc/lua/meta.c b/modules/misc/lua/meta.c
index 524ce2a..3680789 100644
--- a/modules/misc/lua/meta.c
+++ b/modules/misc/lua/meta.c
@@ -58,7 +58,7 @@ static lua_State *vlclua_meta_init( vlc_object_t *p_this,
/*****************************************************************************
* Init lua
*****************************************************************************/
-static luaL_Reg p_reg[] = { { NULL, NULL } };
+static const luaL_Reg p_reg[] = { { NULL, NULL } };
static lua_State * vlclua_meta_init( vlc_object_t *p_this, input_item_t * p_item )
{
diff --git a/modules/misc/win32text.c b/modules/misc/win32text.c
index 6318570..f1b8f17 100644
--- a/modules/misc/win32text.c
+++ b/modules/misc/win32text.c
@@ -133,7 +133,7 @@ struct filter_sys_t
int i_logpy;
};
-static uint8_t pi_gamma[16] =
+static const uint8_t pi_gamma[16] =
{0x00, 0x41, 0x52, 0x63, 0x84, 0x85, 0x96, 0xa7, 0xb8, 0xc9,
0xca, 0xdb, 0xdc, 0xed, 0xee, 0xff};
diff --git a/modules/mux/mp4.c b/modules/mux/mp4.c
index eb50dbf..7386258 100644
--- a/modules/mux/mp4.c
+++ b/modules/mux/mp4.c
@@ -1533,7 +1533,7 @@ static bo_t *GetStblBox( sout_mux_t *p_mux, mp4_stream_t *p_stream )
static int64_t get_timestamp(void);
-static uint32_t mvhd_matrix[9] =
+static const uint32_t mvhd_matrix[9] =
{ 0x10000, 0, 0, 0, 0x10000, 0, 0, 0, 0x40000000 };
static bo_t *GetMoovBox( sout_mux_t *p_mux )
diff --git a/modules/stream_out/transcode.c b/modules/stream_out/transcode.c
index eceda3b..79f6a4c 100644
--- a/modules/stream_out/transcode.c
+++ b/modules/stream_out/transcode.c
@@ -287,7 +287,7 @@ static int transcode_osd_process( sout_stream_t *, sout_stream_id_t *,
static int EncoderThread( struct sout_stream_sys_t * p_sys );
-static int pi_channels_maps[6] =
+static const int pi_channels_maps[6] =
{
0,
AOUT_CHAN_CENTER, AOUT_CHAN_LEFT | AOUT_CHAN_RIGHT,
diff --git a/modules/video_chroma/i420_rgb8.c b/modules/video_chroma/i420_rgb8.c
index 9528ffa..78ed5c6 100644
--- a/modules/video_chroma/i420_rgb8.c
+++ b/modules/video_chroma/i420_rgb8.c
@@ -70,15 +70,15 @@ void I420_RGB8( filter_t *p_filter, picture_t *p_src, picture_t *p_dest )
- p_src->p[1].i_visible_pitch;
/* The dithering matrices */
- static int dither10[4] = { 0x0, 0x8, 0x2, 0xa };
- static int dither11[4] = { 0xc, 0x4, 0xe, 0x6 };
- static int dither12[4] = { 0x3, 0xb, 0x1, 0x9 };
- static int dither13[4] = { 0xf, 0x7, 0xd, 0x5 };
-
- static int dither20[4] = { 0x0, 0x10, 0x4, 0x14 };
- static int dither21[4] = { 0x18, 0x8, 0x1c, 0xc };
- static int dither22[4] = { 0x6, 0x16, 0x2, 0x12 };
- static int dither23[4] = { 0x1e, 0xe, 0x1a, 0xa };
+ static const int dither10[4] = { 0x0, 0x8, 0x2, 0xa };
+ static const int dither11[4] = { 0xc, 0x4, 0xe, 0x6 };
+ static const int dither12[4] = { 0x3, 0xb, 0x1, 0x9 };
+ static const int dither13[4] = { 0xf, 0x7, 0xd, 0x5 };
+
+ static const int dither20[4] = { 0x0, 0x10, 0x4, 0x14 };
+ static const int dither21[4] = { 0x18, 0x8, 0x1c, 0xc };
+ static const int dither22[4] = { 0x6, 0x16, 0x2, 0x12 };
+ static const int dither23[4] = { 0x1e, 0xe, 0x1a, 0xa };
SetOffset( p_filter->fmt_in.video.i_width,
p_filter->fmt_in.video.i_height,
diff --git a/modules/video_filter/atmo/atmo.cpp b/modules/video_filter/atmo/atmo.cpp
index 10f728c..79b4ddb 100644
--- a/modules/video_filter/atmo/atmo.cpp
+++ b/modules/video_filter/atmo/atmo.cpp
@@ -217,12 +217,12 @@ strings for settings menus and hints
#define FILTERMODE_TEXT N_("Filter mode")
#define FILTERMODE_LONGTEXT N_("kind of filtering which should be use to "\
"calcuate the color output")
-static int pi_filtermode_values[] = {
+static const int pi_filtermode_values[] = {
(int)afmNoFilter,
(int)afmCombined,
(int)afmPercent
};
-static const char *ppsz_filtermode_descriptions[] = {
+static const char *const ppsz_filtermode_descriptions[] = {
N_("No Filtering"),
N_("Combined"),
N_("Percent")
@@ -242,7 +242,7 @@ static const char *ppsz_filtermode_descriptions[] = {
#define CHANNELASSIGN_LONGTEXT N_("Maps the hardware channel X to logical "\
"channel Y to fix wrong wiring :-)")
-static int pi_channel_assignment_values[] = {
+static const int pi_channel_assignment_values[] = {
-1,
0,
1,
@@ -250,7 +250,7 @@ static int pi_channel_assignment_values[] = {
3,
4
};
-static const char *ppsz_channel_assignment_descriptions[] = {
+static const char *const ppsz_channel_assignment_descriptions[] = {
N_("disabled"),
N_("summary"),
N_("left"),
diff --git a/modules/video_filter/dynamicoverlay/dynamicoverlay_commands.c b/modules/video_filter/dynamicoverlay/dynamicoverlay_commands.c
index 03e7f2f..b50acd0 100644
--- a/modules/video_filter/dynamicoverlay/dynamicoverlay_commands.c
+++ b/modules/video_filter/dynamicoverlay/dynamicoverlay_commands.c
@@ -792,7 +792,7 @@ static int exec_StartAtomic( filter_t *p_filter,
/*****************************************************************************
* Command functions
*****************************************************************************/
-static commanddesc_t p_commands[] =
+static const commanddesc_t p_commands[] =
{
{ .psz_command = "DataSharedMem",
.b_atomic = true,
diff --git a/modules/video_output/sdl.c b/modules/video_output/sdl.c
index 0bc7de1..96513e5 100644
--- a/modules/video_output/sdl.c
+++ b/modules/video_output/sdl.c
@@ -638,7 +638,7 @@ static int Manage( vout_thread_t *p_vout )
/*****************************************************************************
* Key events handling
*****************************************************************************/
-static struct
+static const struct
{
SDLKey sdl_key;
int i_vlckey;
diff --git a/modules/video_output/x11/xvmc.c b/modules/video_output/x11/xvmc.c
index 5b1dad4..03c0a49 100644
--- a/modules/video_output/x11/xvmc.c
+++ b/modules/video_output/x11/xvmc.c
@@ -155,7 +155,7 @@ vlc_module_end();
/* following functions are local */
-static unsigned accel_priority[] = {
+static const unsigned accel_priority[] = {
VLC_XVMC_ACCEL_VLD,
};
diff --git a/modules/visualization/visual/visual.c b/modules/visualization/visual/visual.c
index 2a265f8..e2f2974 100644
--- a/modules/visualization/visual/visual.c
+++ b/modules/visualization/visual/visual.c
@@ -167,7 +167,7 @@ static void DoWork( aout_instance_t *, aout_filter_t *,
aout_buffer_t *, aout_buffer_t * );
static int FilterCallback( vlc_object_t *, char const *,
vlc_value_t, vlc_value_t, void * );
-static struct
+static const struct
{
const char *psz_name;
int (*pf_run)( visual_effect_t *, aout_instance_t *,
diff --git a/src/extras/getopt1.c b/src/extras/getopt1.c
index 5a7be92..c10b906 100644
--- a/src/extras/getopt1.c
+++ b/src/extras/getopt1.c
@@ -108,7 +108,7 @@ int
{
int this_option_optind = optind ? optind : 1;
int option_index = 0;
- static struct option long_options[] =
+ static const struct option long_options[] =
{
{"add", 1, 0, 0},
{"append", 0, 0, 0},
diff --git a/src/misc/image.c b/src/misc/image.c
index 6f837eb..a1f8b53 100644
--- a/src/misc/image.c
+++ b/src/misc/image.c
@@ -502,7 +502,7 @@ static picture_t *ImageFilter( image_handler_t *p_image, picture_t *p_pic,
* Misc functions
*
*/
-static struct
+static const struct
{
vlc_fourcc_t i_codec;
const char *psz_ext;
diff --git a/src/misc/mtime.c b/src/misc/mtime.c
index 9966e47..d9af9fd 100644
--- a/src/misc/mtime.c
+++ b/src/misc/mtime.c
@@ -102,7 +102,7 @@ int nanosleep(struct timespec *, struct timespec *);
*/
char *mstrtime( char *psz_buffer, mtime_t date )
{
- static mtime_t ll1000 = 1000, ll60 = 60, ll24 = 24;
+ static const mtime_t ll1000 = 1000, ll60 = 60, ll24 = 24;
snprintf( psz_buffer, MSTRTIME_MAX_SIZE, "%02d:%02d:%02d-%03d.%03d",
(int) (date / (ll1000 * ll1000 * ll60 * ll60) % ll24),
diff --git a/src/network/httpd.c b/src/network/httpd.c
index 86c7745..910d9c6 100644
--- a/src/network/httpd.c
+++ b/src/network/httpd.c
@@ -189,7 +189,7 @@ struct httpd_client_t
/*****************************************************************************
* Various functions
*****************************************************************************/
-static struct
+static const struct
{
const char psz_ext[8];
const char *psz_mime;
--
1.5.6.3
More information about the vlc-devel
mailing list