[MPlayer-dev-eng] [PATCH] Avoid pointer cast warnings

Reimar Döffinger Reimar.Doeffinger at gmx.de
Mon Feb 17 20:13:13 CET 2014


On 17.02.2014, at 19:56, Ingo Brückl <ib at wupperonline.de> wrote:
> Reimar Döffinger wrote on Mon, 17 Feb 2014 18:16:42 +0100:
> 
>> On Mon, Feb 17, 2014 at 04:03:03AM +0100, Ingo Brückl wrote:
>>> So I assume this is necessary for 64-bit machines as well?
> 
>> No, if it's a constant the compiler figures it is ok, as far as I can
>> tell.
> 
> Oh, I just thought because of your
> 
> --- mplayer.c    (revision 36857)
> +++ mplayer.c    (revision 36858)
> @@ -3061,7 +3061,7 @@
>     if (use_gui) {
>         guiInit();
>         gui(GUI_SET_CONTEXT, mpctx);
> -        gui(GUI_SET_STATE, (void *)(filename ? GUI_PLAY : GUI_STOP));
> +        gui(GUI_SET_STATE, (void *)(intptr_t)(filename ? GUI_PLAY : GUI_STOP));
>     }
> #endif
> 
> I wasn't quite sure about integer(?) constants, but the compiler makes a
> difference then between
> 
>  gui(GUI_SET_STATE, (void *)(filename ? GUI_PLAY : GUI_STOP));
> 
> and
> 
>  gui(GUI_SET_STATE, (void *)GUI_PLAY);
> 
> Weird. In both cases, only / the same constants are involved.

"constant" was a bad word choice. "literal" rather. The latter case is an integer literal, the former is an expression.

>> You don't have any 64 bit machine?
> 
> No. The X11/GTK GUI code compiles (even with a few more than the usual
> compiler warning options) free of any warnings here. If not, I would have
> fixed already.

Hm, still, even 32 bit gcc should be able to do it.
Just configure with --cc='gcc -m64' or so.
I guess with qemu you could even run the binaries.


More information about the MPlayer-dev-eng mailing list