From patchwork Tue May 17 12:29:56 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aman Karmani X-Patchwork-Id: 35805 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:a885:b0:7f:4be2:bd17 with SMTP id ca5csp2013388pzb; Tue, 17 May 2022 05:30:20 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx9OA0soH5CSpJjwYjsseDAlhr3fQuO+N1k6qC46tmrJJHnHnuaDVLWOxSyuNAQXG1TfkyW X-Received: by 2002:a17:906:c14e:b0:6f9:9d73:77e with SMTP id dp14-20020a170906c14e00b006f99d73077emr19122353ejc.258.1652790619538; Tue, 17 May 2022 05:30:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652790619; cv=none; d=google.com; s=arc-20160816; b=pJK+Xt6ufAEG+o6jRphjWzg39munW01LiaEC354dQ8kSybj44keGpFp+96o+UPYnsg L7SebcAN5YZvJyevVj5NVsH23a3zWjpS6U+PgxRzPNcOX3l8fE4+3BSTnTLm3+0MAHG7 pZWgFuaIbXYcKWNgwcqu5SlPt0xwRwmw50bnQP9IfUzMDxmo1WKDeHHfe/vKp2E5OiFd 7LnAG2g4BVhP5kx4X0cuIn53XSlCf8D5XDOFpEJAa183oA2GK+wgCdSXxSHHdJ2S0Swe JbV3XUVqJJML3+TFiGapI6r7A/DBkXGi6GRXk8FBi7SUvWFvF21wuA7DyarobH6p6eOD luAw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:cc:reply-to :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:to:mime-version:fcc:date:references :in-reply-to:message-id:from:dkim-signature:delivered-to; bh=ybKFwEaoEmNGwfFRRIdfaW0p/Vch0maHRqn5T5MnzRU=; b=hgFa1LZKwhXPmBHTV1ZCv6BRC57hG6mBw4eFUANGQXDr4QT94Ak5xHvfTbjiF6EwK3 A6oE1FvkLGW91uLQH+PIYSi2WFm3Bhb7GkdyIhPNrpAimB0Hw31BTbEQ9TuVqserH2fG MRT4zruz5WZlxl1KUB2EiZzRfO6oximq4iT/u79p3NDWN1b836tN0/EEEtWZaDn8yAEd dgLl/LgKm2Pq04AKh07N+lz3nsOLlOF4p/TrDTKhwAMdbd1ejRERNWhN/hUlXJqY9aVh UzmXjW2OiAqCaolE1gm4/awrB5wQ4xF2AL71ewPOcwifHmFSdtmykXiSQ30tAevzzJtE uIhA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20210112 header.b=DXbM3CuW; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id u23-20020a1709060b1700b006f37e31bf80si2678823ejg.120.2022.05.17.05.30.19; Tue, 17 May 2022 05:30:19 -0700 (PDT) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20210112 header.b=DXbM3CuW; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 6097868B425; Tue, 17 May 2022 15:30:08 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-pf1-f173.google.com (mail-pf1-f173.google.com [209.85.210.173]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 9870D68B314 for ; Tue, 17 May 2022 15:30:01 +0300 (EEST) Received: by mail-pf1-f173.google.com with SMTP id j6so16709644pfe.13 for ; Tue, 17 May 2022 05:30:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:message-id:in-reply-to:references:date:subject:fcc :content-transfer-encoding:mime-version:to:cc; bh=uulbtmIky/jbci4r7YbzEyBWG0sN2r94tWbYVQhGf5Y=; b=DXbM3CuWBI35xKFGPeAXNwk4iklRDZEiMaogx4s+VWToXSNHbCf9EPY/+gXARK8rq1 E8OJYZLCRs9jqZRFOTmdJxQrGqx/8AbLikzIhxlJo0+4mMqnzPlyAXVMXHGq/Ky9Rlj3 Eo601CTajrMFM4VeZ1KXfZEXAVrQZ+49WfKMqRrcH3dCblAUA4/cYnls+73fq3pLxDc6 6rSFNc3hsbQ9w3szNyTawTCl02whgFTPV6in2A/pvFSAVSQ9W8PChjHYIFzWbjluW5I9 IowIUFSQFsFB8U+lUgxGIc/SO50XxVIf3QgUUWy3HSDfhN/FOXg2572P7OTUDleA6AB5 eLiQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:message-id:in-reply-to:references:date :subject:fcc:content-transfer-encoding:mime-version:to:cc; bh=uulbtmIky/jbci4r7YbzEyBWG0sN2r94tWbYVQhGf5Y=; b=0HdAZ+G0jfCxZu86MqBoFgIPQfPfNnRAeHG74V2PgkPbwDdTqbfqU6os419KRQsgnf 0XKc4KiIHxRMHFus7ZAbGRYZY2YMSPXOdy1BrWHRSOY7MA7zEDakkkDAHEhkxhTH5TdG O6dhXePyBkLcNj8YPTB/+EW8IbJ7aGgkIyFEvE5Qau3VnBdA3IdzHtyLvIT509EPO9qe p/LovG1jn+m7cxZMXOTCyDFWWIssUgaeFPD//aUcqW/q3NxpurDeXvzPug4Ttps1q5wn oI1+voxtwRr/C0SuRqTYhcN6UNmbf/NAfhxV8hNT4ZEYmq3r70vJTemmHuEP5giQmyVX hu8w== X-Gm-Message-State: AOAM532XpMk6rFg0r8mnZgYU/J3MqrDI4PKEOCHoP/cR6pUbgzT2smmM Ka2zxSr513Uk45y2Xf54ZHfmGaS8hrNaFQ== X-Received: by 2002:a63:6808:0:b0:3c5:7405:1cd4 with SMTP id d8-20020a636808000000b003c574051cd4mr19522113pgc.444.1652790599834; Tue, 17 May 2022 05:29:59 -0700 (PDT) Received: from [127.0.0.1] (master.gitmailbox.com. [34.83.118.50]) by smtp.gmail.com with ESMTPSA id a17-20020a170902ecd100b00161478027f5sm6983197plh.150.2022.05.17.05.29.59 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 17 May 2022 05:29:59 -0700 (PDT) From: softworkz X-Google-Original-From: softworkz Message-Id: <7c455d7fa0df34478879391c52220d5f3519fe03.1652790597.git.ffmpegagent@gmail.com> In-Reply-To: References: Date: Tue, 17 May 2022 12:29:56 +0000 Fcc: Sent MIME-Version: 1.0 To: ffmpeg-devel@ffmpeg.org Subject: [FFmpeg-devel] [PATCH v4 1/2] avfilter: use av_fopen_utf8() instead of plain fopen() X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Cc: Martin =?utf-8?q?Storsj=C3=B6?= , softworkz , Tobias Rapp Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: 3d/bRQDGPLBV From: softworkz Unify file access operations by replacing usages of direct calls to posix fopen() to prepare for long filename support on Windows. Signed-off-by: softworkz --- libavfilter/af_firequalizer.c | 2 +- libavfilter/vf_deshake.c | 2 +- libavfilter/vf_psnr.c | 2 +- libavfilter/vf_signature.c | 4 ++-- libavfilter/vf_ssim.c | 2 +- libavfilter/vf_vidstabdetect.c | 2 +- libavfilter/vf_vidstabtransform.c | 2 +- libavfilter/vf_vmafmotion.c | 2 +- 8 files changed, 9 insertions(+), 9 deletions(-) diff --git a/libavfilter/af_firequalizer.c b/libavfilter/af_firequalizer.c index c19a2fe122..e1497dcef0 100644 --- a/libavfilter/af_firequalizer.c +++ b/libavfilter/af_firequalizer.c @@ -604,7 +604,7 @@ static int generate_kernel(AVFilterContext *ctx, const char *gain, const char *g if (ret < 0) return ret; - if (s->dumpfile && (!s->dump_buf || !s->analysis_rdft || !(dump_fp = fopen(s->dumpfile, "w")))) + if (s->dumpfile && (!s->dump_buf || !s->analysis_rdft || !(dump_fp = av_fopen_utf8(s->dumpfile, "w")))) av_log(ctx, AV_LOG_WARNING, "dumping failed.\n"); vars[VAR_CHS] = inlink->ch_layout.nb_channels; diff --git a/libavfilter/vf_deshake.c b/libavfilter/vf_deshake.c index 4f28467bb2..dea69e11cd 100644 --- a/libavfilter/vf_deshake.c +++ b/libavfilter/vf_deshake.c @@ -353,7 +353,7 @@ static av_cold int init(AVFilterContext *ctx) } if (deshake->filename) - deshake->fp = fopen(deshake->filename, "w"); + deshake->fp = av_fopen_utf8(deshake->filename, "w"); if (deshake->fp) fwrite("Ori x, Avg x, Fin x, Ori y, Avg y, Fin y, Ori angle, Avg angle, Fin angle, Ori zoom, Avg zoom, Fin zoom\n", 1, 104, deshake->fp); diff --git a/libavfilter/vf_psnr.c b/libavfilter/vf_psnr.c index 19852eaa69..09c2a5164a 100644 --- a/libavfilter/vf_psnr.c +++ b/libavfilter/vf_psnr.c @@ -280,7 +280,7 @@ static av_cold int init(AVFilterContext *ctx) if (!strcmp(s->stats_file_str, "-")) { s->stats_file = stdout; } else { - s->stats_file = fopen(s->stats_file_str, "w"); + s->stats_file = av_fopen_utf8(s->stats_file_str, "w"); if (!s->stats_file) { int err = AVERROR(errno); char buf[128]; diff --git a/libavfilter/vf_signature.c b/libavfilter/vf_signature.c index 4ca57ebf1d..904123fd4e 100644 --- a/libavfilter/vf_signature.c +++ b/libavfilter/vf_signature.c @@ -386,7 +386,7 @@ static int xml_export(AVFilterContext *ctx, StreamContext *sc, const char* filen FILE* f; unsigned int pot3[5] = { 3*3*3*3, 3*3*3, 3*3, 3, 1 }; - f = fopen(filename, "w"); + f = av_fopen_utf8(filename, "w"); if (!f) { int err = AVERROR(EINVAL); char buf[128]; @@ -500,7 +500,7 @@ static int binary_export(AVFilterContext *ctx, StreamContext *sc, const char* fi if (!buffer) return AVERROR(ENOMEM); - f = fopen(filename, "wb"); + f = av_fopen_utf8(filename, "wb"); if (!f) { int err = AVERROR(EINVAL); char buf[128]; diff --git a/libavfilter/vf_ssim.c b/libavfilter/vf_ssim.c index 32f313817d..4a82cbec06 100644 --- a/libavfilter/vf_ssim.c +++ b/libavfilter/vf_ssim.c @@ -404,7 +404,7 @@ static av_cold int init(AVFilterContext *ctx) if (!strcmp(s->stats_file_str, "-")) { s->stats_file = stdout; } else { - s->stats_file = fopen(s->stats_file_str, "w"); + s->stats_file = av_fopen_utf8(s->stats_file_str, "w"); if (!s->stats_file) { int err = AVERROR(errno); char buf[128]; diff --git a/libavfilter/vf_vidstabdetect.c b/libavfilter/vf_vidstabdetect.c index 267a62ea9b..4acae5a3ea 100644 --- a/libavfilter/vf_vidstabdetect.c +++ b/libavfilter/vf_vidstabdetect.c @@ -126,7 +126,7 @@ static int config_input(AVFilterLink *inlink) av_log(ctx, AV_LOG_INFO, " show = %d\n", s->conf.show); av_log(ctx, AV_LOG_INFO, " result = %s\n", s->result); - s->f = fopen(s->result, "w"); + s->f = av_fopen_utf8(s->result, "w"); if (s->f == NULL) { av_log(ctx, AV_LOG_ERROR, "cannot open transform file %s\n", s->result); return AVERROR(EINVAL); diff --git a/libavfilter/vf_vidstabtransform.c b/libavfilter/vf_vidstabtransform.c index 4619e9b256..17214f039f 100644 --- a/libavfilter/vf_vidstabtransform.c +++ b/libavfilter/vf_vidstabtransform.c @@ -191,7 +191,7 @@ static int config_input(AVFilterLink *inlink) av_log(ctx, AV_LOG_INFO, " zoomspeed = %g\n", tc->conf.zoomSpeed); av_log(ctx, AV_LOG_INFO, " interpol = %s\n", getInterpolationTypeName(tc->conf.interpolType)); - f = fopen(tc->input, "r"); + f = av_fopen_utf8(tc->input, "r"); if (!f) { int ret = AVERROR(errno); av_log(ctx, AV_LOG_ERROR, "cannot open input file %s\n", tc->input); diff --git a/libavfilter/vf_vmafmotion.c b/libavfilter/vf_vmafmotion.c index 8b7e9b17ef..2ac67e5935 100644 --- a/libavfilter/vf_vmafmotion.c +++ b/libavfilter/vf_vmafmotion.c @@ -312,7 +312,7 @@ static av_cold int init(AVFilterContext *ctx) if (!strcmp(s->stats_file_str, "-")) { s->stats_file = stdout; } else { - s->stats_file = fopen(s->stats_file_str, "w"); + s->stats_file = av_fopen_utf8(s->stats_file_str, "w"); if (!s->stats_file) { int err = AVERROR(errno); char buf[128];