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

Dominik Mierzejewski dominik at rangers.eu.org
Sun Sep 1 11:56:31 CEST 2002


First, a patch to make bindir and mandir configurable.

Second, I managed to silence most compiler warnings for now (patch
attached). Note that this reverses my last patch to
libmpcodecs/vd_ffmpeg.c, because it was wrong. This patch changes the
definition of draw_slice to be consistent in all places and makes
appropriate changes wherever it's used. Small fix to
postprocess_template.c silences the "SCALED_CPY redefined" warning. Next
is a fix of dvdcss_open definitions (makes them consistent everywhere).
And lastly, a small fix to mencoder.c silencing "type mismatch in
conditional expression" warning.

Some other warnings, however, are a mystery to me, so if anyone could
shed some light on these, I'd be grateful.

I don't know how to fix this one:
interface.c:395: warning: implicit declaration of function `get_video_colors'
because it involves several levels of headers

Now this one:
mplayer.c:1261: warning: assignment makes pointer from integer without a cast
mplayer.c:1262: warning: assignment makes pointer from integer without a cast
is very interesting, because the same code
mplayer.c:
[...]
sh_video->vfilter=vf_open_filter(NULL,"vo",video_out);
sh_video->vfilter=append_filters(sh_video->vfilter);
[...]
compiles without warning in all other places

The following one
open.c:494: warning: assignment discards qualifiers from pointer target type
libmpdemux/open.c:
[...]
int dvd_parse_chapter_range(struct config *conf, const char *range){
  char *s, *t;
  conf; /* prevent warning from GCC */
  s = range;
  dvd_chapter = 1;
[...]
I think should be fixed by making a copy of range instead of assigning
the pointer.

This one:
vo_xv.c:484: warning: assignment makes pointer from integer without a cast
is curious, too, because:
libvo/vo_xv.c:
[...]
static XvImage* xvimage[NUM_BUFFERS];
[...]
   xvimage[foo] = XvShmCreateImage(mDisplay, xv_port, xv_format, 0, image_width, image_height, &Shmi
[...]
XvShmCreateImage does return (XvImage*). I checked it three times.

And lastly:

loader/win32.c:
[...]
void* LookupExternal(const char* library, int ordinal)
{
[...]
    /* ok, this is a hack, and a big memory leak. should be fixed. - alex */
    {
        HMODULE hand;
        WINE_MODREF *wm;
        void *func;

        hand = LoadLibraryA(library);
        if (!hand)
            goto no_dll;
        wm = MODULE32_LookupHMODULE(hand);
        if (!wm)
        {
            FreeLibrary(hand);
            goto no_dll;
        }
-->     func = PE_FindExportedFunction(wm, ordinal, 0);
        if (!func)
        {
            printf("No such ordinal in external dll\n");
            FreeLibrary(hand);
            goto no_dll;
        }

        printf("External dll loaded (offset: %p, func: %p)\n",
            hand, func);
        return func;
    }
[...]

This generates 
win32.c:4217: warning: passing arg 2 of `PE_FindExportedFunction' makes pointer from integer without a cast
... and rightly so, because the prototype for this function requires LPCSTR
as the second parameter:
loader/wine/pe_image.h:
extern FARPROC PE_FindExportedFunction(struct _wine_modref *wm, LPCSTR funcName, WIN_BOOL snoop);

-- 
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"
-------------- next part --------------
--- MPlayer-20020829/configure.dir	Thu Aug 29 23:19:37 2002
+++ MPlayer-20020829/configure	Fri Aug 30 00:02:44 2002
@@ -117,8 +117,12 @@
 
 Installation directories:
   --prefix=DIR           use this prefix for installing mplayer [/usr/local]
+  --bindir=DIR           use this prefix for installing mplayer binary
+                         [PREFIX/bin]
   --datadir=DIR          use this prefix for installing machine independent
                          data files (fonts, skins) [PREFIX/share/mplayer]
