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

Steve Lhomme robux4 at gmail.com
Wed Oct 12 08:37:03 CEST 2016

On Tue, Oct 11, 2016 at 11:12 PM, Rémi Denis-Courmont <remi at remlab.net> wrote:
> Le mardi 11 octobre 2016, 18:32:47 Steve Lhomme a écrit :
>> 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.
> VLC has required 64-bits file offsets since before I even started using it.
> lseek() is the most obvious concern here. Sorry but deal with it.

I'm not discussing which type is better than the other, just that the
types have to be the same when reading and writing.
I sent a patch that ensures that during compilation.

> The (de)merits of using operating system types rather than fixed size types for
> (de)serialization could be discussed. But in that respect, your patch seems to
> make things worse rather than better.

I'll investigate why the static_assert is OK when compiling with
mingw. Maybe off_t is pushed to 64 bits one way or another.

> --
> 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