[FFmpeg-devel] [PATCH] lavf/os_support.h: Fix for unicode filenames on windows.
protogonoi at gmail.com
Tue Jun 7 01:43:39 CEST 2016
On 6 June 2016 at 19:55, Hendrik Leppkes <h.leppkes at gmail.com> wrote:
> On Mon, Jun 6, 2016 at 11:34 AM, Matt Oliver <protogonoi at gmail.com> wrote:
> > On 6 June 2016 at 19:27, Hendrik Leppkes <h.leppkes at gmail.com> wrote:
> >> On Mon, Jun 6, 2016 at 9:12 AM, Matt Oliver <protogonoi at gmail.com>
> >> > Fixes #819 #5256 #5281
> >> > ---
> >> > libavformat/file.c | 4 ++++
> >> > libavformat/os_support.h | 24 ++++++++++++++++++++++++
> >> > 2 files changed, 28 insertions(+)
> >> >
> >> > diff --git a/libavformat/file.c b/libavformat/file.c
> >> > index 5765ce7..264542a 100644
> >> > --- a/libavformat/file.c
> >> > +++ b/libavformat/file.c
> >> > @@ -148,7 +148,11 @@ static int file_check(URLContext *h, int mask)
> >> > ret |= AVIO_FLAG_WRITE;
> >> > #else
> >> > struct stat st;
> >> > +# ifndef _WIN32
> >> > ret = stat(filename, &st);
> >> > +# else
> >> > + ret = win32_stat(filename, &st);
> >> > +# endif
> >> Isn't the typical way to define stat to win32_stat in the os_support
> >> header, instead of ifdefing here?
> > No as there is a stat struct type as well as the stat function so a
> > cannot be used for the function as it will mess with the stat struct.
> > why the only way to get around it was to manually call the appropriate
> > win32 function.
> #define stat(a,b) win32_stat(a,b) ?
> Wouldn't that avoid a clash with the struct?
Unfortunately not as the struct is also a preprocessor define set to a
different value and C doesnt allow an object type and function type to have
the same name (so its one or the other but not both).
More information about the ffmpeg-devel