[vlc-devel] [PATCH] lib: media: fix header include from MSVC

Thomas Guillem thomas at gllm.fr
Thu Oct 22 12:29:36 CEST 2020



On Thu, Oct 22, 2020, at 09:17, Thomas Guillem wrote:
> I don't understand RĂ©mi's comment about namespace violation.
> 
> Could you elaborate?


OK, "Exposing identifiers that you're not supposed to own is a namespace violation, potentially leading to potential name conflicts inside the final executable that includes it."

What do you think of 

typedef long (*libvlc_media_read_cb)(void *opaque, unsigned char *buf, unsigned long len);

?

> 
> @Steve: Indeed, it should be in libvlc.h.
> 
> On Thu, Oct 22, 2020, at 09:02, Thomas Guillem wrote:
> > Rejected 3 years ago: https://patches.videolan.org/patch/18340/
> > 
> > On Thu, Oct 22, 2020, at 08:58, Steve Lhomme wrote:
> > > On 2020-10-22 8:47, Thomas Guillem wrote:
> > > > ---
> > > >   include/vlc/libvlc_media.h | 6 ++++++
> > > >   1 file changed, 6 insertions(+)
> > > > 
> > > > diff --git a/include/vlc/libvlc_media.h b/include/vlc/libvlc_media.h
> > > > index 904e2655612..0bd3aace07e 100644
> > > > --- a/include/vlc/libvlc_media.h
> > > > +++ b/include/vlc/libvlc_media.h
> > > > @@ -33,6 +33,12 @@ extern "C" {
> > > >   #  include <stdbool.h>
> > > >   # endif
> > > >   
> > > > +/* ssize_t, a signed version of size_t, is Posix only and not present in MSVC */
> > > > +#if defined(_MSC_VER)
> > > > +#include <BaseTsd.h>
> > > > +typedef SSIZE_T ssize_t;
> > > 
> > > IMO we shouldn't use POSIX C defines in libvlc headers. It doesn't 
> > > include our fixup (nor should it)
> > > 
> > > If we go the ifdef way, there are some compiler-specific defines in 
> > > libvlc.h so this should probably go there.
> > > 
> > > > +#endif
> > > > +
> > > >   /** \defgroup libvlc_media LibVLC media
> > > >    * \ingroup libvlc
> > > >    * @ref libvlc_media_t is an abstract representation of a playable media.
> > > > -- 
> > > > 2.28.0
> > > > 
> > > > _______________________________________________
> > > > vlc-devel mailing list
> > > > To unsubscribe or modify your subscription options:
> > > > https://mailman.videolan.org/listinfo/vlc-devel
> > > > 
> > > _______________________________________________
> > > vlc-devel mailing list
> > > To unsubscribe or modify your subscription options:
> > > https://mailman.videolan.org/listinfo/vlc-devel
> > _______________________________________________
> > vlc-devel mailing list
> > To unsubscribe or modify your subscription options:
> > https://mailman.videolan.org/listinfo/vlc-devel
> _______________________________________________
> 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