[FFmpeg-devel] [PATCH v2 06/30] Mark some pointers as const

Andreas Rheinhardt andreas.rheinhardt at gmail.com
Fri Jan 1 02:35:09 EET 2021


Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
---
Found a few more, in particular the hw_configs lists.

 fftools/ffmpeg_opt.c                        | 86 ++++++++++-----------
 libavcodec/aacenctab.c                      |  4 +-
 libavcodec/aacenctab.h                      |  4 +-
 libavcodec/av1dec.c                         |  2 +-
 libavcodec/cbs.c                            |  2 +-
 libavcodec/h2645_parse.c                    |  4 +-
 libavcodec/h264dec.c                        |  2 +-
 libavcodec/hevcdec.c                        |  2 +-
 libavcodec/mjpegdec.c                       |  2 +-
 libavcodec/mpeg12dec.c                      |  4 +-
 libavcodec/mpeg4videodec.c                  |  2 +-
 libavcodec/opustab.c                        |  2 +-
 libavcodec/opustab.h                        |  2 +-
 libavcodec/vc1dec.c                         |  4 +-
 libavcodec/vp8.c                            |  2 +-
 libavcodec/vp9.c                            |  2 +-
 libavfilter/af_afftfilt.c                   |  2 +-
 libavfilter/af_aiir.c                       |  2 +-
 libavfilter/dnn/dnn_backend_native_layers.c |  2 +-
 libavfilter/dnn/dnn_backend_native_layers.h |  2 +-
 libavfilter/vf_geq.c                        |  4 +-
 libavfilter/vf_qp.c                         |  4 +-
 libavfilter/vf_selectivecolor.c             |  2 +-
 libavfilter/vf_tonemap_opencl.c             |  6 +-
 libavformat/utils.c                         |  2 +-
 libavutil/spherical.c                       |  2 +-
 26 files changed, 77 insertions(+), 77 deletions(-)

diff --git a/fftools/ffmpeg_opt.c b/fftools/ffmpeg_opt.c
index 242468fc64..c295514401 100644
--- a/fftools/ffmpeg_opt.c
+++ b/fftools/ffmpeg_opt.c
@@ -51,49 +51,49 @@
 #define SPECIFIER_OPT_FMT_f    "%f"
 #define SPECIFIER_OPT_FMT_dbl  "%lf"
 