+  --mandir=DIR           use this prefix for installing manpages
+                         [PREFIX/share/man]
   --confdir=DIR          use this prefix for installing configuration files
                          [same as datadir]
   --libdir=DIR           use this prefix for object code libraries
@@ -1250,9 +1254,15 @@
   --prefix=*)
     _prefix=`echo $ac_option | cut -d '=' -f 2`
     ;;
+  --bindir=*)
+    _bindir=`echo $ac_option | cut -d '=' -f 2`
+    ;;
   --datadir=*)
     _datadir=`echo $ac_option | cut -d '=' -f 2`
     ;;
+  --mandir=*)
+    _mandir=`echo $ac_option | cut -d '=' -f 2`
+    ;;
   --confdir=*)
     _confdir=`echo $ac_option | cut -d '=' -f 2`
     ;;
@@ -1269,7 +1279,9 @@
 done
 
 # Atmos: moved this here, to be correct, if --prefix is specified
+test -z "$_bindir" && _bindir="$_prefix/bin"
 test -z "$_datadir" && _datadir="$_prefix/share/mplayer"
+test -z "$_mandir" && _mandir="$_prefix/share/man"
 test -z "$_confdir" && _confdir="$_prefix/etc/mplayer"
 test -z "$_libdir" && _libdir="$_prefix/lib"
 test -z "$_mlibdir" && _mlibdir="$MLIBHOME"
@@ -4239,7 +4251,9 @@
 TARGET_OS = $system_name
 DESTDIR =
 prefix = \$(DESTDIR)$_prefix
+BINDIR = \$(DESTDIR)$_bindir
 DATADIR = \$(DESTDIR)$_datadir
+MANDIR = \$(DESTDIR)$_mandir
 CONFDIR = \$(DESTDIR)$_confdir
 LIBDIR = \$(DESTDIR)$_libdir
 #AR = ar
--- MPlayer-20020829/Makefile.dir	Thu Aug 29 23:26:29 2002
+++ MPlayer-20020829/Makefile	Fri Aug 30 00:03:17 2002
@@ -23,11 +23,6 @@
 DO_MAKE = @ for i in $(SUBDIRS); do $(MAKE) -C $$i $@; done
 endif
 
-#prefix = /usr/local
-BINDIR = ${prefix}/bin
-# BINDIR = /usr/local/bin
-MANDIR = ${prefix}/man
-
 # a BSD compatible 'install' program
 INSTALL = install
 
-------------- next part --------------
--- MPlayer-20020829/libmpcodecs/vf_vo.c.warn	Thu Aug 29 01:34:28 2002
+++ MPlayer-20020829/libmpcodecs/vf_vo.c	Sun Sep  1 01:26:03 2002
@@ -103,7 +103,7 @@
 }
 
 static void draw_slice(struct vf_instance_s* vf,
-        unsigned char* src, int* stride, int w,int h, int x, int y){
+        unsigned char** src, int* stride, int w,int h, int x, int y){
     if(!vo_config_count) return; // vo not configured?
     video_out->draw_slice(src,stride,w,h,x,y);
 }
--- MPlayer-20020829/libmpcodecs/vf.h.warn	Sun Aug  4 13:00:54 2002
+++ MPlayer-20020829/libmpcodecs/vf.h	Sun Sep  1 01:26:03 2002
@@ -32,7 +32,7 @@
     void (*put_image)(struct vf_instance_s* vf,
         mp_image_t *mpi);
     void (*draw_slice)(struct vf_instance_s* vf,
-        unsigned char* src, int* stride, int w,int h, int x, int y);
+        unsigned char** src, int* stride, int w,int h, int x, int y);
     void (*uninit)(struct vf_instance_s* vf);
     // caps:
     unsigned int default_caps; // used by default query_format()
