From d5aab81a7762fbc60c1c285934ecedf976a8dacf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Wed, 21 Jan 2015 09:55:30 +0100 Subject: [PATCH] Constify some static arrays everywhere --- ext/dv/gstsmptetimecode.c | 4 ++-- ext/mikmod/mikmod_types.c | 3 ++- gst/audiofx/audiodynamic.c | 2 +- gst/audiofx/audiopanorama.c | 2 +- gst/effectv/gstradioac.c | 2 +- gst/isomp4/atoms.c | 2 +- gst/isomp4/gstqtmuxmap.c | 15 ++++++++------- gst/isomp4/qtdemux.c | 4 ++-- gst/rtsp/gstrtspsrc.c | 2 +- gst/videofilter/gstvideotemplate.c | 2 +- gst/wavparse/gstwavparse.c | 2 +- 11 files changed, 21 insertions(+), 19 deletions(-) diff --git a/ext/dv/gstsmptetimecode.c b/ext/dv/gstsmptetimecode.c index 8b15a6b631..b2204ea498 100644 --- a/ext/dv/gstsmptetimecode.c +++ b/ext/dv/gstsmptetimecode.c @@ -229,8 +229,8 @@ gst_smpte_time_code_get_timestamp (GstSMPTETimeCodeSystem system, g_return_val_if_fail (time_code != NULL, GST_CLOCK_TIME_NONE); if (gst_smpte_time_code_get_frame_number (system, &frame_number, time_code)) { - static int framerate_n[3] = { 3000, 25, 24 }; - static int framerate_d[3] = { 1001, 1, 1 }; + static const int framerate_n[3] = { 3000, 25, 24 }; + static const int framerate_d[3] = { 1001, 1, 1 }; return gst_util_uint64_scale (frame_number, GST_SECOND * framerate_d[system], framerate_n[system]); diff --git a/ext/mikmod/mikmod_types.c b/ext/mikmod/mikmod_types.c index 37ec9777ea..b4bbc3659d 100644 --- a/ext/mikmod/mikmod_types.c +++ b/ext/mikmod/mikmod_types.c @@ -113,7 +113,8 @@ gboolean Fam_CheckType (GstBuffer * buf) { gchar *data; - static unsigned char FARSIG[4 + 3] = { 'F', 'A', 'R', 0xfe, 13, 10, 26 }; + static const unsigned char FARSIG[4 + 3] = + { 'F', 'A', 'R', 0xfe, 13, 10, 26 }; data = GST_BUFFER_DATA (buf); diff --git a/gst/audiofx/audiodynamic.c b/gst/audiofx/audiodynamic.c index 3997602555..a695191e20 100644 --- a/gst/audiofx/audiodynamic.c +++ b/gst/audiofx/audiodynamic.c @@ -110,7 +110,7 @@ static void gst_audio_dynamic_transform_soft_knee_expander_float (GstAudioDynamic * filter, gfloat * data, guint num_samples); -static GstAudioDynamicProcessFunc process_functions[] = { +static const GstAudioDynamicProcessFunc process_functions[] = { (GstAudioDynamicProcessFunc) gst_audio_dynamic_transform_hard_knee_compressor_int, (GstAudioDynamicProcessFunc) diff --git a/gst/audiofx/audiopanorama.c b/gst/audiofx/audiopanorama.c index af25640fa9..330e049434 100644 --- a/gst/audiofx/audiopanorama.c +++ b/gst/audiofx/audiopanorama.c @@ -139,7 +139,7 @@ static GstFlowReturn gst_audio_panorama_transform (GstBaseTransform * base, /* Table with processing functions: [channels][format][method] */ -static GstAudioPanoramaProcessFunc panorama_process_functions[2][2][2] = { +static const GstAudioPanoramaProcessFunc panorama_process_functions[2][2][2] = { { { (GstAudioPanoramaProcessFunc) gst_audio_panorama_m2s_int, diff --git a/gst/effectv/gstradioac.c b/gst/effectv/gstradioac.c index fc2d409044..244f98f235 100644 --- a/gst/effectv/gstradioac.c +++ b/gst/effectv/gstradioac.c @@ -131,7 +131,7 @@ enum #define RATIO 0.95 static guint32 palettes[COLORS * PATTERN]; -static gint swap_tab[] = { 2, 1, 0, 3 }; +static const gint swap_tab[] = { 2, 1, 0, 3 }; #define gst_radioactv_parent_class parent_class G_DEFINE_TYPE (GstRadioacTV, gst_radioactv, GST_TYPE_VIDEO_FILTER); diff --git a/gst/isomp4/atoms.c b/gst/isomp4/atoms.c index b27abc75f7..51d20f5377 100644 --- a/gst/isomp4/atoms.c +++ b/gst/isomp4/atoms.c @@ -4704,7 +4704,7 @@ build_uuid_xmp_atom (GstBuffer * xmp_data) { AtomUUID *uuid; gsize size; - static guint8 xmp_uuid[] = { 0xBE, 0x7A, 0xCF, 0xCB, + static const guint8 xmp_uuid[] = { 0xBE, 0x7A, 0xCF, 0xCB, 0x97, 0xA9, 0x42, 0xE8, 0x9C, 0x71, 0x99, 0x94, 0x91, 0xE3, 0xAF, 0xAC diff --git a/gst/isomp4/gstqtmuxmap.c b/gst/isomp4/gstqtmuxmap.c index 060f38b40c..bc0f101c0d 100644 --- a/gst/isomp4/gstqtmuxmap.c +++ b/gst/isomp4/gstqtmuxmap.c @@ -284,14 +284,15 @@ gst_qt_mux_map_format_to_header (GstQTMuxFormat format, GstBuffer ** _prefix, guint32 * _major, guint32 * _version, GList ** _compatible, AtomMOOV * moov, GstClockTime longest_chunk, gboolean faststart) { - static guint32 qt_brands[] = { 0 }; - static guint32 mp4_brands[] = { FOURCC_mp41, FOURCC_isom, FOURCC_iso2, 0 }; - static guint32 isml_brands[] = { FOURCC_iso2, 0 }; - static guint32 gpp_brands[] = { FOURCC_isom, FOURCC_iso2, 0 }; - static guint32 mjp2_brands[] = { FOURCC_isom, FOURCC_iso2, 0 }; - static guint8 mjp2_prefix[] = + static const guint32 qt_brands[] = { 0 }; + static const guint32 mp4_brands[] = + { FOURCC_mp41, FOURCC_isom, FOURCC_iso2, 0 }; + static const guint32 isml_brands[] = { FOURCC_iso2, 0 }; + static const guint32 gpp_brands[] = { FOURCC_isom, FOURCC_iso2, 0 }; + static const guint32 mjp2_brands[] = { FOURCC_isom, FOURCC_iso2, 0 }; + static const guint8 mjp2_prefix[] = { 0, 0, 0, 12, 'j', 'P', ' ', ' ', 0x0D, 0x0A, 0x87, 0x0A }; - guint32 *comp = NULL; + const guint32 *comp = NULL; guint32 major = 0, version = 0; GstBuffer *prefix = NULL; GList *result = NULL; diff --git a/gst/isomp4/qtdemux.c b/gst/isomp4/qtdemux.c index 2c47987c57..fb469c5f14 100644 --- a/gst/isomp4/qtdemux.c +++ b/gst/isomp4/qtdemux.c @@ -2269,12 +2269,12 @@ qtdemux_handle_xmp_taglist (GstQTDemux * qtdemux, GstTagList * taglist) static void qtdemux_parse_uuid (GstQTDemux * qtdemux, const guint8 * buffer, gint length) { - static guint8 xmp_uuid[] = { 0xBE, 0x7A, 0xCF, 0xCB, + static const guint8 xmp_uuid[] = { 0xBE, 0x7A, 0xCF, 0xCB, 0x97, 0xA9, 0x42, 0xE8, 0x9C, 0x71, 0x99, 0x94, 0x91, 0xE3, 0xAF, 0xAC }; - static guint8 playready_uuid[] = { + static const guint8 playready_uuid[] = { 0xd0, 0x8a, 0x4f, 0x18, 0x10, 0xf3, 0x4a, 0x82, 0xb6, 0xc8, 0x32, 0xd8, 0xab, 0xa1, 0x83, 0xd3 }; diff --git a/gst/rtsp/gstrtspsrc.c b/gst/rtsp/gstrtspsrc.c index 6064248fb5..20677eb153 100644 --- a/gst/rtsp/gstrtspsrc.c +++ b/gst/rtsp/gstrtspsrc.c @@ -5853,7 +5853,7 @@ no_setup: /* masks to be kept in sync with the hardcoded protocol order of preference * in code below */ -static guint protocol_masks[] = { +static const guint protocol_masks[] = { GST_RTSP_LOWER_TRANS_UDP, GST_RTSP_LOWER_TRANS_UDP_MCAST, GST_RTSP_LOWER_TRANS_TCP, diff --git a/gst/videofilter/gstvideotemplate.c b/gst/videofilter/gstvideotemplate.c index 6cd70441da..3d60f55503 100644 --- a/gst/videofilter/gstvideotemplate.c +++ b/gst/videofilter/gstvideotemplate.c @@ -110,7 +110,7 @@ gst_videotemplate_get_type (void) return videotemplate_type; } -static GstVideofilterFormat gst_videotemplate_formats[] = { +static const GstVideofilterFormat gst_videotemplate_formats[] = { {"I420", 12, gst_videotemplate_planar411,}, }; diff --git a/gst/wavparse/gstwavparse.c b/gst/wavparse/gstwavparse.c index e93fe342ff..2f5698b649 100644 --- a/gst/wavparse/gstwavparse.c +++ b/gst/wavparse/gstwavparse.c @@ -2447,7 +2447,7 @@ gst_wavparse_sink_event (GstPad * pad, GstObject * parent, GstEvent * event) static const GstFormat * gst_wavparse_get_formats (GstPad * pad) { - static GstFormat formats[] = { + static const GstFormat formats[] = { GST_FORMAT_TIME, GST_FORMAT_BYTES, GST_FORMAT_DEFAULT, /* a "frame", ie a set of samples per Hz */