[vlc-devel] [PATCH] modules: cache: use the same type for reading and writing

Steve Lhomme robux4 at gmail.com
Tue Oct 11 18:32:47 CEST 2016


On Tue, Oct 11, 2016 at 3:23 PM, Rémi Denis-Courmont <remi at remlab.net> wrote:
> Le mardi 11 octobre 2016, 12:12:29 Steve Lhomme a écrit :
>> sizeof() is used to know the size to read and write. On Windows the stat
>> struct is not using the same types that are used for writing.
>
> They are the same. module_cache_t specifically defines them to the same
> underlying type as struct stat.

static_assert( sizeof( st.st_size ) == sizeof( cache->size ), "off_t
mismatch" );
fails for me with the Windows Kit SDK.

The Windows SDK doesn't define "stat" so we force "struct stat" to
"struct _stati64". That allows us to use _wstati64() in vlc_stat().

The problem is that _stati64 is _stat64 which uses an __in64 for
st_size, not an _off_t. And an _off_t is a long. This is the same
under mingw.

Maybe it would be simpler/safer if module_cache_t used a struct stat
with only a few fields used.

> Besides, module cache wouldn't have worked if it weren't true.

That's because it doesn't work (UWP builds) that I'm fixing it.

> --
> Rémi Denis-Courmont
> http://www.remlab.net/
>
> _______________________________________________
> vlc-devel mailing list
> To unsubscribe or modify your subscription options:
> https://mailman.videolan.org/listinfo/vlc-devel


More information about the vlc-devel mailing list