[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 01:24:16 EEST 2022


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). */
#include "libavutil/getenv_utf8.h"

(I had to do the same fixup in http.c and ipfsgateway.c.)

If that seems fine to you and others, I can push this patchset maybe 
tomorrow.

// Martin



More information about the ffmpeg-devel mailing list