[MPlayer-dev-eng] [PATCH] loader compiler warnings

D Richard Felker III dalias at aerifal.cx
Fri Apr 9 06:29:50 CEST 2004


On Thu, Apr 08, 2004 at 11:16:13PM +0200, Dominik 'Rathann' Mierzejewski wrote:
> On Thursday, 08 April 2004 at 19:37, D Richard Felker III wrote:
> > On Thu, Apr 08, 2004 at 06:06:55PM +0200, Dominik 'Rathann' Mierzejewski wrote:
> > > Problem:
> > > if we enable Quicktime codecs, then
> > > win32.c:898: warning: no return statement in function returning non-void
> > > static HANDLE WINAPI expCreateMutexA(void *pSecAttr,
> > >                     char bInitialOwner, const char *name)
> > > {
> > >     HANDLE mlist = (HANDLE)expCreateEventA(pSecAttr, 0, 0, name);
> > > [...]
> > > #ifndef QTX 
> > >     /* 10l to QTX, if CreateMutex returns a real mutex, WaitForSingleObject 
> > >        waits for ever, else it works ;) */
> > >     return mlist;
> > > #endif 
> > > }
> > > 
> > > Solution:
> > > #else 
> > >     return (HANDLE)NULL;
> > 
> > Casting NULL is nonsensical. Just return NULL.
> 
> Why? NULL is a pointer. HANDLE isn't, so we get an "incompatible type"
> warning. OK, maybe return 0; in that case is better. Still, as I said,
> according to Alex we shouldn't return a NULL or 0 here.

If HANDLE isn't a pointer type, then casting NULL to a HANDLE is even
more dumb. You should return 0.

Rich




More information about the MPlayer-dev-eng mailing list