[vlc-devel] [PATCH] Fix compatibility with dav1d < 5.0x for vlc-3.x

Remi Denis-Courmont remi at remlab.net
Fri Mar 6 16:56:38 CET 2020


Le 2020-03-06 17:42, Nicolas Chauvet a écrit :
> Le ven. 6 mars 2020 à 15:32, Remi Denis-Courmont <remi at remlab.net> a 
> écrit :
>> 
>> Le 2020-03-06 13:06, Nicolas Chauvet a écrit :
>> > This patch is required to allow vlc-3.x to build with dav1d.
>> >
>> > Signed-off-by: Nicolas Chauvet <kwizart at gmail.com>
>> > ---
>> >  modules/codec/dav1d.c | 9 +++++++++
>> >  1 file changed, 9 insertions(+)
>> >
>> > diff --git a/modules/codec/dav1d.c b/modules/codec/dav1d.c
>> > index b692d2ad45..7bb8f38d75 100644
>> > --- a/modules/codec/dav1d.c
>> > +++ b/modules/codec/dav1d.c
>> > @@ -37,6 +37,15 @@
>> >  #include <errno.h>
>> >  #include <dav1d/dav1d.h>
>> >
>> > +// Compatibility with dav1d releases < 5.0x
>> > +#if ! defined DAV1D_ERR
>> > +#if EPERM > 0
>> 
>> Tautology.
> Indeed,
> 
> This is how is defined DAV1D_ERR in dav1d.c. Actually I don't know
> which non-posix case matters here.

It would be distinctly weird to define EPERM as negative while ISO C 
requires the standard error codes do be positive. But for the sake of 
the argument, lets say that that would be the case and EPERM is 
negative.

In that caes, -EPERM is positive, and may alias another error code, 
notably standard ones. So this code snippet is wrong.

It's what I call premature portability: a portability abstraction layer 
that essentially depends on artifacts of one specific implementation, 
and thus is not actually portable.

-- 
Rémi Denis-Courmont


More information about the vlc-devel mailing list