From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTP id A609F403CA for ; Wed, 20 Apr 2022 11:33:04 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id EA4F968B3C1; Wed, 20 Apr 2022 14:33:02 +0300 (EEST) Received: from mail8.parnet.fi (mail8.parnet.fi [77.234.108.134]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 80EE468B3A8 for ; Wed, 20 Apr 2022 14:32:56 +0300 (EEST) Received: from mail9.parnet.fi (mail9.parnet.fi [77.234.108.21]) by mail8.parnet.fi with ESMTP id 23KBWtJs026869-23KBWtJt026869 for ; Wed, 20 Apr 2022 14:32:55 +0300 Received: from foo.martin.st (host-97-187.parnet.fi [77.234.97.187]) by mail9.parnet.fi (Postfix) with ESMTPS id E844CA1518 for ; Wed, 20 Apr 2022 14:32:55 +0300 (EEST) Date: Wed, 20 Apr 2022 14:32:55 +0300 (EEST) From: =?ISO-8859-15?Q?Martin_Storsj=F6?= To: FFmpeg development discussions and patches In-Reply-To: <20220415080748.18517-2-nil-admirari@mailo.com> Message-ID: <8cbf5ac-4ae3-b7d7-d2b8-d3a4fe813df@martin.st> References: <20220415080748.18517-1-nil-admirari@mailo.com> <20220415080748.18517-2-nil-admirari@mailo.com> MIME-Version: 1.0 X-FE-Policy-ID: 3:14:2:SYSTEM Subject: Re: [FFmpeg-devel] [PATCH v9 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 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: On Fri, 15 Apr 2022, Nil Admirari wrote: > --- > 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 This looks ok to me, but as mentioned in the other patch, I think CP_ACP actually would be more correct than the current CP_THREAD_ACP (https://github.com/ocaml/ocaml/issues/7854), so it could be worthwhile to change that at the same time (either just as part of this refactoring, or as a totally separate patch for clarity). // Martin _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".