imlib2 port broken on RELENG_4?

Michael Nottebrock michaelnottebrock at gmx.net
Tue Mar 8 02:53:08 PST 2005


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 correct 
of course.

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

-- 
   ,_,   | Michael Nottebrock               | lofi at freebsd.org
 (/^ ^\) | FreeBSD - The Power to Serve     | http://www.freebsd.org
   \u/   | K Desktop Environment on FreeBSD | http://freebsd.kde.org
-------------- next part --------------
Index: files/patch-src-lib-color_helpers.c
===================================================================
RCS file: files/patch-src-lib-color_helpers.c
diff -N files/patch-src-lib-color_helpers.c
--- /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 @@
+    
+    if (s == 0.0)
+      {
+-	*r = lround ((v*255.0)/100.0);
+-	*g = lround ((v*255.0)/100.0);
+-	*b = lround ((v*255.0)/100.0);
++	*r = (long int)rint ((v*255.0)/100.0);
++	*g = (long int)rint ((v*255.0)/100.0);
++	*b = (long int)rint ((v*255.0)/100.0);
+ 	
+ 	return;
+      }
+@@ -73,44 +73,44 @@
+      {
+       case 0:
+ 	  {
+-	     *r = lround (v*255.0 / 100.0);
+-	     *g = lround (t*255.0);
+-	     *b = lround (p*255.0);
++	     *r = (long int)rint (v*255.0 / 100.0);
++	     *g = (long int)rint (t*255.0);
++	     *b = (long int)rint (p*255.0);
+ 	     break;
+ 	  }
+       case 1:
+ 	  {
+-	     *r = lround (q*255.0);
+-	     *g = lround (v*255.0 / 100.0);
+-	     *b = lround (p*255.0);
++	     *r = (long int)rint (q*255.0);
++	     *g = (long int)rint (v*255.0 / 100.0);
++	     *b = (long int)rint (p*255.0);
+ 	     break;
+ 	  }
+       case 2:
+ 	  {
+-	     *r = lround (p*255.0);
+-	     *g = lround (v*255.0 / 100.0);
+-	     *b = lround (t*255.0);
++	     *r = (long int)rint (p*255.0);
++	     *g = (long int)rint (v*255.0 / 100.0);
++	     *b = (long int)rint (t*255.0);
+ 	     break;
+ 	  }
+       case 3:
+ 	  {
+-	     *r = lround (p*255.0);
+-	     *g = lround (q*255.0);
+-	     *b = lround (v*255.0 / 100.0);
++	     *r = (long int)rint (p*255.0);
++	     *g = (long int)rint (q*255.0);
++	     *b = (long int)rint (v*255.0 / 100.0);
+ 	     break;
+ 	  }
+       case 4:
+ 	  {
+-	     *r = lround (t*255.0);
+-	     *g = lround (p*255.0);
+-	     *b = lround (v*255.0 / 100.0);
++	     *r = (long int)rint (t*255.0);
++	     *g = (long int)rint (p*255.0);
++	     *b = (long int)rint (v*255.0 / 100.0);
+ 	     break;
+ 	  }
+       case 5:
+ 	  {
+-	     *r = lround (v*255.0 / 100.0);
+-	     *g = lround (p*255.0);
+-	     *b = lround (q*255.0);
++	     *r = (long int)rint (v*255.0 / 100.0);
++	     *g = (long int)rint (p*255.0);
++	     *b = (long int)rint (q*255.0);
+ 	     break;
+ 	  }
+      }
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 187 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-ports/attachments/20050308/607e1148/attachment.bin


More information about the freebsd-ports mailing list