[MPlayer-dev-eng] Patch for gcc 3.4 against MPlayer-1.0pre5

Joey Parrish joey at nicewarrior.org
Wed Aug 18 21:16:24 CEST 2004


On Tue, Aug 17, 2004 at 10:42:22PM -0300, Mario Sergio Fujikawa Ferreira wrote:
> 	The FreeBSD port is now using these patches.
> I hope you find them useful though I guess you might have
> other solutions for this issue. :)

>  // Integer to float conversion through lrintf()
>  #ifdef HAVE_LRINTF
> +#ifdef __FreeBSD__
> +#include <math.h>
> +#define lrintf(x) rintf(x)
> +#else
>  #define __USE_ISOC99 1
>  #include <math.h>
> +#endif
>  #else
>  #define lrintf(x) ((int)(x))
>  #endif

This doesn't seem right.
The configure check for lrtinf is:

 #include <math.h>
 int main(void) { (void) lrintf(0.0); return 0; }

So if you HAVE_LRINTF, then math.h is enough even on FreeBSD.
Otherwise, the check should have failed.
So I think #define lrintf for FreeBSD shouldn't be needed.
Further, there's no point in defining __USE_ISOC99, because if you
needed it then the check in configure would fail.
So either put that #def in the configure check as well or leave it out
of the source.

How about this:

#include <math.h>
#ifndef HAVE_LRINTF
#define lrintf ((int)(x))
#endif

This is far simpler than the proposed change, and also simpler than
the original.  Also, the comment was backwards.  It converts float
to integer.

> +
> +// Integer to float conversion through lrintf()
> +#ifdef HAVE_LRINTF
> +#ifdef __FreeBSD__
> +#include <math.h>
> +#define lrintf(x) rintf(x)
> +#else
> +#define __USE_ISOC99 1
> +#include <math.h>
> +#endif
> +#else
> +#define lrintf(x) ((int)(x))
> +#endif
> +

If these changes are needed in so many files, then maybe we should add
this somewhere rather than #defining it:

#ifndef HAVE_LRINTF
long int lrintf(float x)
{
  return (long int)x;
}
#endif

-- 
"The Hell Law says that Hell is reserved exclusively for them that believe
in it.  Further, the lowest Rung in Hell is reserved for them that believe
in it on the supposition that they'll go there if they don't."
  HBT; The Gospel According to Fred, 3:1




More information about the MPlayer-dev-eng mailing list