[FFmpeg-devel] [PATCH v17 4/5] libavformat: Remove MAX_PATH limit and use UTF-8 version of getenv()

Martin Storsjö martin at martin.st
Sun Jun 19 10:49:11 EEST 2022


On Sat, 18 Jun 2022, Soft Works wrote:

>
>
>> -----Original Message-----
>> From: ffmpeg-devel <ffmpeg-devel-bounces at ffmpeg.org> On Behalf Of
>> Martin Storsjö
>> Sent: Sunday, June 19, 2022 12:24 AM
>> To: FFmpeg development discussions and patches <ffmpeg-
>> devel at ffmpeg.org>
>> Subject: Re: [FFmpeg-devel] [PATCH v17 4/5] libavformat: Remove
>> MAX_PATH limit and use UTF-8 version of getenv()
>>
>> On Fri, 17 Jun 2022, Nil Admirari wrote:
>>
>>> 1. getenv() is replaced with getenv_utf8() across libavformat.
>>> 2. New versions of AviSynth+ are now called with UTF-8 filenames.
>>> 3. Old versions of AviSynth are still using ANSI strings,
>>>   but MAX_PATH limit on filename is removed.
>>> ---
>>> libavformat/avisynth.c    | 39 +++++++++++++++++++++++++++---------
>> ---
>>> libavformat/http.c        | 20 +++++++++++++-------
>>> libavformat/ipfsgateway.c | 35 +++++++++++++++++++++++------------
>>> libavformat/tls.c         | 11 +++++++++--
>>> 4 files changed, 72 insertions(+), 33 deletions(-)
>>>
>>> diff --git a/libavformat/http.c b/libavformat/http.c
>>> index c8f3f4b6a3..d90117e422 100644
>>> --- a/libavformat/http.c
>>> +++ b/libavformat/http.c
>>> @@ -29,6 +29,7 @@
>>> #include "libavutil/avassert.h"
>>> #include "libavutil/avstring.h"
>>> #include "libavutil/bprint.h"
>>> +#include "libavutil/getenv_utf8.h"
>>> #include "libavutil/opt.h"
>>> #include "libavutil/time.h"
>>> #include "libavutil/parseutils.h"
>>
>> This actually causes some surprise breakage in MSVC builds. Here,
>> getenv_utf8.h includes windows.h. If including windows.h and winsock2
>> headers in the same file, the winsock2 headers must be included
>> before.
>>
>> I fixed it locally by moving this new include down, with a comment
>> like
>> this:
>>
>> /* This header can include <windows.h>. That header has to be
>> included after
>>   * winsock2 headers (included by network.h and os_support.h above).
>> */
>
> This is the recommended way:
>
>
> #define WIN32_LEAN_AND_MEAN
>
> #include <windows.h>
> #include <winsock2.h>

Thanks, adding #define WIN32_LEAN_AND_MEAN in wchar_filename.h fixes the 
issue.

// Martin


More information about the ffmpeg-devel mailing list