GNOME Bugzilla – Bug 439914
[directdraw] Warnings when using MinGW
Last modified: 2007-05-24 08:46:32 UTC
I have those warnings when I try to compile directdrawsink with MinGW (and my core2 duo: gstdirectdrawsink.c: In function `gst_ddrawsurface_class_init': gstdirectdrawsink.c:225: warning: assignment from incompatible pointer type gstdirectdrawsink.c: In function `gst_ddrawsurface_finalize': gstdirectdrawsink.c:291: warning: passing arg 7 of `gst_debug_log' from incompatible pointer type gstdirectdrawsink.c: In function `gst_directdraw_sink_buffer_alloc': gstdirectdrawsink.c:597: warning: passing arg 2 of pointer to function from incompatible pointer type gstdirectdrawsink.c:599: warning: int format, long int arg (arg 8) gstdirectdrawsink.c:604: warning: implicit declaration of function `gst_directdraw_sink_get_depth' gstdirectdrawsink.c: In function `gst_directdraw_sink_show_frame': gstdirectdrawsink.c:753: warning: passing arg 3 of pointer to function from incompatible pointer type gstdirectdrawsink.c: In function `gst_directdraw_sink_check_primary_surface': gstdirectdrawsink.c:1323: warning: passing arg 2 of pointer to function from incompatible pointer type gstdirectdrawsink.c: In function `gst_directdraw_sink_check_offscreen_surface': gstdirectdrawsink.c:1383: warning: passing arg 2 of pointer to function from incompatible pointer type gstdirectdrawsink.c: At top level: gstdirectdrawsink.c:1399: warning: static declaration of 'gst_directdraw_sink_get_depth' follows non-static declaration gstdirectdrawsink.c:604: warning: previous implicit declaration of 'gst_directdraw_sink_get_depth' was here gstdirectdrawsink.c: In function `gst_directdraw_sink_get_ddrawcaps': gstdirectdrawsink.c:1518: warning: passing arg 2 of pointer to function from incompatible pointer type gstdirectdrawsink.c:1547: warning: passing arg 5 of pointer to function from incompatible pointer type gstdirectdrawsink.c:1489: warning: unused variable `dwFourccCodeIndex' gstdirectdrawsink.c:1490: warning: unused variable `pdwFourccCodes' gstdirectdrawsink.c:1491: warning: unused variable `dwNbFourccCodes' gstdirectdrawsink.c: In function `gst_directdraw_sink_surface_create': gstdirectdrawsink.c:1628: warning: passing arg 2 of pointer to function from incompatible pointer type gstdirectdrawsink.c:1638: warning: passing arg 3 of pointer to function from incompatible pointer type gstdirectdrawsink.c: At top level: gstdirectdrawsink.c:103: warning: 'gst_directdraw_sink_ddraw_put' declared `static' but never defined
Should be partially fixed in CVS: 2007-05-20 Tim-Philipp Müller <tim at centricular dot net> * sys/directdraw/gstdirectdrawsink.c: (gst_ddrawsurface_finalize), (gst_directdraw_sink_buffer_alloc), (gst_directdraw_sink_get_ddrawcaps), (gst_directdraw_sink_surface_create): Bunch of small fixes: remove static function that doesn't exist; declare another one that does; printf format fix; use right macro when specifying debug category; remove a bunch of unused variables; #if 0 out an unused chunk of code (partially fixes #439914). Not sure what's up with the warnings where there's a DDSURFACEDESC2 surface and &surface is passed to the function though.
I've tried to replace DDSURFACEDESC2 by DDSURFACEDESC to remove the warnings (and there were no warnings), but the plugin didn't work, then. So I think that I can live with these warnings. Nevertheless, there were a warning about an unsued variable and an unused label (after you commented a part of code with a #if 0). Patch below
Created attachment 88527 [details] [review] remove unused variable and label
Created attachment 88713 [details] [review] fix warnings * Remove unused variable and label * fix the DDSURFACEDESC / DDSURFACEDESC2 horror warnings
Comment on attachment 88713 [details] [review] fix warnings * Remove unused variable and label * fix the DDSURFACEDESC / DDSURFACEDESC2 horror warnings * fix spelling of gst_directdraw_sink_get_type in gstdirectdrawsink.h
Thanks, committed: 2007-05-24 Tim-Philipp Müller <tim at centricular dot net> Patch by: Vincent Torri <vtorri at univ-evry fr> * sys/directdraw/gstdirectdrawsink.c: (gst_directdraw_sink_buffer_alloc), (gst_directdraw_sink_show_frame), (gst_directdraw_sink_check_primary_surface), (gst_directdraw_sink_check_offscreen_surface), (EnumModesCallback2), (gst_directdraw_sink_get_ddrawcaps), (gst_directdraw_sink_surface_create): * sys/directdraw/gstdirectdrawsink.h: Fix more warnings when compiling with MingW (#439914). Just to make sure: there are one or two places where you changed DDSURFACEDESC2 surface_desc; - surface_desc.dwSize = sizeof (DDSURFACEDESC); + surface_desc.dwSize = sizeof (surface_desc); ie. changed it from sizeof (DDSURFACEDESC) to sizeof (DDSURFACEDESC2). I presume this was on purpose and the sink still works just fine as you said on IRC, right?
It is on purpose. You must set the dwSize field to the size of the structure. I could just have added a '2', but I prefer using the varable. If the type of surface_desc changes later (I doubt, though), there will be no error in the size of the structure. And yes, I've tested the sink with : gst-launch-0.10.exe --gst-plugins-path=/usr/local/lib/gstreamer-0.10 videotestsrc ! ffmpegcolorspace ! directdrawsink