--- MPlayer-20020829/libmpcodecs/vd.c.warn	Thu Aug 29 01:34:28 2002
+++ MPlayer-20020829/libmpcodecs/vd.c	Sun Sep  1 01:26:03 2002
@@ -277,7 +277,7 @@
   return mpi;
 }
 
-void mpcodecs_draw_slice(sh_video_t *sh, unsigned char* src, int* stride, int w,int h, int x, int y) {
+void mpcodecs_draw_slice(sh_video_t *sh, unsigned char** src, int* stride, int w,int h, int x, int y) {
   struct vf_instance_s* vf = sh->vfilter;
 
   if(vf->draw_slice)
--- MPlayer-20020829/libmpcodecs/vd.h.warn	Thu Jul 25 22:59:17 2002
+++ MPlayer-20020829/libmpcodecs/vd.h	Sun Sep  1 01:26:03 2002
@@ -26,6 +26,6 @@
 // callbacks:
 int mpcodecs_config_vo(sh_video_t *sh, int w, int h, unsigned int preferred_outfmt);
 mp_image_t* mpcodecs_get_image(sh_video_t *sh, int mp_imgtype, int mp_imgflag, int w, int h);
-void mpcodecs_draw_slice(sh_video_t *sh, unsigned char* src, int* stride, int w,int h, int x, int y);
+void mpcodecs_draw_slice(sh_video_t *sh, unsigned char** src, int* stride, int w,int h, int x, int y);
 
 #define VDFLAGS_DROPFRAME 3
--- MPlayer-20020829/libmpcodecs/vd_ffmpeg.c.warn	Thu Aug 29 01:34:28 2002
+++ MPlayer-20020829/libmpcodecs/vd_ffmpeg.c	Sun Sep  1 01:36:07 2002
@@ -258,7 +258,7 @@
         }
     }else
 #endif
-        mpcodecs_draw_slice (sh,(unsigned char*)src, stride, width, height, 0, y);
+        mpcodecs_draw_slice (sh,src, stride, width, height, 0, y);
 }
 
 static int init_vo(sh_video_t *sh){
--- MPlayer-20020829/postproc/postprocess_template.c.warn	Sat Aug 10 18:57:12 2002
+++ MPlayer-20020829/postproc/postprocess_template.c	Sun Sep  1 01:26:03 2002
@@ -2449,6 +2449,8 @@
  * Copies a block from src to dst and fixes the blacklevel
  * levelFix == 0 -> dont touch the brighness & contrast
  */
+#undef SCALED_CPY
+
 static inline void RENAME(blockCopy)(uint8_t dst[], int dstStride, uint8_t src[], int srcStride,
 	int levelFix)
 {
--- 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 );
--- 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); 
--- MPlayer-20020829/cfgparser.h.warn	Thu Aug 29 01:34:27 2002
+++ MPlayer-20020829/cfgparser.h	Sun Sep  1 01:26:03 2002
@@ -74,7 +74,7 @@
     int as_int;
     float as_float;
     void* as_pointer;
-    off_t* as_off_t;
+    off_t as_off_t;
   } param;
   char* opt_name;
 };
--- MPlayer-20020829/mencoder.c.warn	Thu Aug 29 23:19:38 2002
+++ MPlayer-20020829/mencoder.c	Sun Sep  1 01:26:03 2002
@@ -528,7 +528,7 @@
     unsigned char tmp[3] = { 0, 0, 0 };
     if (spudec_ifo && vobsub_parse_ifo(NULL,spudec_ifo, palette, &width, &height, 1, dvdsub_id, tmp) >= 0)
 	vobsub_writer = vobsub_out_open(vobsub_out, palette, sh_video->disp_w, sh_video->disp_h,
-					vobsub_out_id?vobsub_out_id:tmp, vobsub_out_index);
+					vobsub_out_id?vobsub_out_id:(char *)tmp, vobsub_out_index);
 #ifdef USE_DVDREAD
     if (vobsub_writer == NULL) {
 	char tmp[3];


More information about the MPlayer-dev-eng mailing list