Constify some static arrays everywhere

This commit is contained in:
Sebastian Dröge 2015-01-21 10:17:04 +01:00
parent 8941fcacec
commit 80e02cbdf9
29 changed files with 71 additions and 70 deletions

View file

@ -76,7 +76,7 @@ GType
gst_apexsink_jackstatus_get_type (void)
{
static GType jackstatus_type = 0;
static GEnumValue jackstatus[] = {
static const GEnumValue jackstatus[] = {
{GST_APEX_JACK_STATUS_UNDEFINED, "GST_APEX_JACK_STATUS_UNDEFINED",
"Jack status undefined"},
{GST_APEX_JACK_STATUS_DISCONNECTED, "GST_APEX_JACK_STATUS_DISCONNECTED",
@ -97,7 +97,7 @@ GType
gst_apexsink_jacktype_get_type (void)
{
static GType jacktype_type = 0;
static GEnumValue jacktype[] = {
static const GEnumValue jacktype[] = {
{GST_APEX_JACK_TYPE_UNDEFINED, "GST_APEX_JACK_TYPE_UNDEFINED",
"Undefined jack type"},
{GST_APEX_JACK_TYPE_ANALOG, "GST_APEX_JACK_TYPE_ANALOG", "Analog jack"},
@ -116,7 +116,7 @@ GType
gst_apexsink_generation_get_type (void)
{
static GType generation_type = 0;
static GEnumValue generation[] = {
static const GEnumValue generation[] = {
{GST_APEX_GENERATION_ONE, "generation-one",
"First generation (e.g., original AirPort Express)"},
{GST_APEX_GENERATION_TWO, "generation-two",
@ -135,7 +135,7 @@ GType
gst_apexsink_transport_protocol_get_type (void)
{
static GType transport_protocol_type = 0;
static GEnumValue transport_protocol[] = {
static const GEnumValue transport_protocol[] = {
{GST_APEX_TCP, "tcp", "TCP"},
{GST_APEX_UDP, "udp", "UDP"},
{0, NULL, NULL},

View file

@ -71,7 +71,7 @@ static GType
gst_afsink_types_get_type (void)
{
static GType afsink_types_type = 0;
static GEnumValue afsink_types[] = {
static const GEnumValue afsink_types[] = {
{AF_FILE_RAWDATA, "0", "raw PCM"},
{AF_FILE_AIFFC, "1", "AIFFC"},
{AF_FILE_AIFF, "2", "AIFF"},

View file

@ -70,7 +70,7 @@ static GType
gst_afsrc_types_get_type (void)
{
static GType afsrc_types_type = 0;
static GEnumValue afsrc_types[] = {
static const GEnumValue afsrc_types[] = {
{AF_FILE_RAWDATA, "0", "raw PCM"},
{AF_FILE_AIFFC, "1", "AIFFC"},
{AF_FILE_AIFF, "2", "AIFF"},

View file

@ -82,7 +82,7 @@ typedef struct
gint preset;
} GstBs2bPreset;
static GstBs2bPreset presets[3] = {
static const GstBs2bPreset presets[3] = {
{
"default",
"Closest to virtual speaker placement (30°, 3 meter) [700Hz, 4.5dB]",

View file

@ -2536,7 +2536,7 @@ static gchar *
gst_mpdparser_build_URL_from_template (const gchar * url_template,
const gchar * id, guint number, guint bandwidth, guint64 time)
{
static gchar default_format[] = "%01d";
static const gchar default_format[] = "%01d";
gchar **tokens, *token, *ret;
const gchar *format;
gint i, num_tokens;
@ -2719,14 +2719,14 @@ gst_mpdparser_parse_baseURL (GstMpdClient * client, GstActiveStream * stream,
gchar ** query)
{
GstStreamPeriod *stream_period;
static gchar empty[] = "";
static const gchar empty[] = "";
gchar *ret = NULL;
GstUri *abs_url;
g_return_val_if_fail (stream != NULL, empty);
g_return_val_if_fail (stream != NULL, g_strdup (empty));
stream_period = gst_mpdparser_get_stream_period (client);
g_return_val_if_fail (stream_period != NULL, empty);
g_return_val_if_fail (stream_period->period != NULL, empty);
g_return_val_if_fail (stream_period != NULL, g_strdup (empty));
g_return_val_if_fail (stream_period->period != NULL, g_strdup (empty));
/* NULLify query return before we start */
if (query)

View file

@ -152,7 +152,7 @@ gst_faac_brtype_get_type (void)
static GType gst_faac_brtype_type = 0;
if (!gst_faac_brtype_type) {
static GEnumValue gst_faac_brtype[] = {
static const GEnumValue gst_faac_brtype[] = {
{VBR, "VBR", "VBR encoding"},
{ABR, "ABR", "ABR encoding"},
{0, NULL, NULL},
@ -172,7 +172,7 @@ gst_faac_shortctl_get_type (void)
static GType gst_faac_shortctl_type = 0;
if (!gst_faac_shortctl_type) {
static GEnumValue gst_faac_shortctl[] = {
static const GEnumValue gst_faac_shortctl[] = {
{SHORTCTL_NORMAL, "SHORTCTL_NORMAL", "Normal block type"},
{SHORTCTL_NOSHORT, "SHORTCTL_NOSHORT", "No short blocks"},
{SHORTCTL_NOLONG, "SHORTCTL_NOLONG", "No long blocks"},

View file

@ -77,9 +77,9 @@ static void gst_gl_filter_reflected_screen_draw_separated_screen (GstGLFilter *
static void gst_gl_filter_reflected_screen_callback (gint width, gint height,
guint texture, gpointer stuff);
static GLfloat LightPos[] = { 4.0f, -4.0f, 6.0f, 1.0f }; // Light Position
static GLfloat LightAmb[] = { 4.0f, 4.0f, 4.0f, 1.0f }; // Ambient Light
static GLfloat LightDif[] = { 1.0f, 1.0f, 1.0f, 1.0f }; // Diffuse Light
static const GLfloat LightPos[] = { 4.0f, -4.0f, 6.0f, 1.0f }; // Light Position
static const GLfloat LightAmb[] = { 4.0f, 4.0f, 4.0f, 1.0f }; // Ambient Light
static const GLfloat LightDif[] = { 1.0f, 1.0f, 1.0f, 1.0f }; // Diffuse Light
static void
gst_gl_filter_reflected_screen_class_init (GstGLFilterReflectedScreenClass *

View file

@ -52,7 +52,7 @@ gst_openh264enc_usage_type_get_type (void)
static GType usage_type = 0;
if (!usage_type) {
static GEnumValue usage_types[] = {
static const GEnumValue usage_types[] = {
{CAMERA_VIDEO_REAL_TIME, "video from camera", "camera"},
{SCREEN_CONTENT_REAL_TIME, "screen content", "screen"},
{0, NULL, NULL},
@ -71,7 +71,7 @@ gst_openh264enc_rc_modes_get_type (void)
static GType rc_modes_type = 0;
if (!rc_modes_type) {
static GEnumValue rc_modes_types[] = {
static const GEnumValue rc_modes_types[] = {
{RC_QUALITY_MODE, "Quality mode", "quality"},
{RC_BITRATE_MODE, "Bitrate mode", "bitrate"},
{RC_BUFFERBASED_MODE, "No bitrate control, just using buffer status", "buffer"},

View file

@ -57,7 +57,7 @@ static GType
gst_voamrwbenc_bandmode_get_type (void)
{
static GType gst_voamrwbenc_bandmode_type = 0;
static GEnumValue gst_voamrwbenc_bandmode[] = {
static const GEnumValue gst_voamrwbenc_bandmode[] = {
{MR660, "MR660", "MR660"},
{MR885, "MR885", "MR885"},
{MR1265, "MR1265", "MR1265"},

View file

@ -151,7 +151,7 @@ typedef struct
} PAR;
/* Table E-1 - Meaning of sample aspect ratio indicator (1..16) */
static PAR aspect_ratios[17] = {
static const PAR aspect_ratios[17] = {
{0, 0},
{1, 1},
{12, 11},

View file

@ -137,7 +137,7 @@ typedef struct
} PAR;
/* Table E-1 - Meaning of sample aspect ratio indicator (1..16) */
static PAR aspect_ratios[17] = {
static const PAR aspect_ratios[17] = {
{0, 0},
{1, 1},
{12, 11},

View file

@ -242,7 +242,7 @@ typedef struct
gint par_n, par_d;
} PAR;
static PAR aspect_ratios[] = {
static const PAR aspect_ratios[] = {
{0, 0},
{1, 1},
{12, 11},

View file

@ -63,7 +63,7 @@ struct _GstGLUploadPrivate
GstBuffer *outbuf;
UploadMethod *method;
const UploadMethod *method;
gpointer method_impl;
int method_i;
};
@ -169,7 +169,7 @@ _gl_memory_upload_free (gpointer impl)
g_free (impl);
}
static UploadMethod _gl_memory_upload = {
static const UploadMethod _gl_memory_upload = {
"GLMemory",
METHOD_FLAG_CAN_SHARE_CONTEXT,
&_gl_memory_upload_new,
@ -281,7 +281,7 @@ _egl_image_upload_free (gpointer impl)
g_free (impl);
}
static UploadMethod _egl_image_upload = {
static const UploadMethod _egl_image_upload = {
"EGLImage",
0,
&_egl_image_upload_new,
@ -433,7 +433,7 @@ _upload_meta_upload_free (gpointer impl)
g_free (upload);
}
static UploadMethod _upload_meta_upload = {
static const UploadMethod _upload_meta_upload = {
"UploadMeta",
METHOD_FLAG_CAN_SHARE_CONTEXT,
&_upload_meta_upload_new,
@ -536,7 +536,7 @@ _raw_data_upload_free (gpointer impl)
g_free (raw);
}
static UploadMethod _raw_data_upload = {
static const UploadMethod _raw_data_upload = {
"Raw Data",
0,
&_raw_data_upload_new,
@ -546,7 +546,7 @@ static UploadMethod _raw_data_upload = {
&_raw_data_upload_free
};
static UploadMethod *upload_methods[] = { &_gl_memory_upload,
static const UploadMethod *upload_methods[] = { &_gl_memory_upload,
#if GST_GL_HAVE_PLATFORM_EGL
&_egl_image_upload,
#endif

View file

@ -100,7 +100,7 @@ adpcmenc_layout_get_type (void)
static GType adpcmenc_layout_type = 0;
if (!adpcmenc_layout_type) {
static GEnumValue layout_types[] = {
static const GEnumValue layout_types[] = {
{LAYOUT_ADPCM_DVI, "DVI/IMA APDCM", "dvi"},
{0, NULL, NULL},
};

View file

@ -120,7 +120,7 @@ static gboolean gst_freeverb_transform_s2s_float (GstFreeverb * filter,
/* Table with processing functions: [channels][format] */
static GstFreeverbProcessFunc process_functions[2][2] = {
static const GstFreeverbProcessFunc process_functions[2][2] = {
{
(GstFreeverbProcessFunc) gst_freeverb_transform_m2s_int,
(GstFreeverbProcessFunc) gst_freeverb_transform_m2s_float,

View file

@ -36,12 +36,12 @@ static void unscrun (unsigned long *, unsigned char *);
static void desfunc (unsigned long *, unsigned long *);
static void cookey (DESContext * ctx, unsigned long *);
//static unsigned long KnL[32] = { 0L };
//static const unsigned long KnL[32] = { 0L };
//static unsigned long KnR[32] = { 0L };
//static unsigned long Kn3[32] = { 0L };
//static const unsigned long KnR[32] = { 0L };
//static const unsigned long Kn3[32] = { 0L };
/*
* static unsigned char Df_Key[24] = {
* static const unsigned char Df_Key[24] = {
* 0x01,0x23,0x45,0x67,0x89,0xab,0xcd,0xef,
* 0xfe,0xdc,0xba,0x98,0x76,0x54,0x32,0x10,
* 0x89,0xab,0xcd,0xef,0x01,0x23,0x45,0x67 };

View file

@ -49,7 +49,7 @@
#endif
/* This must match decoder and encoder tables */
static double picture_rates[16] = {
static const double picture_rates[16] = {
0.0,
24000.0 / 1001.,
24.0,
@ -76,10 +76,10 @@ static double ratio [16] = { 0., 1., 0.6735, 0.7031, 0.7615, 0.8055,
*/
#ifndef GST_DISABLE_GST_DEBUG
static char picture_types[4][3] = { "I", "P", "B", "D" };
static const char picture_types[4][3] = { "I", "P", "B", "D" };
#endif
static int bitrate_index[2][3][16] =
static const int bitrate_index[2][3][16] =
{ {{0, 32, 64, 96, 128, 160, 192, 224, 256, 288, 320, 352, 384, 416, 448,},
{0, 32, 48, 56, 64, 80, 96, 112, 128, 160, 192, 224, 256, 320, 384,},
{0, 32, 40, 48, 56, 64, 80, 96, 112, 128, 160, 192, 224, 256, 320,}},
@ -88,21 +88,22 @@ static int bitrate_index[2][3][16] =
{0, 8, 16, 24, 32, 40, 48, 56, 64, 80, 96, 112, 128, 144, 160,}},
};
static long frequency[9] =
static const long frequency[9] =
{ 44100, 48000, 32000, 22050, 24000, 16000, 11025, 12000, 8000 };
static double dfrequency[9] = { 44.1, 48, 32, 22.05, 24, 16, 11.025, 12, 8 };
static const double dfrequency[9] =
{ 44.1, 48, 32, 22.05, 24, 16, 11.025, 12, 8 };
static unsigned int samples[4] = { 192, 384, 1152, 1152 };
static const unsigned int samples[4] = { 192, 384, 1152, 1152 };
/* deined but not used
static char mode [4][15] =
static const char mode [4][15] =
{ "stereo", "joint stereo", "dual channel", "single channel" };
static char copyright [2][20] =
static const char copyright [2][20] =
{ "no copyright","copyright protected" };
static char original [2][10] =
static const char original [2][10] =
{ "copy","original" };
static char emphasis [4][20] =
static const char emphasis [4][20] =
{ "none", "50/15 microseconds", "reserved", "CCITT J.17" };
*/
static void mpeg1mux_buffer_update_video_info (Mpeg1MuxBuffer * mb);

View file

@ -40,7 +40,7 @@
* SOFTWARE.
*/
static guint32 crc_tab[256] = {
static const guint32 crc_tab[256] = {
0x00000000, 0x04c11db7, 0x09823b6e, 0x0d4326d9, 0x130476dc, 0x17c56b6b,
0x1a864db2, 0x1e475005, 0x2608edb8, 0x22c9f00f, 0x2f8ad6d6, 0x2b4bcb61,
0x350c9b64, 0x31cd86d3, 0x3c8ea00a, 0x384fbdbd, 0x4c11db70, 0x48d0c6c7,

View file

@ -299,7 +299,7 @@ typedef struct
gboolean valid;
} Patch;
static Color patch_colors[24] = {
static const Color patch_colors[24] = {
{115, 82, 68, 92, 119, 143},
{194, 150, 130, 152, 115, 148},
{98, 122, 157, 119, 146, 116},

View file

@ -32,7 +32,7 @@
#define FILTERS_H
///////// Filter Settings //////////
static long flt_set[3] = {10, 9, 10};
static const long flt_set[3] = {10, 9, 10};
static void
memshl (register long *pA, register long *pB) {

View file

@ -96,7 +96,7 @@ static GType
gst_vbidec_caption_type_get_type (void)
{
static GType vbidec_caption_type_type = 0;
static GEnumValue vbidec_caption_type[] = {
static const GEnumValue vbidec_caption_type[] = {
{CAPTURE_OFF, "0", "Closed Captions off"},
{CAPTURE_CC1, "1", "Closed Caption CC1"},
{CAPTURE_CC2, "2", "Closed Caption CC2"},

View file

@ -96,21 +96,21 @@ struct vbidata_s
/* this is NOT exactly right */
//static char ccode[] = " !\"#$%&'()\0341+,-./0123456789:;<=>?@"
static char ccode[] = " !\"#$%&'()a+,-./0123456789:;<=>?@"
static const char ccode[] = " !\"#$%&'()a+,-./0123456789:;<=>?@"
"ABCDEFGHIJKLMNOPQRSTUVWXYZ"
// "abcdefghijklmnopqrstuvwxyz"
// "[\0351]\0355\0363\0372abcdefghijklmnopqr"
"[e]iouabcdefghijklmnopqr"
// "stuvwxyz\0347\0367\0245\0244\0240";
"stuvwxyzcoNn ";
static char wccode[] = "\0256\0260\0275\0277T\0242\0243#\0340 "
static const char wccode[] = "\0256\0260\0275\0277T\0242\0243#\0340 "
"\0350\0354\0362\0371";
static char extcode1[] = "\0301\0311\0323\0332\0334\0374"
static const char extcode1[] = "\0301\0311\0323\0332\0334\0374"
"`\0241*'-\0251S*\"\"\0300\0302"
"\0307\0310\0312\0313\0353\0316\0317\0357" "\0324\0331\0371\0333\0253\0273";
static char extcode2[] = "\0303\0343\0315\0314\0354\0322\0362\0325"
static const char extcode2[] = "\0303\0343\0315\0314\0354\0322\0362\0325"
"{}\\^_|~\0304\0344\0326\0366\0337\0245\0244|" "\0305\0345\0330\0370++++";
int

View file

@ -47,7 +47,7 @@ typedef struct
const gchar *description;
} CamTagMessage;
static CamTagMessage debugmessage[] = {
static const CamTagMessage debugmessage[] = {
{TAG_PROFILE_ENQUIRY, "PROFILE_ENQUIRY"},
{TAG_PROFILE_REPLY, "PROFILE_REPLY"},
{TAG_PROFILE_CHANGE, "PROFILE_CHANGE"},

View file

@ -63,7 +63,7 @@ typedef struct
const gchar *description;
} CamTagMessage;
static CamTagMessage debugmessage[] = {
static const CamTagMessage debugmessage[] = {
{TAG_SB, "SB"},
{TAG_RCV, "RCV"},
{TAG_CREATE_T_C, "CREATE_T_C"},

View file

@ -475,7 +475,7 @@ dvb_base_bin_reset (DvbBaseBin * dvbbasebin)
dvbbasebin->trycam = TRUE;
}
static gint16 initial_pids[] = { 0, 1, 0x10, 0x11, 0x12, 0x14, -1 };
static const gint16 initial_pids[] = { 0, 1, 0x10, 0x11, 0x12, 0x14, -1 };
static void
dvb_base_bin_init (DvbBaseBin * dvbbasebin)

View file

@ -257,7 +257,7 @@ static GType
gst_dvbsrc_code_rate_get_type (void)
{
static GType dvbsrc_code_rate_type = 0;
static GEnumValue code_rate_types[] = {
static const GEnumValue code_rate_types[] = {
{FEC_NONE, "NONE", "none"},
{FEC_1_2, "1/2", "1/2"},
{FEC_2_3, "2/3", "2/3"},
@ -286,7 +286,7 @@ static GType
gst_dvbsrc_modulation_get_type (void)
{
static GType dvbsrc_modulation_type = 0;
static GEnumValue modulation_types[] = {
static const GEnumValue modulation_types[] = {
{QPSK, "QPSK", "qpsk"},
{QAM_16, "QAM 16", "qam-16"},
{QAM_32, "QAM 32", "qam-32"},
@ -316,7 +316,7 @@ static GType
gst_dvbsrc_transmission_mode_get_type (void)
{
static GType dvbsrc_transmission_mode_type = 0;
static GEnumValue transmission_mode_types[] = {
static const GEnumValue transmission_mode_types[] = {
{TRANSMISSION_MODE_2K, "2K", "2k"},
{TRANSMISSION_MODE_8K, "8K", "8k"},
{TRANSMISSION_MODE_AUTO, "AUTO", "auto"},
@ -344,7 +344,7 @@ static GType
gst_dvbsrc_bandwidth_get_type (void)
{
static GType dvbsrc_bandwidth_type = 0;
static GEnumValue bandwidth_types[] = {
static const GEnumValue bandwidth_types[] = {
{BANDWIDTH_8_MHZ, "8", "8"},
{BANDWIDTH_7_MHZ, "7", "7"},
{BANDWIDTH_6_MHZ, "6", "6"},
@ -367,7 +367,7 @@ static GType
gst_dvbsrc_guard_get_type (void)
{
static GType dvbsrc_guard_type = 0;
static GEnumValue guard_types[] = {
static const GEnumValue guard_types[] = {
{GUARD_INTERVAL_1_32, "32", "32"},
{GUARD_INTERVAL_1_16, "16", "16"},
{GUARD_INTERVAL_1_8, "8", "8"},
@ -395,7 +395,7 @@ static GType
gst_dvbsrc_hierarchy_get_type (void)
{
static GType dvbsrc_hierarchy_type = 0;
static GEnumValue hierarchy_types[] = {
static const GEnumValue hierarchy_types[] = {
{HIERARCHY_NONE, "NONE", "none"},
{HIERARCHY_1, "1", "1"},
{HIERARCHY_2, "2", "2"},
@ -416,7 +416,7 @@ static GType
gst_dvbsrc_inversion_get_type (void)
{
static GType dvbsrc_inversion_type = 0;
static GEnumValue inversion_types[] = {
static const GEnumValue inversion_types[] = {
{INVERSION_OFF, "OFF", "off"},
{INVERSION_ON, "ON", "on"},
{INVERSION_AUTO, "AUTO", "auto"},
@ -435,7 +435,7 @@ static GType
gst_dvbsrc_delsys_get_type (void)
{
static GType dvbsrc_delsys_type = 0;
static GEnumValue delsys_types[] = {
static const GEnumValue delsys_types[] = {
{SYS_UNDEFINED, "UNDEFINED", "undefined"},
{SYS_DVBC_ANNEX_A, "DVB-C-A", "dvb-c-a"},
{SYS_DVBC_ANNEX_B, "DVB-C-B", "dvb-c-b"},
@ -474,7 +474,7 @@ static GType
gst_dvbsrc_pilot_get_type (void)
{
static GType dvbsrc_pilot_type = 0;
static GEnumValue pilot_types[] = {
static const GEnumValue pilot_types[] = {
{PILOT_ON, "ON", "on"},
{PILOT_OFF, "OFF", "off"},
{PILOT_AUTO, "AUTO", "auto"},
@ -492,7 +492,7 @@ static GType
gst_dvbsrc_rolloff_get_type (void)
{
static GType dvbsrc_rolloff_type = 0;
static GEnumValue rolloff_types[] = {
static const GEnumValue rolloff_types[] = {
{ROLLOFF_35, "35", "35"},
{ROLLOFF_20, "20", "20"},
{ROLLOFF_25, "25", "25"},
@ -512,7 +512,7 @@ static GType
gst_dvbsrc_interleaving_get_type (void)
{
static GType dvbsrc_interleaving_type = 0;
static GEnumValue interleaving_types[] = {
static const GEnumValue interleaving_types[] = {
#if HAVE_V5_MINOR(7)
{INTERLEAVING_NONE, "NONE", "none"},
{INTERLEAVING_AUTO, "AUTO", "auto"},

View file

@ -540,7 +540,7 @@ dxr3videosink_handle_event (GstPad * pad, GstEvent * event)
/* Write an MPEG2 sequence end code, to ensure that the card
actually displays the last picture. Apparently some DVDs are
encoded without proper sequence end codes. */
static guint8 sec[4] = { 0x00, 0x00, 0x01, 0xb7 };
static const guint8 sec[4] = { 0x00, 0x00, 0x01, 0xb7 };
if (sink->cur_buf != NULL) {
dxr3videosink_write_data (sink, 0);

View file

@ -318,7 +318,7 @@ gst_linsys_sdi_sink_preroll (GstBaseSink * sink, GstBuffer * buffer)
static int
get_av (int f, int v, int h)
{
static int table[] = {
static const int table[] = {
0x80, 0x9d, 0xab, 0xb6, 0xc7, 0xda, 0xec, 0xf1
};

View file

@ -59,7 +59,7 @@ static GType
gst_autoexp_mode_get_type (void)
{
static GType autoexp_mode_type = 0;
static GEnumValue autoexp_modes[] = {
static const GEnumValue autoexp_modes[] = {
{AE_ALL_AVG, "0", "Average Picture"},
{AE_CTR_AVG, "1", "Average Center"},
{AE_STD_AVG, "2", "Standard Deviation"},