[FFmpeg-devel] [PATCH 1/2] fftools: use av_fopen_utf8() instead of plain fopen()

softworkz ffmpegagent at gmail.com
Sat May 7 20:39:08 EEST 2022


From: softworkz <softworkz at hotmail.com>

Signed-off-by: softworkz <softworkz at hotmail.com>
---
 fftools/cmdutils.c   | 6 +++---
 fftools/ffmpeg.c     | 4 ++--
 fftools/opt_common.c | 2 +-
 3 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/fftools/cmdutils.c b/fftools/cmdutils.c
index 5d7cdc3e10..ca3a4c267a 100644
--- a/fftools/cmdutils.c
+++ b/fftools/cmdutils.c
@@ -818,7 +818,7 @@ FILE *get_preset_file(char *filename, size_t filename_size,
 
     if (is_path) {
         av_strlcpy(filename, preset_name, filename_size);
-        f = fopen(filename, "r");
+        f = av_fopen_utf8(filename, "r");
     } else {
 #if HAVE_GETMODULEHANDLE && defined(_WIN32)
         char datadir[MAX_PATH], *ls;
@@ -842,13 +842,13 @@ FILE *get_preset_file(char *filename, size_t filename_size,
                 continue;
             snprintf(filename, filename_size, "%s%s/%s.ffpreset", base[i],
                      i != 1 ? "" : "/.ffmpeg", preset_name);
-            f = fopen(filename, "r");
+            f = av_fopen_utf8(filename, "r");
             if (!f && codec_name) {
                 snprintf(filename, filename_size,
                          "%s%s/%s-%s.ffpreset",
                          base[i], i != 1 ? "" : "/.ffmpeg", codec_name,
                          preset_name);
-                f = fopen(filename, "r");
+                f = av_fopen_utf8(filename, "r");
             }
         }
     }
diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c
index a85ed18b08..a9bd4a790f 100644
--- a/fftools/ffmpeg.c
+++ b/fftools/ffmpeg.c
@@ -1261,9 +1261,9 @@ static void do_video_stats(OutputStream *ost, int frame_size)
 
     /* this is executed just the first time do_video_stats is called */
     if (!vstats_file) {
-        vstats_file = fopen(vstats_filename, "w");
+        vstats_file = av_fopen_utf8(vstats_filename, "w");
         if (!vstats_file) {
-            perror("fopen");
+            perror("av_fopen_utf8");
             exit_program(1);
         }
     }
diff --git a/fftools/opt_common.c b/fftools/opt_common.c
index c303db4d09..dda199d412 100644
--- a/fftools/opt_common.c
+++ b/fftools/opt_common.c
@@ -1178,7 +1178,7 @@ int init_report(const char *env, FILE **file)
     if (!envlevel)
         report_file_level = FFMAX(report_file_level, prog_loglevel);
 
-    report_file = fopen(filename.str, "w");
+    report_file = av_fopen_utf8(filename.str, "w");
     if (!report_file) {
         int ret = AVERROR(errno);
         av_log(NULL, AV_LOG_ERROR, "Failed to open report \"%s\": %s\n",
-- 
ffmpeg-codebot



More information about the ffmpeg-devel mailing list