[FFmpeg-devel] [PATCH v19 5/5] libavfilter/vf_frei0r.c: Use UTF-8 version of getenv()
Nil Admirari
nil-admirari at mailo.com
Sun Jun 19 14:40:56 EEST 2022
---
libavfilter/vf_frei0r.c | 19 ++++++++++++++-----
1 file changed, 14 insertions(+), 5 deletions(-)
diff --git a/libavfilter/vf_frei0r.c b/libavfilter/vf_frei0r.c
index f11ae6e55c..c3176ea1f7 100644
--- a/libavfilter/vf_frei0r.c
+++ b/libavfilter/vf_frei0r.c
@@ -31,6 +31,7 @@
#include "libavutil/avstring.h"
#include "libavutil/common.h"
#include "libavutil/eval.h"
+#include "libavutil/getenv_utf8.h"
#include "libavutil/imgutils.h"
#include "libavutil/internal.h"
#include "libavutil/mathematics.h"
@@ -188,7 +189,7 @@ static av_cold int frei0r_init(AVFilterContext *ctx,
f0r_init_f f0r_init;
f0r_get_plugin_info_f f0r_get_plugin_info;
f0r_plugin_info_t *pi;
- char *path;
+ char *path, *env_frei0r_path;
int ret = 0;
int i;
static const char* const frei0r_pathlist[] = {
@@ -204,7 +205,10 @@ static av_cold int frei0r_init(AVFilterContext *ctx,
}
/* see: http://frei0r.dyne.org/codedoc/html/group__pluglocations.html */
- if ((path = av_strdup(getenv("FREI0R_PATH")))) {
+ env_frei0r_path = getenv_utf8("FREI0R_PATH");
+ path = av_strdup(env_frei0r_path);
+ freeenv_utf8(env_frei0r_path);
+ if (path) {
#ifdef _WIN32
const char *separator = ";";
#else
@@ -231,12 +235,17 @@ static av_cold int frei0r_init(AVFilterContext *ctx,
if (ret < 0)
return ret;
}
- if (!s->dl_handle && (path = getenv("HOME"))) {
+ if (!s->dl_handle && (path = getenv_utf8("HOME"))) {
char *prefix = av_asprintf("%s/.frei0r-1/lib/", path);
- if (!prefix)
- return AVERROR(ENOMEM);
+ if (!prefix) {
+ ret = AVERROR(ENOMEM);
+ goto home_path_end;
+ }
ret = load_path(ctx, &s->dl_handle, prefix, dl_name);
av_free(prefix);
+
+ home_path_end:
+ freeenv_utf8(path);
if (ret < 0)
return ret;
}
--
2.34.1
More information about the ffmpeg-devel
mailing list