-static const char *opt_name_codec_names[]               = {"c", "codec", "acodec", "vcodec", "scodec", "dcodec", NULL};
-static const char *opt_name_audio_channels[]            = {"ac", NULL};
-static const char *opt_name_audio_sample_rate[]         = {"ar", NULL};
-static const char *opt_name_frame_rates[]               = {"r", NULL};
-static const char *opt_name_frame_sizes[]               = {"s", NULL};
-static const char *opt_name_frame_pix_fmts[]            = {"pix_fmt", NULL};
-static const char *opt_name_ts_scale[]                  = {"itsscale", NULL};
-static const char *opt_name_hwaccels[]                  = {"hwaccel", NULL};
-static const char *opt_name_hwaccel_devices[]           = {"hwaccel_device", NULL};
-static const char *opt_name_hwaccel_output_formats[]    = {"hwaccel_output_format", NULL};
-static const char *opt_name_autorotate[]                = {"autorotate", NULL};
-static const char *opt_name_autoscale[]                 = {"autoscale", NULL};
-static const char *opt_name_max_frames[]                = {"frames", "aframes", "vframes", "dframes", NULL};
-static const char *opt_name_bitstream_filters[]         = {"bsf", "absf", "vbsf", NULL};
-static const char *opt_name_codec_tags[]                = {"tag", "atag", "vtag", "stag", NULL};
-static const char *opt_name_sample_fmts[]               = {"sample_fmt", NULL};
-static const char *opt_name_qscale[]                    = {"q", "qscale", NULL};
-static const char *opt_name_forced_key_frames[]         = {"forced_key_frames", NULL};
-static const char *opt_name_force_fps[]                 = {"force_fps", NULL};
-static const char *opt_name_frame_aspect_ratios[]       = {"aspect", NULL};
-static const char *opt_name_rc_overrides[]              = {"rc_override", NULL};
-static const char *opt_name_intra_matrices[]            = {"intra_matrix", NULL};
-static const char *opt_name_inter_matrices[]            = {"inter_matrix", NULL};
-static const char *opt_name_chroma_intra_matrices[]     = {"chroma_intra_matrix", NULL};
-static const char *opt_name_top_field_first[]           = {"top", NULL};
-static const char *opt_name_presets[]                   = {"pre", "apre", "vpre", "spre", NULL};
-static const char *opt_name_copy_initial_nonkeyframes[] = {"copyinkfr", NULL};
-static const char *opt_name_copy_prior_start[]          = {"copypriorss", NULL};
-static const char *opt_name_filters[]                   = {"filter", "af", "vf", NULL};
-static const char *opt_name_filter_scripts[]            = {"filter_script", NULL};
-static const char *opt_name_reinit_filters[]            = {"reinit_filter", NULL};
-static const char *opt_name_fix_sub_duration[]          = {"fix_sub_duration", NULL};
-static const char *opt_name_canvas_sizes[]              = {"canvas_size", NULL};
-static const char *opt_name_pass[]                      = {"pass", NULL};
-static const char *opt_name_passlogfiles[]              = {"passlogfile", NULL};
-static const char *opt_name_max_muxing_queue_size[]     = {"max_muxing_queue_size", NULL};
-static const char *opt_name_muxing_queue_data_threshold[] = {"muxing_queue_data_threshold", NULL};
-static const char *opt_name_guess_layout_max[]          = {"guess_layout_max", NULL};
-static const char *opt_name_apad[]                      = {"apad", NULL};
-static const char *opt_name_discard[]                   = {"discard", NULL};
-static const char *opt_name_disposition[]               = {"disposition", NULL};
-static const char *opt_name_time_bases[]                = {"time_base", NULL};
-static const char *opt_name_enc_time_bases[]            = {"enc_time_base", NULL};
+static const char *const opt_name_codec_names[]               = {"c", "codec", "acodec", "vcodec", "scodec", "dcodec", NULL};
+static const char *const opt_name_audio_channels[]            = {"ac", NULL};
+static const char *const opt_name_audio_sample_rate[]         = {"ar", NULL};
+static const char *const opt_name_frame_rates[]               = {"r", NULL};
+static const char *const opt_name_frame_sizes[]               = {"s", NULL};
+static const char *const opt_name_frame_pix_fmts[]            = {"pix_fmt", NULL};
+static const char *const opt_name_ts_scale[]                  = {"itsscale", NULL};
+static const char *const opt_name_hwaccels[]                  = {"hwaccel", NULL};
+static const char *const opt_name_hwaccel_devices[]           = {"hwaccel_device", NULL};
+static const char *const opt_name_hwaccel_output_formats[]    = {"hwaccel_output_format", NULL};
+static const char *const opt_name_autorotate[]                = {"autorotate", NULL};
+static const char *const opt_name_autoscale[]                 = {"autoscale", NULL};
+static const char *const opt_name_max_frames[]                = {"frames", "aframes", "vframes", "dframes", NULL};
+static const char *const opt_name_bitstream_filters[]         = {"bsf", "absf", "vbsf", NULL};
+static const char *const opt_name_codec_tags[]                = {"tag", "atag", "vtag", "stag", NULL};
+static const char *const opt_name_sample_fmts[]               = {"sample_fmt", NULL};
+static const char *const opt_name_qscale[]                    = {"q", "qscale", NULL};
+static const char *const opt_name_forced_key_frames[]         = {"forced_key_frames", NULL};
+static const char *const opt_name_force_fps[]                 = {"force_fps", NULL};
+static const char *const opt_name_frame_aspect_ratios[]       = {"aspect", NULL};
+static const char *const opt_name_rc_overrides[]              = {"rc_override", NULL};
+static const char *const opt_name_intra_matrices[]            = {"intra_matrix", NULL};
+static const char *const opt_name_inter_matrices[]            = {"inter_matrix", NULL};
+static const char *const opt_name_chroma_intra_matrices[]     = {"chroma_intra_matrix", NULL};
+static const char *const opt_name_top_field_first[]           = {"top", NULL};
+static const char *const opt_name_presets[]                   = {"pre", "apre", "vpre", "spre", NULL};
+static const char *const opt_name_copy_initial_nonkeyframes[] = {"copyinkfr", NULL};
+static const char *const opt_name_copy_prior_start[]          = {"copypriorss", NULL};
+static const char *const opt_name_filters[]                   = {"filter", "af", "vf", NULL};
+static const char *const opt_name_filter_scripts[]            = {"filter_script", NULL};
+static const char *const opt_name_reinit_filters[]            = {"reinit_filter", NULL};
+static const char *const opt_name_fix_sub_duration[]          = {"fix_sub_duration", NULL};
+static const char *const opt_name_canvas_sizes[]              = {"canvas_size", NULL};
+static const char *const opt_name_pass[]                      = {"pass", NULL};
+static const char *const opt_name_passlogfiles[]              = {"passlogfile", NULL};
+static const char *const opt_name_max_muxing_queue_size[]     = {"max_muxing_queue_size", NULL};
+static const char *const opt_name_muxing_queue_data_threshold[] = {"muxing_queue_data_threshold", NULL};
+static const char *const opt_name_guess_layout_max[]          = {"guess_layout_max", NULL};
+static const char *const opt_name_apad[]                      = {"apad", NULL};
+static const char *const opt_name_discard[]                   = {"discard", NULL};
+static const char *const opt_name_disposition[]               = {"disposition", NULL};
+static const char *const opt_name_time_bases[]                = {"time_base", NULL};
+static const char *const opt_name_enc_time_bases[]            = {"enc_time_base", NULL};
 
 #define WARN_MULTIPLE_OPT_USAGE(name, type, so, st)\
 {\
diff --git a/libavcodec/aacenctab.c b/libavcodec/aacenctab.c
index f3d70fbe31..874365a593 100644
--- a/libavcodec/aacenctab.c
+++ b/libavcodec/aacenctab.c
@@ -88,7 +88,7 @@ static const uint8_t swb_size_1024_8[] = {
     32, 36, 36, 40, 44, 48, 52, 56, 60, 64, 80
 };
 
-const uint8_t *ff_aac_swb_size_128[] = {
+const uint8_t *const ff_aac_swb_size_128[] = {
     swb_size_128_96, swb_size_128_96, swb_size_128_64,
     swb_size_128_48, swb_size_128_48, swb_size_128_48,
     swb_size_128_24, swb_size_128_24, swb_size_128_16,
@@ -96,7 +96,7 @@ const uint8_t *ff_aac_swb_size_128[] = {
     swb_size_128_8
 };
 
-const uint8_t *ff_aac_swb_size_1024[] = {
+const uint8_t *const ff_aac_swb_size_1024[] = {
     swb_size_1024_96, swb_size_1024_96, swb_size_1024_64,
     swb_size_1024_48, swb_size_1024_48, swb_size_1024_32,
     swb_size_1024_24, swb_size_1024_24, swb_size_1024_16,
diff --git a/libavcodec/aacenctab.h b/libavcodec/aacenctab.h
index 64932d709f..dbbdf61dfd 100644
--- a/libavcodec/aacenctab.h
+++ b/libavcodec/aacenctab.h
@@ -38,9 +38,9 @@
 
 #define AAC_MAX_CHANNELS 16
 
-extern const uint8_t *ff_aac_swb_size_1024[];
+extern const uint8_t *const ff_aac_swb_size_1024[];
 extern const int      ff_aac_swb_size_1024_len;
-extern const uint8_t *ff_aac_swb_size_128[];
+extern const uint8_t *const ff_aac_swb_size_128[];
 extern const int      ff_aac_swb_size_128_len;
 
 /* Supported layouts without using a PCE */
diff --git a/libavcodec/av1dec.c b/libavcodec/av1dec.c
index f1cc5150c3..75eece0c23 100644
--- a/libavcodec/av1dec.c
+++ b/libavcodec/av1dec.c
@@ -1110,7 +1110,7 @@ AVCodec ff_av1_decoder = {
                              FF_CODEC_CAP_SETS_PKT_DTS,
     .flush                 = av1_decode_flush,
     .profiles              = NULL_IF_CONFIG_SMALL(ff_av1_profiles),
-    .hw_configs            = (const AVCodecHWConfigInternal * []) {
+    .hw_configs            = (const AVCodecHWConfigInternal *const []) {
 #if CONFIG_AV1_DXVA2_HWACCEL
         HWACCEL_DXVA2(av1),
 #endif
diff --git a/libavcodec/cbs.c b/libavcodec/cbs.c
index f98531e131..e7025cce07 100644
--- a/libavcodec/cbs.c
+++ b/libavcodec/cbs.c
@@ -28,7 +28,7 @@
 #include "cbs_internal.h"
 
 
-static const CodedBitstreamType *cbs_type_table[] = {
+static const CodedBitstreamType *const cbs_type_table[] = {
 #if CONFIG_CBS_AV1
     &ff_cbs_type_av1,
 #endif
diff --git a/libavcodec/h2645_parse.c b/libavcodec/h2645_parse.c
index 0f98b49fbe..a36ef4f5a0 100644
--- a/libavcodec/h2645_parse.c
+++ b/libavcodec/h2645_parse.c
@@ -146,7 +146,7 @@ nsc:
     return si;
 }
 
-static const char *hevc_nal_type_name[64] = {
+static const char *const hevc_nal_type_name[64] = {
     "TRAIL_N", // HEVC_NAL_TRAIL_N
     "TRAIL_R", // HEVC_NAL_TRAIL_R
     "TSA_N", // HEVC_NAL_TSA_N
@@ -219,7 +219,7 @@ static const char *hevc_nal_unit_name(int nal_type)
     return hevc_nal_type_name[nal_type];
 }
 
-static const char *h264_nal_type_name[32] = {
+static const char *const h264_nal_type_name[32] = {
     "Unspecified 0", //H264_NAL_UNSPECIFIED
     "Coded slice of a non-IDR picture", // H264_NAL_SLICE
     "Coded slice data partition A", // H264_NAL_DPA
diff --git a/libavcodec/h264dec.c b/libavcodec/h264dec.c
index 46495d586f..8856be0f59 100644
--- a/libavcodec/h264dec.c
+++ b/libavcodec/h264dec.c
@@ -1054,7 +1054,7 @@ AVCodec ff_h264_decoder = {
     .capabilities          = /*AV_CODEC_CAP_DRAW_HORIZ_BAND |*/ AV_CODEC_CAP_DR1 |
                              AV_CODEC_CAP_DELAY | AV_CODEC_CAP_SLICE_THREADS |
                              AV_CODEC_CAP_FRAME_THREADS,
-    .hw_configs            = (const AVCodecHWConfigInternal*[]) {
+    .hw_configs            = (const AVCodecHWConfigInternal *const []) {
 #if CONFIG_H264_DXVA2_HWACCEL
                                HWACCEL_DXVA2(h264),
 #endif
diff --git a/libavcodec/hevcdec.c b/libavcodec/hevcdec.c
index be814bba80..305e32c450 100644
--- a/libavcodec/hevcdec.c
+++ b/libavcodec/hevcdec.c
@@ -3675,7 +3675,7 @@ AVCodec ff_hevc_decoder = {
     .caps_internal         = FF_CODEC_CAP_INIT_THREADSAFE | FF_CODEC_CAP_EXPORTS_CROPPING |
                              FF_CODEC_CAP_ALLOCATE_PROGRESS,
     .profiles              = NULL_IF_CONFIG_SMALL(ff_hevc_profiles),
-    .hw_configs            = (const AVCodecHWConfigInternal*[]) {
+    .hw_configs            = (const AVCodecHWConfigInternal *const []) {
 #if CONFIG_HEVC_DXVA2_HWACCEL
                                HWACCEL_DXVA2(hevc),
 #endif
diff --git a/libavcodec/mjpegdec.c b/libavcodec/mjpegdec.c
index 11fb809c10..487d58f679 100644
--- a/libavcodec/mjpegdec.c
+++ b/libavcodec/mjpegdec.c
@@ -2990,7 +2990,7 @@ AVCodec ff_mjpeg_decoder = {
     .profiles       = NULL_IF_CONFIG_SMALL(ff_mjpeg_profiles),
     .caps_internal  = FF_CODEC_CAP_INIT_THREADSAFE | FF_CODEC_CAP_INIT_CLEANUP |
                       FF_CODEC_CAP_SKIP_FRAME_FILL_PARAM | FF_CODEC_CAP_SETS_PKT_DTS,
-    .hw_configs     = (const AVCodecHWConfigInternal*[]) {
+    .hw_configs     = (const AVCodecHWConfigInternal *const []) {
 #if CONFIG_MJPEG_NVDEC_HWACCEL
                         HWACCEL_NVDEC(mjpeg),
 #endif
diff --git a/libavcodec/mpeg12dec.c b/libavcodec/mpeg12dec.c
index 123ede4704..3021356058 100644
--- a/libavcodec/mpeg12dec.c
+++ b/libavcodec/mpeg12dec.c
@@ -2902,7 +2902,7 @@ AVCodec ff_mpeg1video_decoder = {
     .flush                 = flush,
     .max_lowres            = 3,
     .update_thread_context = ONLY_IF_THREADS_ENABLED(mpeg_decode_update_thread_context),
-    .hw_configs            = (const AVCodecHWConfigInternal*[]) {
+    .hw_configs            = (const AVCodecHWConfigInternal *const []) {
 #if CONFIG_MPEG1_NVDEC_HWACCEL
                                HWACCEL_NVDEC(mpeg1),
 #endif
@@ -2936,7 +2936,7 @@ AVCodec ff_mpeg2video_decoder = {
     .flush          = flush,
     .max_lowres     = 3,
     .profiles       = NULL_IF_CONFIG_SMALL(ff_mpeg2_video_profiles),
-    .hw_configs     = (const AVCodecHWConfigInternal*[]) {
+    .hw_configs     = (const AVCodecHWConfigInternal *const []) {
 #if CONFIG_MPEG2_DXVA2_HWACCEL
                         HWACCEL_DXVA2(mpeg2),
 #endif
diff --git a/libavcodec/mpeg4videodec.c b/libavcodec/mpeg4videodec.c
index d85109c857..c88de63f36 100644
--- a/libavcodec/mpeg4videodec.c
+++ b/libavcodec/mpeg4videodec.c
@@ -3593,7 +3593,7 @@ AVCodec ff_mpeg4_decoder = {
     .profiles              = NULL_IF_CONFIG_SMALL(ff_mpeg4_video_profiles),
     .update_thread_context = ONLY_IF_THREADS_ENABLED(mpeg4_update_thread_context),
     .priv_class = &mpeg4_class,
-    .hw_configs            = (const AVCodecHWConfigInternal*[]) {
+    .hw_configs            = (const AVCodecHWConfigInternal *const []) {
 #if CONFIG_MPEG4_NVDEC_HWACCEL
                                HWACCEL_NVDEC(mpeg4),
 #endif
diff --git a/libavcodec/opustab.c b/libavcodec/opustab.c
index 7276dad793..8a08a26a57 100644
--- a/libavcodec/opustab.c
+++ b/libavcodec/opustab.c
@@ -1130,7 +1130,7 @@ DECLARE_ALIGNED(32, static const float, ff_celt_window_padded)[136] = {
     1.00000000f, 1.00000000f, 1.00000000f,
 };
 
-const float *ff_celt_window = &ff_celt_window_padded[8];
+const float *const ff_celt_window = &ff_celt_window_padded[8];
 
 /* square of the window, used for the postfilter */
 const float ff_celt_window2[120] = {
diff --git a/libavcodec/opustab.h b/libavcodec/opustab.h
index cdd0456e3c..4525837942 100644
--- a/libavcodec/opustab.h
+++ b/libavcodec/opustab.h
@@ -156,7 +156,7 @@ extern const uint16_t ff_celt_qn_exp2[];
 extern const float    ff_celt_postfilter_taps[3][3];
 
 extern const float    ff_celt_window2[120];
-extern const float   *ff_celt_window;
+extern const float *const ff_celt_window;
 
 extern const uint32_t * const ff_celt_pvq_u_row[15];
 
diff --git a/libavcodec/vc1dec.c b/libavcodec/vc1dec.c
index 7809234ff7..47940fb886 100644
--- a/libavcodec/vc1dec.c
+++ b/libavcodec/vc1dec.c
@@ -1217,7 +1217,7 @@ AVCodec ff_vc1_decoder = {
     .flush          = ff_mpeg_flush,
     .capabilities   = AV_CODEC_CAP_DR1 | AV_CODEC_CAP_DELAY,
     .pix_fmts       = vc1_hwaccel_pixfmt_list_420,
-    .hw_configs     = (const AVCodecHWConfigInternal*[]) {
+    .hw_configs     = (const AVCodecHWConfigInternal *const []) {
 #if CONFIG_VC1_DXVA2_HWACCEL
                         HWACCEL_DXVA2(vc1),
 #endif
@@ -1254,7 +1254,7 @@ AVCodec ff_wmv3_decoder = {
     .flush          = ff_mpeg_flush,
     .capabilities   = AV_CODEC_CAP_DR1 | AV_CODEC_CAP_DELAY,
     .pix_fmts       = vc1_hwaccel_pixfmt_list_420,
-    .hw_configs     = (const AVCodecHWConfigInternal*[]) {
+    .hw_configs     = (const AVCodecHWConfigInternal *const []) {
 #if CONFIG_WMV3_DXVA2_HWACCEL
                         HWACCEL_DXVA2(wmv3),
 #endif
diff --git a/libavcodec/vp8.c b/libavcodec/vp8.c
index d5d133540a..9a22947cc4 100644
--- a/libavcodec/vp8.c
+++ b/libavcodec/vp8.c
@@ -2965,7 +2965,7 @@ AVCodec ff_vp8_decoder = {
                              AV_CODEC_CAP_SLICE_THREADS,
     .flush                 = vp8_decode_flush,
     .update_thread_context = ONLY_IF_THREADS_ENABLED(vp8_decode_update_thread_context),
-    .hw_configs            = (const AVCodecHWConfigInternal*[]) {
+    .hw_configs            = (const AVCodecHWConfigInternal *const []) {
 #if CONFIG_VP8_VAAPI_HWACCEL
                                HWACCEL_VAAPI(vp8),
 #endif
diff --git a/libavcodec/vp9.c b/libavcodec/vp9.c
index 294059f863..4659f94ee8 100644
--- a/libavcodec/vp9.c
+++ b/libavcodec/vp9.c
@@ -1894,7 +1894,7 @@ AVCodec ff_vp9_decoder = {
     .update_thread_context = ONLY_IF_THREADS_ENABLED(vp9_decode_update_thread_context),
     .profiles              = NULL_IF_CONFIG_SMALL(ff_vp9_profiles),
     .bsfs                  = "vp9_superframe_split",
-    .hw_configs            = (const AVCodecHWConfigInternal*[]) {
+    .hw_configs            = (const AVCodecHWConfigInternal *const []) {
 #if CONFIG_VP9_DXVA2_HWACCEL
                                HWACCEL_DXVA2(vp9),
 #endif
diff --git a/libavfilter/af_afftfilt.c b/libavfilter/af_afftfilt.c
index a6156bf852..9b9001a44b 100644
--- a/libavfilter/af_afftfilt.c
+++ b/libavfilter/af_afftfilt.c
@@ -118,7 +118,7 @@ static double realf(void *priv, double x, double ch) { return getreal(priv, x, c
 static double imagf(void *priv, double x, double ch) { return getimag(priv, x, ch); }
 
 static const char *const func2_names[]    = { "real", "imag", NULL };
-double (*func2[])(void *, double, double) = {  realf,  imagf, NULL };
+static double (*const func2[])(void *, double, double) = {  realf,  imagf, NULL };
 
 static int config_input(AVFilterLink *inlink)
 {
diff --git a/libavfilter/af_aiir.c b/libavfilter/af_aiir.c
index 59d2232ac9..f2e9d8e4e2 100644
--- a/libavfilter/af_aiir.c
+++ b/libavfilter/af_aiir.c
@@ -453,7 +453,7 @@ static int read_zp_coefficients(AVFilterContext *ctx, char *item_str, int nb_ite
     return 0;
 }
 
-static const char *format[] = { "%lf", "%lf %lfi", "%lf %lfr", "%lf %lfd", "%lf %lfi" };
+static const char *const format[] = { "%lf", "%lf %lfi", "%lf %lfr", "%lf %lfd", "%lf %lfi" };
 
 static int read_channels(AVFilterContext *ctx, int channels, uint8_t *item_str, int ab)
 {
diff --git a/libavfilter/dnn/dnn_backend_native_layers.c b/libavfilter/dnn/dnn_backend_native_layers.c
index 638a94e9a3..a23b34f823 100644
--- a/libavfilter/dnn/dnn_backend_native_layers.c
+++ b/libavfilter/dnn/dnn_backend_native_layers.c
@@ -29,7 +29,7 @@
 #include "dnn_backend_native_layer_avgpool.h"
 #include "dnn_backend_native_layer_dense.h"
 
-LayerFunc layer_funcs[DLT_COUNT] = {
+const LayerFunc layer_funcs[DLT_COUNT] = {
     {NULL, NULL},
     {dnn_execute_layer_conv2d,      dnn_load_layer_conv2d},
     {dnn_execute_layer_depth2space, dnn_load_layer_depth2space},
diff --git a/libavfilter/dnn/dnn_backend_native_layers.h b/libavfilter/dnn/dnn_backend_native_layers.h
index dc76ace65a..b9e8a131d5 100644
--- a/libavfilter/dnn/dnn_backend_native_layers.h
+++ b/libavfilter/dnn/dnn_backend_native_layers.h
@@ -33,6 +33,6 @@ typedef struct LayerFunc {
     LAYER_LOAD_FUNC pf_load;
 }LayerFunc;
 
-extern LayerFunc layer_funcs[DLT_COUNT];
+extern const LayerFunc layer_funcs[DLT_COUNT];
 
 #endif
diff --git a/libavfilter/vf_geq.c b/libavfilter/vf_geq.c
index d7abf96a68..072cef3ca3 100644
--- a/libavfilter/vf_geq.c
+++ b/libavfilter/vf_geq.c
@@ -270,7 +270,7 @@ static av_cold int geq_init(AVFilterContext *ctx)
     }
 
     for (plane = 0; plane < NB_PLANES; plane++) {
-        static double (*p[])(void *, double, double) = {
+        static double (*const p[])(void *, double, double) = {
             lum   , cb   , cr   , alpha   ,
             lumsum, cbsum, crsub, alphasum,
         };
@@ -283,7 +283,7 @@ static av_cold int geq_init(AVFilterContext *ctx)
             "gsum", "bsum", "rsum", "alphasum", "psum",
             NULL };
         const char *const *func2_names       = geq->is_rgb ? func2_rgb_names : func2_yuv_names;
-        double (*func2[])(void *, double, double) = {
+        double (*const func2[])(void *, double, double) = {
             lum   , cb   , cr   , alpha   , p[plane],
             lumsum, cbsum, crsub, alphasum, p[plane + 4],
             NULL };
diff --git a/libavfilter/vf_qp.c b/libavfilter/vf_qp.c
index 33d39493bc..4626198d15 100644
--- a/libavfilter/vf_qp.c
+++ b/libavfilter/vf_qp.c
@@ -53,7 +53,7 @@ static int config_input(AVFilterLink *inlink)
     int i;
     int ret;
     AVExpr *e = NULL;
-    static const char *var_names[] = { "known", "qp", "x", "y", "w", "h", NULL };
+    static const char *const var_names[] = { "known", "qp", "x", "y", "w", "h", NULL };
 
     if (!s->qp_expr_str)
         return 0;
@@ -121,7 +121,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in)
             for (x = 0; x < s->qstride; x++) {
                 int qp = in_qp_table ? in_qp_table[x + stride * y] : NAN;
                 double var_values[] = { !!in_qp_table, qp, x, y, s->qstride, s->h, 0};
-                static const char *var_names[] = { "known", "qp", "x", "y", "w", "h", NULL };
+                static const char *const var_names[] = { "known", "qp", "x", "y", "w", "h", NULL };
                 double temp_val;
 
                 ret = av_expr_parse_and_eval(&temp_val, s->qp_expr_str,
diff --git a/libavfilter/vf_selectivecolor.c b/libavfilter/vf_selectivecolor.c
index d8f339d540..9bd79a3e60 100644
--- a/libavfilter/vf_selectivecolor.c
+++ b/libavfilter/vf_selectivecolor.c
@@ -61,7 +61,7 @@ enum correction_method {
     NB_CORRECTION_METHODS,
 };
 
-static const char *color_names[NB_RANGES] = {
+static const char *const color_names[NB_RANGES] = {
     "red", "yellow", "green", "cyan", "blue", "magenta", "white", "neutral", "black"
 };
 
diff --git a/libavfilter/vf_tonemap_opencl.c b/libavfilter/vf_tonemap_opencl.c
index b880228727..2681ebd1b5 100644
--- a/libavfilter/vf_tonemap_opencl.c
+++ b/libavfilter/vf_tonemap_opencl.c
@@ -71,12 +71,12 @@ typedef struct TonemapOpenCLContext {
     cl_mem                util_mem;
 } TonemapOpenCLContext;
 
-static const char *linearize_funcs[AVCOL_TRC_NB] = {
+static const char *const linearize_funcs[AVCOL_TRC_NB] = {
     [AVCOL_TRC_SMPTE2084] = "eotf_st2084",
     [AVCOL_TRC_ARIB_STD_B67] = "inverse_oetf_hlg",
 };
 
-static const char *delinearize_funcs[AVCOL_TRC_NB] = {
+static const char *const delinearize_funcs[AVCOL_TRC_NB] = {
     [AVCOL_TRC_BT709]     = "inverse_eotf_bt1886",
     [AVCOL_TRC_BT2020_10] = "inverse_eotf_bt1886",
 };
@@ -91,7 +91,7 @@ static const struct WhitepointCoefficients whitepoint_table[AVCOL_PRI_NB] = {
     [AVCOL_PRI_BT2020] = { 0.3127, 0.3290 },
 };
 
-static const char *tonemap_func[TONEMAP_MAX] = {
+static const char *const tonemap_func[TONEMAP_MAX] = {
     [TONEMAP_NONE]     = "direct",
     [TONEMAP_LINEAR]   = "linear",
     [TONEMAP_GAMMA]    = "gamma",
diff --git a/libavformat/utils.c b/libavformat/utils.c
index 1a87d9422a..f63ff3074a 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -2874,7 +2874,7 @@ skip_duration_calc:
 }
 
 /* 1:1 map to AVDurationEstimationMethod */
-static const char *duration_name[] = {
+static const char *const duration_name[] = {
     [AVFMT_DURATION_FROM_PTS]     = "pts",
     [AVFMT_DURATION_FROM_STREAM]  = "stream",
     [AVFMT_DURATION_FROM_BITRATE] = "bit rate",
diff --git a/libavutil/spherical.c b/libavutil/spherical.c
index 4be55f36cf..4a7f3e49ca 100644
--- a/libavutil/spherical.c
+++ b/libavutil/spherical.c
@@ -51,7 +51,7 @@ void av_spherical_tile_bounds(const AVSphericalMapping *map,
     *bottom = orig_height - height - *top;
 }
 
-static const char *spherical_projection_names[] = {
+static const char *const spherical_projection_names[] = {
     [AV_SPHERICAL_EQUIRECTANGULAR]      = "equirectangular",
     [AV_SPHERICAL_CUBEMAP]              = "cubemap",
     [AV_SPHERICAL_EQUIRECTANGULAR_TILE] = "tiled equirectangular",
-- 
2.25.1



More information about the ffmpeg-devel mailing list