pkgsrc-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

pkg/28984: graphics/imlib2 does not build on NetBSD 2.0



>Number:         28984
>Category:       pkg
>Synopsis:       graphics/imlib2 uses lround, which is not available on NetBSD
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    pkg-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sun Jan 16 15:18:00 +0000 2005
>Originator:     Peter Bex
>Release:        NetBSD 2.0_RC1
>Organization:
>Environment:
        
        
System: NetBSD frohike.nvie.com 2.0_RC1 NetBSD 2.0_RC1 (FROHIKE) #3: Wed Sep 29 
19:34:49 CEST 2004 root@:/usr/src/sys/arch/i386/compile/FROHIKE i386
Architecture: i386
Machine: i386
>Description:
        When building graphics/imlib2, the build fails on
        ${WRKSRC}/src/lib/color_helpers.c, since it can't find lround().
>How-To-Repeat:
        Build graphics/imlib2 on a NetBSD 2.0 or earlier system.
        According to man.netbsd.org, -current doesn't have an lround()
        implementation either.

        According to 
http://www.FreeBSD.org/cgi/man.cgi?query=lround&apropos=0&sektion=0&manpath=Red+Hat+Linux%2Fi386+9&format=html
        lround() is C99, so I suppose NetBSD should eventually support this
        function.  Maybe this means I should send another PR about this
        missing functionality?
>Fix:

The fix is trivial.  Because the result of lround() is put into an ordinary
integer, the function call can be changed into a normal round() call.

$NetBSD$

--- src/lib/color_helpers.c.orig        2005-01-08 08:55:02.000000000 +0100
+++ src/lib/color_helpers.c
@@ -54,9 +54,9 @@ __imlib_hsv_to_rgb(float h, float s, flo
    
    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 = round ((v*255.0)/100.0);
+       *g = round ((v*255.0)/100.0);
+       *b = round ((v*255.0)/100.0);
        
        return;
      }
@@ -73,44 +73,44 @@ __imlib_hsv_to_rgb(float h, float s, flo
      {
       case 0:
          {
-            *r = lround (v*255.0 / 100.0);
-            *g = lround (t*255.0);
-            *b = lround (p*255.0);
+            *r = round (v*255.0 / 100.0);
+            *g = round (t*255.0);
+            *b = round (p*255.0);
             break;
          }
       case 1:
          {
-            *r = lround (q*255.0);
-            *g = lround (v*255.0 / 100.0);
-            *b = lround (p*255.0);
+            *r = round (q*255.0);
+            *g = round (v*255.0 / 100.0);
+            *b = round (p*255.0);
             break;
          }
       case 2:
          {
-            *r = lround (p*255.0);
-            *g = lround (v*255.0 / 100.0);
-            *b = lround (t*255.0);
+            *r = round (p*255.0);
+            *g = round (v*255.0 / 100.0);
+            *b = round (t*255.0);
             break;
          }
       case 3:
          {
-            *r = lround (p*255.0);
-            *g = lround (q*255.0);
-            *b = lround (v*255.0 / 100.0);
+            *r = round (p*255.0);
+            *g = round (q*255.0);
+            *b = round (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 = round (t*255.0);
+            *g = round (p*255.0);
+            *b = round (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 = round (v*255.0 / 100.0);
+            *g = round (p*255.0);
+            *b = round (q*255.0);
             break;
          }
      }

>Unformatted:
        
        



Home | Main Index | Thread Index | Old Index