[FFmpeg-devel] [PATCH v6 2/2] avformat/os_support: Support long file names on Windows

Martin Storsjö martin at martin.st
Wed May 25 10:09:18 EEST 2022


On Tue, 24 May 2022, Soft Works wrote:

>> -----Original Message-----
>> From: Martin Storsjö <martin at martin.st>
>> Sent: Tuesday, May 24, 2022 10:59 PM
>> To: softworkz <ffmpegagent at gmail.com>
>> Cc: ffmpeg-devel at ffmpeg.org; Soft Works <softworkz at hotmail.com>; Hendrik
>> Leppkes <h.leppkes at gmail.com>
>> Subject: Re: [PATCH v6 2/2] avformat/os_support: Support long file names
>> on Windows
>>
>>> +    wchar_t *filename_w;
>>> +    int ret;
>>> +    struct _stati64 winstat = { 0 };
>>> +
>>> +    if (get_extended_win32_path(filename_utf8, &filename_w))
>>> +        return -1;
>>> +
>>> +    if (filename_w) {
>>> +        ret = _wstat64(filename_w, &winstat);
>>> +        av_free(filename_w);
>>> +    } else
>>> +        ret = _stat64(filename_utf8, &winstat);
>>> +
>>> +    par->st_dev   = winstat.st_dev;
>>> +    par->st_ino   = winstat.st_ino;
>>> +    par->st_mode  = winstat.st_mode;
>>> +    par->st_nlink = winstat.st_nlink;
>>> +    par->st_uid   = winstat.st_uid;
>>> +    par->st_gid   = winstat.st_gid;
>>> +    par->st_rdev  = winstat.st_rdev;
>>> +    par->st_size  = winstat.st_size;
>>> +    par->st_atime = winstat.st_atime;
>>> +    par->st_mtime = winstat.st_mtime;
>>> +    par->st_ctime = winstat.st_ctime;
>>
>> Thanks, this approach seems robust and safe to me!
>>
>> With this change in place, shouldn't we drop the #ifdef for
>> stat/win32_stat in file.c at the same time?
>
> Done. While doing that, I realized that fstat needs
> to be remapped as well, otherwise _ftati64 would be
> called with the win32_stat structure. Done that
> as well.

Good - I also just realized the same while grepping around for "struct 
stat".

// Martin


More information about the ffmpeg-devel mailing list