From patchwork Sat Apr 23 20:56:21 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: nihil-admirari X-Patchwork-Id: 35387 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:3b9e:b0:7d:cfb5:dc7c with SMTP id b30csp1101158pzh; Sat, 23 Apr 2022 13:57:11 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxBR75uW0fucURFAHrtyy7lCqWkmCM7NiwZ6iPX0r3ZlS03oC5LY4YcRCMptKou1UzuH3dz X-Received: by 2002:a17:907:6e20:b0:6f3:842c:7fd8 with SMTP id sd32-20020a1709076e2000b006f3842c7fd8mr1487954ejc.247.1650747431172; Sat, 23 Apr 2022 13:57:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650747431; cv=none; d=google.com; s=arc-20160816; b=eZvb94SysHFxlwyG1SFXOdcrSeILM8hetJtfrcGsd4SEIDsvOG6Xw9YQZkL6g7Kkls dgZzxbMwdM0waP+gjxLQhv5hs0jUFE28XwlrwWCV3S348VTKzGvRQKXaS32Sx8rhkyvC /MThu8JkzMDuObE5f7KLvtUZArJeHd5hU3Rr76ndj0Xw1wCgV/YS9aakU0PeZD+KVddD FC5smHIzSfTIkAExSZIGJYo0SctW1mghgNBl0SPkoNhGQgGSzO/RA0O0VTIt0d7sPGHS WgzP8jHEjdCfn3GC/K8k+S3ceq8u9i+eCwyHrT+gtQ11GY/kYDXu9Vwhwd3Mw005Pwvh B69Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:reply-to:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:subject:mime-version:message-id:date:to:from :dkim-signature:delivered-to; bh=6cKyPLm/wqk+mCdNbUMrCtRzpgvK2oEmEsc56Xy+tUU=; b=P3gIMTuarrdfl9kj4IDB5P/SwaQbENV17t8rW+iwiCVjKmc12k90AmSC35CEn9SQOW SbMB9shAFsAmzPke0IVKNYnGhGgl8PRxWwt9BpVkFtXoGdb+dfcQxV2qBwFgSUHlrxYM aqch0Wa58Nzhaykg28YCCkgEVleNHchFMhO/ihjDXrZchv+SyFTmKBoxUuzVGGfZJ+wA f+vfXeGqFSPHeRDzyQsEc9OfrMYBXsOkAspjp36JEWw0ljEU9+/UXcAEsZDUcB8Y0Ed0 3SIZPkstHSM+nzXY7bsq+a/ZprUVtHwkVbP0xp1z74DKBoTPvD/D0wtpTSt7y2X5F8jc vA/w== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@mailo.com header.s=mailo header.b=F7+yPsX9; 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=NONE dis=NONE) header.from=mailo.com Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id y15-20020a056402440f00b00423ef0b0967si11817068eda.224.2022.04.23.13.57.10; Sat, 23 Apr 2022 13:57:11 -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=@mailo.com header.s=mailo header.b=F7+yPsX9; 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=NONE dis=NONE) header.from=mailo.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 32F1268B3E1; Sat, 23 Apr 2022 23:56:53 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from msg-4.mailo.com (ip-15.mailobj.net [213.182.54.15]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id C11C668B320 for ; Sat, 23 Apr 2022 23:56:43 +0300 (EEST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=mailo.com; s=mailo; t=1650747397; bh=l09NB6yHnfUJq/XranlSLduuubjHYqI5FnKWV+5Tc6I=; h=X-EA-Auth:From:To:Subject:Date:Message-Id:X-Mailer:MIME-Version: Content-Transfer-Encoding; b=F7+yPsX9Bz8SoXxdSARKi2SfDjeIbW3ZiVXJ6d65Y5i9qxbAfqDzzVpbw8ymMGL6l VSHLg2DalqJQK849VRYqGktRfsE6rU95OqEMJQek74Gn3Sq7RJ7sDpo0DsGivYlaJ+ z1YP2OvyGMtINuGLjv0zdf4+/xdQZPDlFzPFpmtA= Received: by b-2.in.mailobj.net [192.168.90.12] with ESMTP via ip-206.mailobj.net [213.182.55.206] Sat, 23 Apr 2022 22:56:37 +0200 (CEST) X-EA-Auth: zamZy5hUcD1b2vFewCxWK3uOOu1qeVDKKGdf0jLJY/HmBYizJINVGcT9a8t7lw9Gv3gZ0xq15XicPzMXJ4R1p7gM3PHR1H6uHAsNv5BvvAs= From: Nil Admirari To: ffmpeg-devel@ffmpeg.org Date: Sat, 23 Apr 2022 23:56:21 +0300 Message-Id: <20220423205626.39039-1-nil-admirari@mailo.com> X-Mailer: git-send-email 2.32.0 MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH v11 1/6] libavutil/wchar_filename.h: Add whcartoutf8, wchartoansi and utf8toansi 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: mv9NCkpnlxQv These functions are going to be used in libavformat/avisynth.c and fftools/cmdutils.c to remove MAX_PATH limit. --- libavutil/wchar_filename.h | 51 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) diff --git a/libavutil/wchar_filename.h b/libavutil/wchar_filename.h index 90f08245..c0e5d47e 100644 --- a/libavutil/wchar_filename.h +++ b/libavutil/wchar_filename.h @@ -40,6 +40,57 @@ static inline int utf8towchar(const char *filename_utf8, wchar_t **filename_w) MultiByteToWideChar(CP_UTF8, 0, filename_utf8, -1, *filename_w, num_chars); return 0; } + +av_warn_unused_result +static inline int wchartocp(unsigned int code_page, const wchar_t *filename_w, + char **filename) +{ + DWORD flags = code_page == CP_UTF8 ? MB_ERR_INVALID_CHARS : 0; + int num_chars = WideCharToMultiByte(code_page, flags, filename_w, -1, + NULL, 0, NULL, NULL); + if (num_chars <= 0) { + *filename = NULL; + return 0; + } + *filename = av_calloc(num_chars, sizeof(char)); + if (!*filename) { + errno = ENOMEM; + return -1; + } + WideCharToMultiByte(code_page, flags, filename_w, -1, + *filename, num_chars, NULL, NULL); + return 0; +} + +av_warn_unused_result +static inline int wchartoutf8(const wchar_t *filename_w, char **filename) +{ + return wchartocp(CP_UTF8, filename_w, filename); +} + +av_warn_unused_result +static inline int wchartoansi(const wchar_t *filename_w, char **filename) +{ + return wchartocp(CP_ACP, filename_w, filename); +} + +av_warn_unused_result +static inline int utf8toansi(const char *filename_utf8, char **filename) +{ + wchar_t *filename_w = NULL; + int ret = -1; + if (utf8towchar(filename_utf8, &filename_w)) + return -1; + + if (!filename_w) { + *filename = NULL; + return 0; + } + + ret = wchartoansi(filename_w, filename); + av_free(filename_w); + return ret; +} #endif #endif /* AVUTIL_WCHAR_FILENAME_H */ From patchwork Sat Apr 23 20:56:22 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: nihil-admirari X-Patchwork-Id: 35385 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:3b9e:b0:7d:cfb5:dc7c with SMTP id b30csp1101090pzh; Sat, 23 Apr 2022 13:56:54 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzmY59UBrFE0bDHm8q0eiWGiJLXRTmJ2hrnSFtvmxlXhAxkRHIt63XhxivxKxJU4KY1AhQU X-Received: by 2002:a17:906:d10c:b0:6cd:4aa2:cd62 with SMTP id b12-20020a170906d10c00b006cd4aa2cd62mr9523262ejz.229.1650747414512; Sat, 23 Apr 2022 13:56:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650747414; cv=none; d=google.com; s=arc-20160816; b=oxIvai9D5/b1spqh1+AZxdxw0zlfMA+WYyb0uyaxgW8MOseSSd9VgmZQhIXsD+0WWX P2jjgFK7NLkwjPQ/QpB/xei18S3y++Bb75s9uiCklL4CUr0/J15nkAS8zyWN6QD6SHil c4P76heVKrvHMJIdgA6qjBO6VIgSQwG3dAS2evlzuUcZh3rCtRmWDO7yszNo3wo4zPTr nWuv9M+thZBv4yEJVd/cVUWfyf7gvBWrja6s1Hmyei3g/jR/a6d7oBY38UR+dMvtG2Q1 uGOlf0vXvj0LEdSp+eQKVun+W25yS7fmMGy6nCkt/308JiP+AYpe6pRY21vWU/RwWMHl 6Fig== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:reply-to:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:subject:mime-version:references:in-reply-to:message-id :date:to:from:dkim-signature:delivered-to; bh=Pl0PLxUStBiZGAoVIeSQETXGuoV8tZb9V3Zrnf4nwP4=; b=DWruE+TjIMONV+3+dpiGo6XIBXuVEw9uh2MN7wDFaa/PjvCdwzYNK27Isb5yUsJ4Qz j/Xh7sS+HWNp9x3ilUQWsSiiverNh4yNHz3BLQetm72B9kkFc+VLGy2KGzdLffHzS5Hx tIoUktrI8x14K02oIBufisMxO6yucaap0rAxkxiDZ9q1FE0PdbruFfhUuXEGa43UJc50 p7F7l+2tWjdjJcWWQVVrUPVnDvIiePMZXrau58/Jyz74yhs0ZkY3ABaD59yU8P/TK7Yv +niRq8b7akhf5cl5CdmbLn8CRN3dG61v6M/6jKUqyhAcF33ygFbQkYpCYJGofajF+/Ph NoBw== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@mailo.com header.s=mailo header.b=R7buzAA2; 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=NONE dis=NONE) header.from=mailo.com Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id mb11-20020a170906eb0b00b006e7fd413915si10229649ejb.946.2022.04.23.13.56.54; Sat, 23 Apr 2022 13:56:54 -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=@mailo.com header.s=mailo header.b=R7buzAA2; 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=NONE dis=NONE) header.from=mailo.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 3D4AB68B393; Sat, 23 Apr 2022 23:56:51 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from msg-4.mailo.com (ip-15.mailobj.net [213.182.54.15]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id BE33D68B2CC for ; Sat, 23 Apr 2022 23:56:43 +0300 (EEST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=mailo.com; s=mailo; t=1650747397; bh=c6I6DJoJEcHze4lKJk/RqaRg3MXYs7DyvuFduRUa2Fo=; h=X-EA-Auth:From:To:Subject:Date:Message-Id:X-Mailer:In-Reply-To: References:MIME-Version:Content-Transfer-Encoding; b=R7buzAA2gAmhqAUt09KxEK7QezY6/qWVMv97Gctm1hQ0q8wVyxMkd569R8S5WJmji shvbq3D65Xv9vntxb0ZFa/7Uou5TxQ1PcX7wmYkLb2Mf4wQ04HZVnO6CEmKHpgFo3e yGPRNJADtDlpe4En06OR46lIiCu/fTd/dcir3tts= Received: by b-2.in.mailobj.net [192.168.90.12] with ESMTP via ip-206.mailobj.net [213.182.55.206] Sat, 23 Apr 2022 22:56:37 +0200 (CEST) X-EA-Auth: n/pN4b3Q+FF7MmEe0vQPVkouzPMAUYf0CwfVIOVA0x1Pa37djo4R72QKu2PBK6DQkPU58G3J6oEJyueEPv7JR+iDFuKO6qUv/jtq+E7K91c= From: Nil Admirari To: ffmpeg-devel@ffmpeg.org Date: Sat, 23 Apr 2022 23:56:22 +0300 Message-Id: <20220423205626.39039-2-nil-admirari@mailo.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20220423205626.39039-1-nil-admirari@mailo.com> References: <20220423205626.39039-1-nil-admirari@mailo.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH v11 2/6] libavformat/avisynth.c: Remove MAX_PATH limit 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: pcBvF5WptWjf --- libavformat/avisynth.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/libavformat/avisynth.c b/libavformat/avisynth.c index 8ba2bdea..f7bea8c3 100644 --- a/libavformat/avisynth.c +++ b/libavformat/avisynth.c @@ -34,6 +34,7 @@ /* Platform-specific directives. */ #ifdef _WIN32 #include "compat/w32dlfcn.h" + #include "libavutil/wchar_filename.h" #undef EXTERN_C #define AVISYNTH_LIB "avisynth" #else @@ -810,8 +811,7 @@ static int avisynth_open_file(AVFormatContext *s) AVS_Value arg, val; int ret; #ifdef _WIN32 - char filename_ansi[MAX_PATH * 4]; - wchar_t filename_wc[MAX_PATH * 4]; + char *filename_ansi = NULL; #endif if (ret = avisynth_context_create(s)) @@ -819,10 +819,12 @@ static int avisynth_open_file(AVFormatContext *s) #ifdef _WIN32 /* Convert UTF-8 to ANSI code page */ - MultiByteToWideChar(CP_UTF8, 0, s->url, -1, filename_wc, MAX_PATH * 4); - WideCharToMultiByte(CP_THREAD_ACP, 0, filename_wc, -1, filename_ansi, - MAX_PATH * 4, NULL, NULL); + if (utf8toansi(s->url, &filename_ansi)) { + ret = AVERROR_UNKNOWN; + goto fail; + } arg = avs_new_value_string(filename_ansi); + av_free(filename_ansi); #else arg = avs_new_value_string(s->url); #endif From patchwork Sat Apr 23 20:56:23 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: nihil-admirari X-Patchwork-Id: 35388 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:3b9e:b0:7d:cfb5:dc7c with SMTP id b30csp1101204pzh; Sat, 23 Apr 2022 13:57:20 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwl1sOd3Uyakm3LI9N/Ewo5TZwAoiTYdnKHQ874fudaYfUtsQh6WmrK7UgPKonR9Bv8YWzh X-Received: by 2002:a17:907:6ea5:b0:6ef:f593:5cce with SMTP id sh37-20020a1709076ea500b006eff5935ccemr9528267ejc.182.1650747440447; Sat, 23 Apr 2022 13:57:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650747440; cv=none; d=google.com; s=arc-20160816; b=GpnMyPiEQIfA4Kuc88l1n52RUPbfEmdCPOW4WM82rYiQvd1sVZIpkdVkJobP3G6ODj //hSfGSFG8Rjh3ZubdfQIcEjisvAhh4cB7mz5SsWbGnVhrDBCkuNDozpQfocijhzd/ar 1hiGRmGqcpLUzBQYvqEqM7s2zW3AhPidb+LfmC6aYmRZ1VMvzQcqfpMpfTXD5IS4b1VS OgiAA8XGeKFihNPyDDif1ha9zFv94emKQ9EwQs5rbKj887ijySdCjfgyGGeGkxLuiDk2 qBlFpMmGnF9IHHTElwBsC5BAEJzbvSMDxUsVFhig3heABbdZc7QoXJue/1P0IJBMfbF1 pm4g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:reply-to:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:subject:mime-version:references:in-reply-to:message-id :date:to:from:dkim-signature:delivered-to; bh=uHyCHVBUkrH5Yz4E5WxGL0uu6iqYEBFNH0S35hpjK60=; b=iGj3lyJ2psX4svZ20xAUj79MlMO76TwiSVaKQqLlgDwcwsT3jZo48zXbqhAM091lAh 9540KlWWmxBnIqVYyNrmU2tOrXUeVlMQWnOBfiVqSDHf0jX9YlIYgvo0pQjzU7oF7YZD D8/GS8gKrFDlNxHP/SD2QEAsWnae9OtKrpkCYh5jCIADmad9IwxrVk+XJ/ZUcbgLQ8O+ fcOep/I4DtQ8gPpNEI407WfbbpMoYWLYzXEBCwKzV9RcLVEl6y+DYGcfC5iqRKA115DG NZRi7ToI6uYigEU8J6WxG1SY735wMDlOApfwAbxN+WzNcvYh8YVwY83PtaW9FkFuWa7s yawA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@mailo.com header.s=mailo header.b=nQvEHviX; 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=NONE dis=NONE) header.from=mailo.com Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id fy16-20020a1709069f1000b006df76385f16si9409772ejc.950.2022.04.23.13.57.20; Sat, 23 Apr 2022 13:57:20 -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=@mailo.com header.s=mailo header.b=nQvEHviX; 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=NONE dis=NONE) header.from=mailo.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 13BF068B3FA; Sat, 23 Apr 2022 23:56:54 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from msg-4.mailo.com (ip-15.mailobj.net [213.182.54.15]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id C669668B383 for ; Sat, 23 Apr 2022 23:56:43 +0300 (EEST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=mailo.com; s=mailo; t=1650747398; bh=o7cCSSHxhw0qMfLHF34MnbZ4lwmJnRwVmoNOxavqbwM=; h=X-EA-Auth:From:To:Subject:Date:Message-Id:X-Mailer:In-Reply-To: References:MIME-Version:Content-Transfer-Encoding; b=nQvEHviX2icNAaCtl9TL+PaVoeEpUx4obwr4RfnPaIq007pk1yc944i63onVabUjF OETnljtR1JOf3ENf/zOdudBM7WBPQ8sQEGvWaVEv+MvV5pcl2luKk+cQlGfh5Hel6O Z4INJahr5oEfiTdSot1C6Ea4GSQ2Gk56fjlpI06M= Received: by b-2.in.mailobj.net [192.168.90.12] with ESMTP via ip-206.mailobj.net [213.182.55.206] Sat, 23 Apr 2022 22:56:38 +0200 (CEST) X-EA-Auth: IbwXMI6ARkmuzDbGpAZQnQZGl/HswY7xCR8ytHSrCig/qT+8EsRre/v5xaua11tzpTadGewyP1qQq/tUw3v56nL0/87jOpBZVYgwF7I2e94= From: Nil Admirari To: ffmpeg-devel@ffmpeg.org Date: Sat, 23 Apr 2022 23:56:23 +0300 Message-Id: <20220423205626.39039-3-nil-admirari@mailo.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20220423205626.39039-1-nil-admirari@mailo.com> References: <20220423205626.39039-1-nil-admirari@mailo.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH v11 3/6] compat/w32dlfcn.h: Remove MAX_PATH limit and replace LoadLibraryExA with LoadLibraryExW 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: Pvy5D4qU7eiE --- compat/w32dlfcn.h | 78 ++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 64 insertions(+), 14 deletions(-) diff --git a/compat/w32dlfcn.h b/compat/w32dlfcn.h index 52a94efa..2284ac7a 100644 --- a/compat/w32dlfcn.h +++ b/compat/w32dlfcn.h @@ -25,6 +25,30 @@ #if (_WIN32_WINNT < 0x0602) || HAVE_WINRT #include "libavutil/wchar_filename.h" #endif + +static inline wchar_t *get_module_filename(HMODULE module) +{ + wchar_t *path = NULL, *new_path = NULL; + DWORD path_size = 0, path_len = 0; + + do { + path_size = path_size ? 2 * path_size : MAX_PATH; + new_path = av_realloc_array(path, path_size, sizeof *path); + if (!new_path) { + av_free(path); + return NULL; + } + path = new_path; + path_len = GetModuleFileNameW(module, path, path_size); + } while (path_len && path_size <= 32768 && path_size <= path_len); + + if (!path_len) { + av_free(path); + return NULL; + } + return path; +} + /** * Safe function used to open dynamic libs. This attempts to improve program security * by removing the current directory from the dll search path. Only dll's found in the @@ -34,29 +58,53 @@ */ static inline HMODULE win32_dlopen(const char *name) { + wchar_t *name_w = NULL; + if (utf8towchar(name, &name_w)) + name_w = NULL; #if _WIN32_WINNT < 0x0602 // Need to check if KB2533623 is available if (!GetProcAddress(GetModuleHandleW(L"kernel32.dll"), "SetDefaultDllDirectories")) { HMODULE module = NULL; - wchar_t *path = NULL, *name_w = NULL; - DWORD pathlen; - if (utf8towchar(name, &name_w)) + wchar_t *path = NULL, *new_path = NULL; + DWORD pathlen, pathsize, namelen; + if (!name_w) goto exit; - path = (wchar_t *)av_calloc(MAX_PATH, sizeof(wchar_t)); + namelen = wcslen(name_w); // Try local directory first - pathlen = GetModuleFileNameW(NULL, path, MAX_PATH); - pathlen = wcsrchr(path, '\\') - path; - if (pathlen == 0 || pathlen + wcslen(name_w) + 2 > MAX_PATH) + path = get_module_filename(NULL); + if (!path) goto exit; - path[pathlen] = '\\'; + new_path = wcsrchr(path, '\\'); + if (!new_path) + goto exit; + pathlen = new_path - path; + pathsize = pathlen + namelen + 2; + new_path = av_realloc_array(path, pathsize, sizeof *path); + if (!new_path) + goto exit; + path = new_path; wcscpy(path + pathlen + 1, name_w); module = LoadLibraryExW(path, NULL, LOAD_WITH_ALTERED_SEARCH_PATH); if (module == NULL) { // Next try System32 directory - pathlen = GetSystemDirectoryW(path, MAX_PATH); - if (pathlen == 0 || pathlen + wcslen(name_w) + 2 > MAX_PATH) + pathlen = GetSystemDirectoryW(path, pathsize); + if (!pathlen) goto exit; - path[pathlen] = '\\'; + // Buffer is not enough in two cases: + // 1. system directory + \ + module name + // 2. system directory even without module name. + if (pathlen + namelen + 2 > pathsize) { + pathsize = pathlen + namelen + 2; + new_path = av_realloc_array(path, pathsize, sizeof *path); + if (!new_path) + goto exit; + path = new_path; + // Query again to handle case #2. + pathlen = GetSystemDirectoryW(path, pathsize); + if (!pathlen) + goto exit; + } + path[pathlen] = L'\\'; wcscpy(path + pathlen + 1, name_w); module = LoadLibraryExW(path, NULL, LOAD_WITH_ALTERED_SEARCH_PATH); } @@ -73,15 +121,17 @@ exit: # define LOAD_LIBRARY_SEARCH_SYSTEM32 0x00000800 #endif #if HAVE_WINRT - wchar_t *name_w = NULL; int ret; - if (utf8towchar(name, &name_w)) + if (!name_w) return NULL; ret = LoadPackagedLibrary(name_w, 0); av_free(name_w); return ret; #else - return LoadLibraryExA(name, NULL, LOAD_LIBRARY_SEARCH_APPLICATION_DIR | LOAD_LIBRARY_SEARCH_SYSTEM32); + /* filename may be be in CP_ACP */ + if (!name_w) + return LoadLibraryExA(name, NULL, LOAD_LIBRARY_SEARCH_APPLICATION_DIR | LOAD_LIBRARY_SEARCH_SYSTEM32); + return LoadLibraryExW(name_w, NULL, LOAD_LIBRARY_SEARCH_APPLICATION_DIR | LOAD_LIBRARY_SEARCH_SYSTEM32); #endif } #define dlopen(name, flags) win32_dlopen(name) From patchwork Sat Apr 23 20:56:24 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: nihil-admirari X-Patchwork-Id: 35386 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:3b9e:b0:7d:cfb5:dc7c with SMTP id b30csp1101123pzh; Sat, 23 Apr 2022 13:57:02 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzXcTDPn4XlKVtazj3qaHzeoICnsiG1yDAke+eIY8xBiyRcF/78GiroMLVOAbfeLt6lZYM0 X-Received: by 2002:a17:907:97c9:b0:6ef:f282:fe94 with SMTP id js9-20020a17090797c900b006eff282fe94mr9502692ejc.531.1650747422631; Sat, 23 Apr 2022 13:57:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650747422; cv=none; d=google.com; s=arc-20160816; b=V5CZiW6ynfkxQCHlm2uvHikLtwcx1aoKgBex5M5nqq4iv4P+GRaiVvjPtHEp5aj5/m IUyl8d/4DPTW1j9gsvD5F1WWVY7OgYWxkokiNLZnunm1vKQX9Th191dbj0ANsyxQfpck mK4wPnOKZ7dJpMQ3N8ipsM1m3BjexaZJfFLUpBMYPLCQcTvhem0coagNOzUNP9XXZQHe lYcAlV+eGqH5HDfjblo9vaFfg+Tfhnp+7PiOwDMmHbpvMv0JTgHPCuYxtXQkVT/TfOBa Bo9lVd5AQBbdkABD2BhG3lcXnG76hq2HG0pjIntTsTV+vhbhrZCkU4jXH/VxOi+4B7CZ IgvA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:reply-to:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:subject:mime-version:references:in-reply-to:message-id :date:to:from:dkim-signature:delivered-to; bh=Huor9UooHlE7u96SvhHaJ9kmEY6l2U2SvPIK4nWuA2M=; b=m1EaBBi8nvO+hnr38AZM0RliUpHZj6Toj+C5ju1G6rK07w53fZt/nUbfPrU2zmuLzb kwlTp/sDhJasnCjlcUA+fwCJ5RyfEi3E7WFjHdZW792WVYmHznxhzTMlUSN6R8OdKTFF O77R2C+4bqv8JMyzs0Ej4Jl96IlXyudvbvU98sQ5F27VAQFC8lwsozQukyDczkd5rVwz /ekGcbkRXV1dSNaLBeCqPCltsgl4OhslXDyZNZOyA/b2YmfPFqdoBPeawG8SL0bzJDp/ JFJsreObeonWyLy59n+HIpr45O78TyK/FpxzChTcDAB2EEw1V680526rFoWh7KWzIE2X 7cww== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@mailo.com header.s=mailo header.b=WCmJWO4b; 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=NONE dis=NONE) header.from=mailo.com Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id kw1-20020a170907770100b006e7f908e9d5si9392909ejc.607.2022.04.23.13.57.02; Sat, 23 Apr 2022 13:57:02 -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=@mailo.com header.s=mailo header.b=WCmJWO4b; 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=NONE dis=NONE) header.from=mailo.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 3F0E768B3D6; Sat, 23 Apr 2022 23:56:52 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from msg-6.mailo.com (ip-16.mailobj.net [213.182.54.16]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id BBB6C68B20C for ; Sat, 23 Apr 2022 23:56:43 +0300 (EEST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=mailo.com; s=mailo; t=1650747399; bh=+TkqmvxGaamkPxZzunE7vXNdSh7S4bjmHfuLuRW01ws=; h=X-EA-Auth:From:To:Subject:Date:Message-Id:X-Mailer:In-Reply-To: References:MIME-Version:Content-Transfer-Encoding; b=WCmJWO4bD4qtslVaIqYsR3n29I16GjwwyoaKgHWAWAfao88i+vPLqW6SMn2WyypZe EZIQoLrTfgwvECKDf8pIjRo0kOPIgH4QavwCXZikbwfobPyeoYhaYAYcg2/WEtfXfF YL1DWDfTjLuidtqVc0CX5wxPJbMyjYQ9UQdOBnFk= Received: by b-2.in.mailobj.net [192.168.90.12] with ESMTP via ip-206.mailobj.net [213.182.55.206] Sat, 23 Apr 2022 22:56:39 +0200 (CEST) X-EA-Auth: 6gWQ2HrpvRIge04Wx7YbkzGU8Hjh1CbtF0tRe4BGXK6iHB1yzywlUFe+tvXdDcdIwyex75guVqqxglp+i97kPj/DlwTqTY/POo1gEpKt1xA= From: Nil Admirari To: ffmpeg-devel@ffmpeg.org Date: Sat, 23 Apr 2022 23:56:24 +0300 Message-Id: <20220423205626.39039-4-nil-admirari@mailo.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20220423205626.39039-1-nil-admirari@mailo.com> References: <20220423205626.39039-1-nil-admirari@mailo.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH v11 4/6] fftools/cmdutils.c: Remove MAX_PATH limit 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: NwjZRlnw+jNu --- fftools/cmdutils.c | 31 +++++++++++++++++++++++++------ 1 file changed, 25 insertions(+), 6 deletions(-) diff --git a/fftools/cmdutils.c b/fftools/cmdutils.c index 5d7cdc3e..d42bb04e 100644 --- a/fftools/cmdutils.c +++ b/fftools/cmdutils.c @@ -50,6 +50,7 @@ #include "opt_common.h" #ifdef _WIN32 #include +#include "compat/w32dlfcn.h" #endif AVDictionary *sws_dict; @@ -812,6 +813,9 @@ FILE *get_preset_file(char *filename, size_t filename_size, { FILE *f = NULL; int i; +#if HAVE_GETMODULEHANDLE && defined(_WIN32) + char *datadir = NULL; +#endif const char *base[3] = { getenv("FFMPEG_DATADIR"), getenv("HOME"), FFMPEG_DATADIR, }; @@ -821,19 +825,31 @@ FILE *get_preset_file(char *filename, size_t filename_size, f = fopen(filename, "r"); } else { #if HAVE_GETMODULEHANDLE && defined(_WIN32) - char datadir[MAX_PATH], *ls; + wchar_t *datadir_w = get_module_filename(NULL); base[2] = NULL; - if (GetModuleFileNameA(GetModuleHandleA(NULL), datadir, sizeof(datadir) - 1)) + if (wchartoansi(datadir_w, &datadir)) + datadir = NULL; + av_free(datadir_w); + + if (datadir) { - for (ls = datadir; ls < datadir + strlen(datadir); ls++) + char *ls; + for (ls = datadir; *ls; ls++) if (*ls == '\\') *ls = '/'; if (ls = strrchr(datadir, '/')) { - *ls = 0; - strncat(datadir, "/ffpresets", sizeof(datadir) - 1 - strlen(datadir)); - base[2] = datadir; + ptrdiff_t datadir_len = ls - datadir; + size_t desired_size = datadir_len + strlen("/ffpresets") + 1; + char *new_datadir = av_realloc_array( + datadir, desired_size, sizeof *datadir); + if (new_datadir) { + datadir = new_datadir; + datadir[datadir_len] = 0; + strncat(datadir, "/ffpresets", desired_size - 1 - datadir_len); + base[2] = datadir; + } } } #endif @@ -853,6 +869,9 @@ FILE *get_preset_file(char *filename, size_t filename_size, } } +#if HAVE_GETMODULEHANDLE && defined(_WIN32) + av_free(datadir); +#endif return f; } From patchwork Sat Apr 23 20:56:25 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: nihil-admirari X-Patchwork-Id: 35389 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:3b9e:b0:7d:cfb5:dc7c with SMTP id b30csp1101260pzh; Sat, 23 Apr 2022 13:57:30 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyBFjiXEip1xvzlJSpc6+Zqk+ghvD41eExGLiWSBAp5qGhuCJisr24CwBTUEMTlTFX1rmmr X-Received: by 2002:a17:907:628e:b0:6d9:c6fa:6168 with SMTP id nd14-20020a170907628e00b006d9c6fa6168mr9522510ejc.132.1650747450673; Sat, 23 Apr 2022 13:57:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650747450; cv=none; d=google.com; s=arc-20160816; b=u9UvbV3BU8Z1fX3EugGmX6uw1Hrn7pLCcdFZ69z0zkmJfvadXw+dFcoLjSRrgHPWZf CBTqTsYCRB8HjIScBUQaBsBnVF1iv6lTx+CYfkesjjjRTrGAraywNPu11W+vqU14kxik biCCXH612k+PQ+DyGYJBuCk5iST9+jJHiGqyd0shHVKABLwYloSPoC0GdJ17xPSjV59w YtRmEs3BMdNoFZm2CjPp20LJKifsBpt31rPZQKILpHRclEt22ZNulLjNBK4xtQ3grh4h n0b+4jjJwa+NHqw3p2cNYsxC6iM591tFLKaMeAem8K+9Yi84Dg+A6jtRXg1Lag0ftbjH q0mA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:reply-to:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:subject:mime-version:references:in-reply-to:message-id :date:to:from:dkim-signature:delivered-to; bh=yJ++MKXYIxrHDHeuwvXOriTfXAOmbMp3sZdxVZGxMTU=; b=IVZdKasIxJp2AFzxTFJaeDUoxBA5n1Q8wXTmDd2dndd8ccrlvp/NlZuQRqCxkPqsAg mdGu40exK7FUEoVjNXn6KQkW9oQEXo+5Wdi/LFB2rqXhgud+f+qM7ZxxHWIOBGLZyuQA g7xOvppTyJgiQAqe0j1um1nIf5e5qmocQsFRP/XL2iCSVacQxJ/5T6L2UsiSCjLvKPlz 4r61EMThKXNPYXjHlcb/Y66Nv/43hZHHHUgPdUTSadmgLuFItXN+3ZF9HcC9E+S5RuGw sz0LudhDmtHmTh0Um3FspbcISabkyeYC9TlgfcRHmcXnYFmVPtRQRGQnTFhsOxiVbE/j 5LeA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@mailo.com header.s=mailo header.b=IWZ4gbjm; 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=NONE dis=NONE) header.from=mailo.com Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id i26-20020a056402055a00b00425b355cc6esi5005951edx.435.2022.04.23.13.57.30; Sat, 23 Apr 2022 13:57:30 -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=@mailo.com header.s=mailo header.b=IWZ4gbjm; 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=NONE dis=NONE) header.from=mailo.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id E207168B410; Sat, 23 Apr 2022 23:56:54 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from msg-4.mailo.com (ip-15.mailobj.net [213.182.54.15]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id C3D6B68B375 for ; Sat, 23 Apr 2022 23:56:43 +0300 (EEST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=mailo.com; s=mailo; t=1650747400; bh=hgZlviNGbxJy64Ovqik4Y+rNDcrjoXqjdemKcxkdE6g=; h=X-EA-Auth:From:To:Subject:Date:Message-Id:X-Mailer:In-Reply-To: References:MIME-Version:Content-Transfer-Encoding; b=IWZ4gbjmNbx+WX/t0hQYLLWei91RfEzXXoym+RQndCX0f0XoQIcDYPduDdsqD+K9K hcPdtHI8rJ+wlIC2FaeCeeXcPdsSlAzeTUbVp2JSdkReP2xq6xbRtKIjhUtQcfe01Y 8Dd9GcKmITgzVFaHysnnNx3rASCl07OBNwcvng0I= Received: by b-2.in.mailobj.net [192.168.90.12] with ESMTP via ip-206.mailobj.net [213.182.55.206] Sat, 23 Apr 2022 22:56:40 +0200 (CEST) X-EA-Auth: htmp0dnIRGX7g0wDeXWQLW6AjseLZQxue/BgIKzFCKBbDEMTUU0l1Fu9z8ah9E+1ED034jg3flBWnMUFN2Yn0TmekyswbEPh8eNuBQAv4mc= From: Nil Admirari To: ffmpeg-devel@ffmpeg.org Date: Sat, 23 Apr 2022 23:56:25 +0300 Message-Id: <20220423205626.39039-5-nil-admirari@mailo.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20220423205626.39039-1-nil-admirari@mailo.com> References: <20220423205626.39039-1-nil-admirari@mailo.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH v11 5/6] fftools: Enable long path support on Windows (fixes #8885) 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: JvT7mqHJzeoO Newer versions of Windows (Windows 10 1607 and newer) can support path names longer than MAX_PATH (260 characters). To take advantage of that, an application needs to opt in, by including a small manifest as a resource. Application must be prepared to handle filenames greater than MAX_PATH. Additionally, the path length limitation is only lifted for file APIs that pass paths as wchar_t. Therefore, the preceding patches have refactored a few remaining cases where: 1. filename length was restricted to MAX_PATH 2. files were opened using ANSI functions. On older versions of Windows, the newly added manifest has no effect. --- fftools/Makefile | 5 +++++ fftools/fftools.manifest | 10 ++++++++++ fftools/manifest.rc | 3 +++ 3 files changed, 18 insertions(+) create mode 100644 fftools/fftools.manifest create mode 100644 fftools/manifest.rc diff --git a/fftools/Makefile b/fftools/Makefile index 81ad6c4f..105ae5cc 100644 --- a/fftools/Makefile +++ b/fftools/Makefile @@ -15,6 +15,11 @@ OBJS-ffmpeg += \ fftools/ffmpeg_mux.o \ fftools/ffmpeg_opt.o \ +# Windows resource files +OBJS-ffmpeg-$(HAVE_GNU_WINDRES) += fftools/manifest.o +OBJS-ffplay-$(HAVE_GNU_WINDRES) += fftools/manifest.o +OBJS-ffprobe-$(HAVE_GNU_WINDRES) += fftools/manifest.o + define DOFFTOOL OBJS-$(1) += fftools/cmdutils.o fftools/opt_common.o fftools/$(1).o $(OBJS-$(1)-yes) $(1)$(PROGSSUF)_g$(EXESUF): $$(OBJS-$(1)) diff --git a/fftools/fftools.manifest b/fftools/fftools.manifest new file mode 100644 index 00000000..30b7d8fe --- /dev/null +++ b/fftools/fftools.manifest @@ -0,0 +1,10 @@ + + + + + + + true + + + diff --git a/fftools/manifest.rc b/fftools/manifest.rc new file mode 100644 index 00000000..e436fa73 --- /dev/null +++ b/fftools/manifest.rc @@ -0,0 +1,3 @@ +#include + +CREATEPROCESS_MANIFEST_RESOURCE_ID RT_MANIFEST "fftools.manifest" From patchwork Sat Apr 23 20:57:14 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: nihil-admirari X-Patchwork-Id: 35390 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:3b9e:b0:7d:cfb5:dc7c with SMTP id b30csp1101300pzh; Sat, 23 Apr 2022 13:57:40 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxeFmjxF7yK9pXSo9Jkf4JkXthNeO3R4H0EAPWKxWPwNHcT7QE7u+/eWUc6ZXAtVk03lMpz X-Received: by 2002:a17:907:3e0e:b0:6f3:845a:8d2d with SMTP id hp14-20020a1709073e0e00b006f3845a8d2dmr1483805ejc.78.1650747460117; Sat, 23 Apr 2022 13:57:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650747460; cv=none; d=google.com; s=arc-20160816; b=gdZWhTquUt57Oc/PNX4OYUty1xk7WQD//DGLYaNJbslTUupknkLQMPfWELA5r3pyRD glEyp6aTuFKhW06x8hB/KQ2nQkWncZyb7i3kj5H8LS5j484CTkhIowayVWs0N3Gd8wcH vSO+NCDdVm3smjEhZ1KRGWU1OCJJ1B9Y2JxGtZs9d1WV3jjDJ3RniWIPVTEV+iUDRAX3 RsM929RMuKlXrr6By9vVB9SixqnO24raHqpcTuL7Dt8cffcLxfg4Dq3m4PZzS6qxVrbX WAC26mY45PsLHRuTotHB0tdfm6loeeNoOrQD4XVtnmCyonDiufLfOvceKtVgGGbXa9Pu fX7g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:reply-to:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:subject:mime-version:references:in-reply-to:message-id :date:to:from:dkim-signature:delivered-to; bh=MaT+MoK+ncRxcsAsBuF3dj+4I8QDQPjrOZYhUNKuURg=; b=FWppcWn2mo1QV8xrJgsBCU8841AhMmaDrzS8kkJc3fQiyxm44qwchatX5cswoJ4eRm PXjOzDJVE1Vs9M/KcwbSqNiShjWf6/K0UQzhhLSgeNJGYQ1hlgn2q6hnoeBUzGXoMnQf OaEUxVFHqZlsOnjtjQsksEKfYe1CHhmtccfT71kZEBoPWLxkCxJUX8zrf6Afk06DESgZ DWxx5PbJvuy0/EfT9/p81uW5q2aaHwjm8KjhPQA9Q3f4YcKvIaoQ5F1SWC7zFX6bBS6H hMkWFCD7x0S3TlhiKGMvgGvhZVJLOqWwwv5d1tX0//BcHq5BKgm8m/LAwNeDHanIddZ/ emBw== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@mailo.com header.s=mailo header.b=UskBkQ2J; 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=NONE dis=NONE) header.from=mailo.com Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id m12-20020a056402430c00b00420cae23b6bsi10730758edc.26.2022.04.23.13.57.39; Sat, 23 Apr 2022 13:57:40 -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=@mailo.com header.s=mailo header.b=UskBkQ2J; 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=NONE dis=NONE) header.from=mailo.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id E046D68B3D7; Sat, 23 Apr 2022 23:57:23 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from msg-4.mailo.com (ip-15.mailobj.net [213.182.54.15]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 9E29768B419 for ; Sat, 23 Apr 2022 23:57:22 +0300 (EEST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=mailo.com; s=mailo; t=1650747442; bh=AKQP9lXixrV7Ed2zj+8FIsVv088E1o8Nq67Ocw4eWPI=; h=X-EA-Auth:From:To:Subject:Date:Message-Id:X-Mailer:In-Reply-To: References:MIME-Version:Content-Transfer-Encoding; b=UskBkQ2JaT1UoktyGGSYq8atGf/emdoJYsKjCSi67qWdnj+nIZ9DytJQwPaMhlzOW hOz46KXEixvXEwI/swyj7bbMQKo6RJ5AJfMFRY0tQLgbXA/G+CG94OZI5vlyK/kMJp 9GRMaWdeds5RivPig0gIK+dIDXDdoeddJSvtPzrA= Received: by b-3.in.mailobj.net [192.168.90.13] with ESMTP via ip-206.mailobj.net [213.182.55.206] Sat, 23 Apr 2022 22:57:22 +0200 (CEST) X-EA-Auth: jSMqWZHCFpn2nc3JEcfQWbQUE7Cr+ayUduV10Nbu9jtsJOCOvc40DGAdXjafzPVfbuNpr7AuulLM6UkxZW8uqcQAtE3P5PnCUCFo1fvUpnA= From: Nil Admirari To: ffmpeg-devel@ffmpeg.org Date: Sat, 23 Apr 2022 23:57:14 +0300 Message-Id: <20220423205714.39112-1-nil-admirari@mailo.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20220423205626.39039-1-nil-admirari@mailo.com> References: <20220423205626.39039-1-nil-admirari@mailo.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH v11 6/6] fftools: Set active code page to UTF-8 on Windows 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: aVDYpKScgGdO Starting with Windows 1903, applications can set active code page to UTF-8 in the application manifest. It improves path name compatibility with dependencies that use char* pathnames internally, but whose code page has already been changed to UTF-8 with a manifest (e.g. AviSynth). On older versions of Windows, changes in the manifest have no effect. --- fftools/fftools.manifest | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/fftools/fftools.manifest b/fftools/fftools.manifest index 30b7d8fe..d1ac1e4e 100644 --- a/fftools/fftools.manifest +++ b/fftools/fftools.manifest @@ -3,8 +3,10 @@ - + true + UTF-8