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

Andreas Rheinhardt andreas.rheinhardt at gmail.com
Thu Dec 31 01:31:33 EET 2020


Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
---
 fftools/ffmpeg_opt.c            | 86 ++++++++++++++++-----------------
 libavcodec/aacenctab.c          |  4 +-
 libavcodec/aacenctab.h          |  4 +-
 libavcodec/cbs.c                |  2 +-
 libavcodec/h2645_parse.c        |  4 +-
 libavcodec/opustab.c            |  2 +-
 libavcodec/opustab.h            |  2 +-
 libavfilter/af_aiir.c           |  2 +-
 libavfilter/vf_qp.c             |  4 +-
 libavfilter/vf_selectivecolor.c |  2 +-
 libavfilter/vf_tonemap_opencl.c |  6 +--
 libavformat/utils.c             |  2 +-
 libavutil/spherical.c           |  2 +-
 13 files changed, 61 insertions(+), 61 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/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/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/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/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