[MPlayer-dev-eng] [PATCH] silencing compiler warnings (again)

Dominik Mierzejewski dominik at rangers.eu.org
Mon Oct 21 21:12:21 CEST 2002


Hello.
Just three this time. Yay! I see we're near the day where there will be no
warnings at all. :-)

audio_out.c:103: warning: initialization makes pointer from integer without a cast

This one was very funny, because the initialization is written correctly:
        char* ao=strdup(ao_list[0]);
It turns out that <string.h> wasn't included, but I'm still at a loss
figuring out why the hell gcc didn't complain about "implicit declaration
of strdup". Anyway, adding that should fix it. :-)

vf_1bpp.c:151: warning: return makes integer from pointer without a cast

Ah, an obvious one this time. Function should return int:
static int put_image(struct vf_instance_s* vf, mp_image_t *mpi){
but instead A'rpi wrote:
    default:
        mp_msg(MSGT_VFILTER,MSGL_ERR,"Unhandled format: 0x%X\n",dmpi->imgfmt);
        return NULL;
    }
Hm. 10l to A'rpi again? :-)

vo_xv.c:475: warning: assignment makes pointer from integer without a cast

Now this one is still a mystery. I worked around it using explicit type
cast, but I'm not sure this is the right solution. The thing is, according
to function definition from <X11/extensions/Xvlib.h> header, the return
type of XvShmCreateImage *is* (XvImage *), which is exactly the same type
as the variable it's assigned to:

[...]
static XvImage* xvimage[NUM_BUFFERS];
[...]
xvimage[foo] = XvShmCreateImage(...)

Apply this at your own discretion.

Regards,
Dominik

-- 
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-20021021/libao2/audio_out.c.warn	Wed Oct  9 21:40:13 2002
+++ MPlayer-20021021/libao2/audio_out.c	Mon Oct 21 20:15:18 2002
@@ -1,5 +1,6 @@
 #include <stdio.h>
 #include <stdlib.h>
+#include <string.h>
 
 #include "../config.h"
 #include "audio_out.h"
--- MPlayer-20021021/libmpcodecs/vf_1bpp.c.warn	Wed Oct 16 20:40:03 2002
+++ MPlayer-20021021/libmpcodecs/vf_1bpp.c	Mon Oct 21 20:15:18 2002
@@ -148,7 +148,7 @@
 	break;
     default:
 	mp_msg(MSGT_VFILTER,MSGL_ERR,"Unhandled format: 0x%X\n",dmpi->imgfmt);
-	return NULL;
+	return 0;
     }
 
     return vf_next_put_image(vf,dmpi);
--- MPlayer-20021021/libvo/vo_xv.c.warn	Sun Oct 20 16:32:03 2002
+++ MPlayer-20021021/libvo/vo_xv.c	Mon Oct 21 20:15:18 2002
@@ -466,7 +466,7 @@
   }
  if ( Shmem_Flag ) 
   {
-   xvimage[foo] = XvShmCreateImage(mDisplay, xv_port, xv_format, 0, image_width, image_height, &Shminfo[foo]);
+   xvimage[foo] = (XvImage *) XvShmCreateImage(mDisplay, xv_port, xv_format, NULL, image_width, image_height, &Shminfo[foo]);
 
    Shminfo[foo].shmid    = shmget(IPC_PRIVATE, xvimage[foo]->data_size, IPC_CREAT | 0777);
    Shminfo[foo].shmaddr  = (char *) shmat(Shminfo[foo].shmid, 0, 0);
@@ -480,7 +480,7 @@
  else
 #endif
   {
-    xvimage[foo] = XvCreateImage(mDisplay, xv_port, xv_format, 0, image_width, image_height);
+    xvimage[foo] = (XvImage *) XvCreateImage(mDisplay, xv_port, xv_format, NULL, image_width, image_height);
     xvimage[foo]->data = malloc(xvimage[foo]->data_size);
     XSync(mDisplay,False);
   }


More information about the MPlayer-dev-eng mailing list