Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 8 Mar 2005 11:52:50 +0100
From:      Michael Nottebrock <michaelnottebrock@gmx.net>
To:        "Vanilla I. Shu" <vanilla@fatpipi.cirx.org>
Cc:        freebsd-ports@freebsd.org
Subject:   Re: imlib2 port broken on RELENG_4?
Message-ID:  <200503081152.54237.michaelnottebrock@gmx.net>
In-Reply-To: <20050308094914.GA58071@fatpipi.cirx.org>
References:  <1110223267.1739.64.camel@think> <200503081019.14427.michaelnottebrock@gmx.net> <20050308094914.GA58071@fatpipi.cirx.org>

next in thread | previous in thread | raw e-mail | index | archive | help
--nextPart1180537.gPHzkPQ7K3
Content-Type: multipart/mixed;
  boundary="Boundary-01=_DQYLC+D3uxfBLsr"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

--Boundary-01=_DQYLC+D3uxfBLsr
Content-Type: text/plain;
  charset="big5"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline

On Tuesday, 8. March 2005 10:49, Vanilla I. Shu wrote:
> On Tue, Mar 08, 2005 at 10:19:10AM +0100, Michael Nottebrock wrote:
> > On Tuesday, 8. March 2005 00:11, Michael C. Shultz wrote:
> > > ../../src/lib/.libs/libImlib2.so: undefined reference to `round'
> >
> > So replace round() with rint() as well (no extra cast required).
>
> thanks.

Uh, sorry, that reply was kinda bogus, I didn't read the whole thread.

round() isn't in 4.x either and the extra cast for lround to rint is correc=
t=20
of course.

Here's a complete patch for imlib2, tested on 4.11. Note that it's not wort=
h=20
the effort to conditionalize the patch on OSVERSION, since [l]lround[f] hav=
e=20
only been very recently added to FreeBSD. Better add a configure-check for=
=20
lround and some rounding-macro to the upstream sources (I've done that a lo=
t=20
in KDE recently, too).

=2D-=20
   ,_,   | Michael Nottebrock               | lofi@freebsd.org
 (/^ ^\) | FreeBSD - The Power to Serve     | http://www.freebsd.org
   \u/   | K Desktop Environment on FreeBSD | http://freebsd.kde.org

--Boundary-01=_DQYLC+D3uxfBLsr
Content-Type: text/plain;
  charset="big5";
  name="imlib2.diff"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: attachment;
	filename="imlib2.diff"

Index: files/patch-src-lib-color_helpers.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: files/patch-src-lib-color_helpers.c
diff -N files/patch-src-lib-color_helpers.c
=2D-- /dev/null	1 Jan 1970 00:00:00 -0000
+++ files/patch-src-lib-color_helpers.c	8 Mar 2005 10:49:59 -0000
@@ -0,0 +1,78 @@
+--- src/lib/color_helpers.c.orig	Tue Mar  8 11:34:57 2005
++++ src/lib/color_helpers.c	Tue Mar  8 11:35:40 2005
+@@ -54,9 +54,9 @@
+   =20
+    if (s =3D=3D 0.0)
+      {
+-	*r =3D lround ((v*255.0)/100.0);
+-	*g =3D lround ((v*255.0)/100.0);
+-	*b =3D lround ((v*255.0)/100.0);
++	*r =3D (long int)rint ((v*255.0)/100.0);
++	*g =3D (long int)rint ((v*255.0)/100.0);
++	*b =3D (long int)rint ((v*255.0)/100.0);
+ =09
+ 	return;
+      }
+@@ -73,44 +73,44 @@
+      {
+       case 0:
+ 	  {
+-	     *r =3D lround (v*255.0 / 100.0);
+-	     *g =3D lround (t*255.0);
+-	     *b =3D lround (p*255.0);
++	     *r =3D (long int)rint (v*255.0 / 100.0);
++	     *g =3D (long int)rint (t*255.0);
++	     *b =3D (long int)rint (p*255.0);
+ 	     break;
+ 	  }
+       case 1:
+ 	  {
+-	     *r =3D lround (q*255.0);
+-	     *g =3D lround (v*255.0 / 100.0);
+-	     *b =3D lround (p*255.0);
++	     *r =3D (long int)rint (q*255.0);
++	     *g =3D (long int)rint (v*255.0 / 100.0);
++	     *b =3D (long int)rint (p*255.0);
+ 	     break;
+ 	  }
+       case 2:
+ 	  {
+-	     *r =3D lround (p*255.0);
+-	     *g =3D lround (v*255.0 / 100.0);
+-	     *b =3D lround (t*255.0);
++	     *r =3D (long int)rint (p*255.0);
++	     *g =3D (long int)rint (v*255.0 / 100.0);
++	     *b =3D (long int)rint (t*255.0);
+ 	     break;
+ 	  }
+       case 3:
+ 	  {
+-	     *r =3D lround (p*255.0);
+-	     *g =3D lround (q*255.0);
+-	     *b =3D lround (v*255.0 / 100.0);
++	     *r =3D (long int)rint (p*255.0);
++	     *g =3D (long int)rint (q*255.0);
++	     *b =3D (long int)rint (v*255.0 / 100.0);
+ 	     break;
+ 	  }
+       case 4:
+ 	  {
+-	     *r =3D lround (t*255.0);
+-	     *g =3D lround (p*255.0);
+-	     *b =3D lround (v*255.0 / 100.0);
++	     *r =3D (long int)rint (t*255.0);
++	     *g =3D (long int)rint (p*255.0);
++	     *b =3D (long int)rint (v*255.0 / 100.0);
+ 	     break;
+ 	  }
+       case 5:
+ 	  {
+-	     *r =3D lround (v*255.0 / 100.0);
+-	     *g =3D lround (p*255.0);
+-	     *b =3D lround (q*255.0);
++	     *r =3D (long int)rint (v*255.0 / 100.0);
++	     *g =3D (long int)rint (p*255.0);
++	     *b =3D (long int)rint (q*255.0);
+ 	     break;
+ 	  }
+      }

--Boundary-01=_DQYLC+D3uxfBLsr--

--nextPart1180537.gPHzkPQ7K3
Content-Type: application/pgp-signature

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.0 (FreeBSD)

iD8DBQBCLYQGXhc68WspdLARAuB+AJ4p2GZkwvmkP2wJwDor3eR7CLZUwQCeIlzM
LWC3BsE8QnnaTIpTXUAdXkk=
=6wdA
-----END PGP SIGNATURE-----

--nextPart1180537.gPHzkPQ7K3--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200503081152.54237.michaelnottebrock>