[FFmpeg-devel] [PATCH 6/6] libavutil/: constify values from av_dict_get().

Chad Fraleigh chadf at triularity.org
Sat Oct 2 00:03:14 EEST 2021


Treat values returned from av_dict_get() as const, since they are 
internal to AVDictionary.

Signed-off-by: Chad Fraleigh <chadf at triularity.org>
---
  libavutil/hwcontext_qsv.c    | 2 +-
  libavutil/hwcontext_vulkan.c | 6 +++---
  libavutil/opt.c              | 6 +++---
  3 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/libavutil/hwcontext_qsv.c b/libavutil/hwcontext_qsv.c
index c18747f7eb..23023c005d 100644
--- a/libavutil/hwcontext_qsv.c
+++ b/libavutil/hwcontext_qsv.c
@@ -1451,7 +1451,7 @@ static int qsv_device_create(AVHWDeviceContext 
*ctx, const char *device,
      enum AVHWDeviceType child_device_type;
      AVHWDeviceContext *child_device;
      AVDictionary *child_device_opts;
-    AVDictionaryEntry *e;
+    const AVDictionaryEntry *e;
       mfxIMPL impl;
      int ret;
diff --git a/libavutil/hwcontext_vulkan.c b/libavutil/hwcontext_vulkan.c
index 2c3216857a..259fa12cba 100644
--- a/libavutil/hwcontext_vulkan.c
+++ b/libavutil/hwcontext_vulkan.c
@@ -545,7 +545,7 @@ static int check_extensions(AVHWDeviceContext *ctx, 
int dev, AVDictionary *opts,
      int optional_exts_num;
      uint32_t sup_ext_count;
      char *user_exts_str = NULL;
-    AVDictionaryEntry *user_exts;
+    const AVDictionaryEntry *user_exts;
      VkExtensionProperties *sup_ext;
      const VulkanOptExtension *optional_exts;
  @@ -671,7 +671,7 @@ static int create_instance(AVHWDeviceContext *ctx, 
AVDictionary *opts)
      VulkanDevicePriv *p = ctx->internal->priv;
      VulkanFunctions *vk = &p->vkfn;
      AVVulkanDeviceContext *hwctx = ctx->hwctx;
-    AVDictionaryEntry *debug_opt = av_dict_get(opts, "debug", NULL, 0);
+    const AVDictionaryEntry *debug_opt = av_dict_get(opts, "debug", 
NULL, 0);
      const int debug_mode = debug_opt && strtol(debug_opt->value, NULL, 
10);
      VkApplicationInfo application_info = {
          .sType              = VK_STRUCTURE_TYPE_APPLICATION_INFO,
@@ -1246,7 +1246,7 @@ static int 
vulkan_device_create_internal(AVHWDeviceContext *ctx,
  {
      int err = 0;
      VkResult ret;
-    AVDictionaryEntry *opt_d;
+    const AVDictionaryEntry *opt_d;
      VulkanDevicePriv *p = ctx->internal->priv;
      VulkanFunctions *vk = &p->vkfn;
      AVVulkanDeviceContext *hwctx = ctx->hwctx;
diff --git a/libavutil/opt.c b/libavutil/opt.c
index c7001dbcd3..51b9157c2e 100644
--- a/libavutil/opt.c
+++ b/libavutil/opt.c
@@ -1633,7 +1633,7 @@ void av_opt_free(void *obj)
   int av_opt_set_dict2(void *obj, AVDictionary **options, int search_flags)
  {
-    AVDictionaryEntry *t = NULL;
+    const AVDictionaryEntry *t = NULL;
      AVDictionary    *tmp = NULL;
      int ret;
  @@ -2005,8 +2005,8 @@ int av_opt_is_set_to_default(void *obj, const 
AVOption *o)
      case AV_OPT_TYPE_DICT: {
          AVDictionary *dict1 = NULL;
          AVDictionary *dict2 = *(AVDictionary **)dst;
-        AVDictionaryEntry *en1 = NULL;
-        AVDictionaryEntry *en2 = NULL;
+        const AVDictionaryEntry *en1 = NULL;
+        const AVDictionaryEntry *en2 = NULL;
          ret = av_dict_parse_string(&dict1, o->default_val.str, "=", 
":", 0);
          if (ret < 0) {
              av_dict_free(&dict1);
-- 
2.25.1


More information about the ffmpeg-devel mailing list