From f16dd7e65a936def99ff00f946544f75ee2f4f73 Mon Sep 17 00:00:00 2001
From: Stefano Sabatini <stefano.sabatini-lala@poste.it>
Date: Fri, 19 Dec 2008 22:29:30 +0000
Subject: [PATCH] Remove calls to deprecated av_set_string2() with calls to
 av_set_string3().

Originally committed as revision 16241 to svn://svn.ffmpeg.org/ffmpeg/trunk
---
 cmdutils.c       | 2 +-
 ffserver.c       | 8 +++-----
 libavcodec/opt.c | 5 ++++-
 3 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/cmdutils.c b/cmdutils.c
index 8b200c8949a..c0feaa80f88 100644
--- a/cmdutils.c
+++ b/cmdutils.c
@@ -224,7 +224,7 @@ void set_context_opts(void *ctx, void *opts_ctx, int flags)
         const char *str= av_get_string(opts_ctx, opt_names[i], &opt, buf, sizeof(buf));
         /* if an option with name opt_names[i] is present in opts_ctx then str is non-NULL */
         if(str && ((opt->flags & flags) == flags))
-            av_set_string2(ctx, opt_names[i], str, 1);
+            av_set_string3(ctx, opt_names[i], str, 1, NULL);
     }
 }
 
diff --git a/ffserver.c b/ffserver.c
index d02b4d057c3..d7bd09227b0 100644
--- a/ffserver.c
+++ b/ffserver.c
@@ -3735,13 +3735,11 @@ static void load_module(const char *filename)
 static int ffserver_opt_default(const char *opt, const char *arg,
                        AVCodecContext *avctx, int type)
 {
-    const AVOption *o  = NULL;
+    int ret = 0;
     const AVOption *o2 = av_find_opt(avctx, opt, NULL, type, type);
     if(o2)
-        o = av_set_string2(avctx, opt, arg, 1);
-    if(!o)
-        return -1;
-    return 0;
+        ret = av_set_string3(avctx, opt, arg, 1, NULL);
+    return ret;
 }
 
 static int parse_ffconfig(const char *filename)
diff --git a/libavcodec/opt.c b/libavcodec/opt.c
index dbe05b31947..1c0bb6c7a83 100644
--- a/libavcodec/opt.c
+++ b/libavcodec/opt.c
@@ -207,7 +207,10 @@ const AVOption *av_set_string2(void *obj, const char *name, const char *val, int
 }
 
 const AVOption *av_set_string(void *obj, const char *name, const char *val){
-    return av_set_string2(obj, name, val, 0);
+    const AVOption *o;
+    if (av_set_string3(obj, name, val, 0, &o) < 0)
+        return NULL;
+    return o;
 }
 
 const AVOption *av_set_double(void *obj, const char *name, double n){
-- 
GitLab