[MPlayer-dev-eng] [PATCH] configurable BINDIR and MANDIR; silencing compiler warnings, continued

Dominik Mierzejewski dominik at rangers.eu.org
Sun Sep 1 16:25:17 CEST 2002


On Sunday, 01 September 2002, Arpi wrote:
> Hi,
> 
> > is a fix of dvdcss_open definitions (makes them consistent everywhere).
> 
> could you explain tehse changes in detail? i can't see the reason why do
> they needed.

Apart from gcc complaining? It's good to be consistent throughout the sources,
isn't it?
 
> > --- MPlayer-20020829/libmpdvdkit2/libdvdcss.c.warn	Sat Aug 17 00:50:22 2002
> > +++ MPlayer-20020829/libmpdvdkit2/libdvdcss.c	Sun Sep  1 01:26:03 2002
> > @@ -133,7 +133,7 @@
> >   * dvdcss_open() returns a handle to be used for all subsequent \e libdvdcss
> >   * calls. If an error occured, NULL is returned.
> >   */
> > -extern dvdcss_t dvdcss_open ( char *psz_target )
> > +extern dvdcss_t dvdcss_open ( const char *psz_target )
> >  {
> >      int i_ret;
> >  
> > --- MPlayer-20020829/libmpdvdkit2/dvdcss.h.warn	Sat Aug 17 00:50:21 2002
> > +++ MPlayer-20020829/libmpdvdkit2/dvdcss.h	Sun Sep  1 01:26:03 2002
> > @@ -69,7 +69,7 @@
> >  /*
> >   * Exported prototypes.
> >   */
> > -extern dvdcss_t dvdcss_open  ( char *psz_target );
> > +extern dvdcss_t dvdcss_open  ( const char *psz_target );
> >  extern int      dvdcss_close ( dvdcss_t );
> >  extern int      dvdcss_title ( dvdcss_t,
> >                                 int i_block );
> 
> 
> ^^ added 'const'. why? afaik it only helps optimization by limiting var to
> readonly.

That, too. It's also a good practice to set parameter you don't need to modify
inside a function to const, isn't it?

> > --- MPlayer-20020829/libmpdvdkit2/dvd_input.c.warn	Sat Aug 17 00:50:21 2002
> > +++ MPlayer-20020829/libmpdvdkit2/dvd_input.c	Sun Sep  1 01:26:03 2002
> > @@ -27,7 +27,7 @@
> >  
> >  #include "dvdcss.h"
> >  
> > -dvdcss_handle (*DVDcss_open)  (const char *);
> > +dvdcss_t      (*DVDcss_open)  (const char *);
> >  int           (*DVDcss_close) (dvdcss_handle);
> >  int           (*DVDcss_seek)  (dvdcss_handle, int, int);
> >  int           (*DVDcss_title) (dvdcss_handle, int); 
> 
>   dev->dvdcss = DVDcss_open(target);
> 
> and dev->dvdcss is dvdcss_handle

I believe this will explain:
libmpdvdkit2/dvdcss.h:
[...]
/*
 * Deprecated stuff.
 */
#ifndef _DOXYGEN_SKIP_ME
#define dvdcss_title(a,b) dvdcss_seek(a,b,DVDCSS_SEEK_KEY)
#define dvdcss_handle dvdcss_t
#endif

Only dvd_input.c uses dvdcss_handle. All other files use dvdcss_t,
so it would appear we can replace all dvdcss_handle with dvdcss_t,
can't we?

> others are ok, i'll apply

:-)
 
-- 
MPlayer RPMs maintainer: http://www.piorunek.pl/~dominik/linux/pkgs/mplayer/
"The Universe doesn't give you any points for doing things that are easy."
        -- Sheridan to Garibaldi in Babylon 5:"The Geometry of Shadows"



More information about the MPlayer-dev-eng mailing list